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
Testing equality to None
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/simpledownloader.py
[ { "content": "def download(name, image, url):\n\n from resources.lib.libraries import control\n\n if url == None:\n return control.infoDialog(control.lang(30501).encode('utf-8'))\n\n try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))\n except: headers = dict('')\n\n url = url.split('|')[0]\n\n content = re.compile('(.+?)\\sS(\\d*)E\\d*$').findall(name)\n transname = name.translate(None, '\\/:*?\"<>|').strip('.')\n levels =['../../../..', '../../..', '../..', '..']\n\n if len(content) == 0:\n dest = control.setting('movie_downloads')\n dest = control.transPath(dest)\n for level in levels:\n try: control.makeFile(os.path.abspath(os.path.join(dest, level)))\n except: pass\n control.makeFile(dest)\n dest = os.path.join(dest, transname)\n control.makeFile(dest)\n else:\n dest = control.setting('tv_downloads')\n dest = control.transPath(dest)\n for level in levels:\n try: control.makeFile(os.path.abspath(os.path.join(dest, level)))\n except: pass\n control.makeFile(dest)\n transtvshowtitle = content[0][0].translate(None, '\\/:*?\"<>|').strip('.')\n dest = os.path.join(dest, transtvshowtitle)\n control.makeFile(dest)\n dest = os.path.join(dest, 'Season %01d' % int(content[0][1]))\n control.makeFile(dest)\n\n ext = os.path.splitext(urlparse.urlparse(url).path)[1][1:]\n if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4'\n dest = os.path.join(dest, transname + '.' + ext)\n\n sysheaders = urllib.quote_plus(json.dumps(headers))\n\n sysurl = urllib.quote_plus(url)\n\n systitle = urllib.quote_plus(name)\n\n sysimage = urllib.quote_plus(image)\n\n sysdest = urllib.quote_plus(dest)\n\n script = inspect.getfile(inspect.currentframe())\n cmd = 'RunScript(%s, %s, %s, %s, %s, %s)' % (script, sysurl, sysdest, systitle, sysimage, sysheaders)\n\n xbmc.executebuiltin(cmd)", "metadata": "root.download", "header": "['module', '___EOS___']", "index": 32 } ]
[ { "span": "url == None:", "start_line": 36, "start_column": 7, "end_line": 36, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "download_", "(_", "name_", ",_", "image_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "resources_", "._", "lib_", "._", "libraries_", "import_", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "url_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "305", "01_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "headers_", "=_", "dict_", "(_", "urlparse_", "._", "parse", "\\u", "qs", "l_", "(_", "url_", "._", "rsplit_", "(_", "'|'_", ",_", "1_", ")_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "headers_", "=_", "dict_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "url_", "._", "split_", "(_", "'|'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "re_", "._", "compile_", "(_", "'(", ".+?)", "\\\\", "s", "S", "(\\\\", "d", "*)", "E", "\\\\", "d", "*$'_", ")_", "._", "findall_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "name_", "=_", "name_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "levels_", "=_", "[_", "'../../", "..", "/.", ".'_", ",_", "'../../", "..'_", ",_", "'../", "..'_", ",_", "'..'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "=_", "control_", "._", "setting_", "(_", "'", "movie", "\\u", "download", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "control_", "._", "trans", "Path_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "level_", "in_", "levels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "control_", "._", "make", "File_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "level_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "trans", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "=_", "control_", "._", "setting_", "(_", "'", "tv", "\\u", "download", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "control_", "._", "trans", "Path_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "level_", "in_", "levels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "control_", "._", "make", "File_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "level_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "tvshow", "title_", "=_", "content_", "[_", "0_", "]_", "[_", "0_", "]_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "trans", "tvshow", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "'", "Season", " ", "%", "01", "d", "'_", "%_", "int_", "(_", "content_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "._", "path_", ")_", "[_", "1_", "]_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ext_", "in_", "[_", "'", "mp", "4", "'_", ",_", "'", "mkv", "'_", ",_", "'", "fl", "v", "'_", ",_", "'", "avi", "'_", ",_", "'", "mpg", "'_", "]_", ":_", "ext_", "=_", "'", "mp", "4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dest_", ",_", "trans", "name_", "+_", "'.'_", "+_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "headers_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "json_", "._", "dumps_", "(_", "headers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "url_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "syst", "itle_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sysi", "mage_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "dest_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "inspect_", "._", "getfile", "_", "(_", "inspect_", "._", "currentframe_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "Run", "Script", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")'_", "%_", "(_", "script_", ",_", "sys", "url_", ",_", "sys", "dest_", ",_", "syst", "itle_", ",_", "sysi", "mage_", ",_", "sys", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xbmc_", "._", "executebuiltin_", "(_", "cmd_", ")_", "\\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, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/lxml-3.3.6/src/lxml/html/tests/test_elementsoup.py
[ { "content": "import unittest, sys\nfrom lxml.tests.common_imports import make_doctest, HelperTestCase\n\ntry:\n import BeautifulSoup\n BS_INSTALLED = True\nexcept ImportError:\n BS_INSTALLED = False\n\nif BS_INSTALLED:\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " class SoupParserTestCase(HelperTestCase):\n from lxml.html import soupparser\n", "metadata": "root.SoupParserTestCase", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def test_broken_attribute(self):\n html = \"\"\"\\\n <html><head></head><body>\n <form><input type='text' disabled size='10'></form>\n </body></html>\n \"\"\"\n root = self.soupparser.fromstring(html)\n self.assertTrue(root.find('.//input').get('disabled') is not None)", "metadata": "root.SoupParserTestCase.test_broken_attribute", "header": "['class', 'SoupParserTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": "def test_suite():\n suite = unittest.TestSuite()\n if BS_INSTALLED:\n suite.addTests([unittest.makeSuite(SoupParserTestCase)])\n if sys.version_info[0] < 3:\n suite.addTests([make_doctest('../../../../doc/elementsoup.txt')])\n return suite", "metadata": "root.test_suite", "header": "['module', '___EOS___']", "index": 23 } ]
[ { "span": "import BeautifulSoup", "start_line": 4, "start_column": 4, "end_line": 4, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "._", "tests_", "._", "common", "\\u", "imports_", "import_", "make", "\\u", "doctest_", ",_", "Help", "er", "Test", "Case_", "\\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_", "Bea", "uti", "ful", "Soup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BS", "\\u", "INSTALLE", "D_", "=_", "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 ", " _", "BS", "\\u", "INSTALLE", "D_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "BS", "\\u", "INSTALLE", "D_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Sou", "p", "Parser", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lxml_", "._", "html_", "import_", "soup", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sou", "p", "Parser", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "broken", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "<", "html", "><", "head", "><", "/", "head", "><", "body", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "form", "><", "input", " ", "type", "='", "text", "'", " ", "disable", "d", " ", "size", "='", "10", "'><", "/", "form", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "</", "body", "><", "/", "html", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "self_", "._", "soup", "parser_", "._", "fromstring_", "(_", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "root_", "._", "find_", "(_", "'./", "/", "input", "'_", ")_", "._", "get_", "(_", "'", "disable", "d", "'_", ")_", "is_", "not_", "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", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "BS", "\\u", "INSTALLE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "add", "Tests_", "(_", "[_", "unittest_", "._", "make", "Suite_", "(_", "Sou", "p", "Parser", "Test", "Case_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "add", "Tests_", "(_", "[_", "make", "\\u", "doctest_", "(_", "'../../", "../../", "doc", "/", "element", "soup", ".", "txt", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "suite_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
trebuchet-deploy/trigger/trigger/drivers/trebuchet/local.py
[ { "content": "#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport os\nimport json\nimport subprocess\nimport trigger.config as config\nimport trigger.drivers as drivers\n\nimport redis\n\nfrom datetime import datetime\nfrom trigger.drivers import SyncDriverError\nfrom trigger.drivers import LockDriverError\nfrom trigger.drivers import ServiceDriverError\nfrom trigger.drivers import ReportDriverError\n\nLOG = config.LOG\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SyncDriver(drivers.SyncDriver):\n\n\n\n\n\n\n\n\n", "metadata": "root.SyncDriver", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def __init__(self, conf):\n self.conf = conf\n self._deploy_dir = os.path.join(self.conf.repo.git_dir,\n 'deploy')\n self._deploy_file = os.path.join(self._deploy_dir, 'deploy')\n self._report_driver = conf.drivers['report-driver']", "metadata": "root.SyncDriver.__init__", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 32 }, { "content": " def get_config(self):\n return {\n 'deploy.checkout-submodules': {\n 'required': False,\n 'default': False\n }\n }", "metadata": "root.SyncDriver.get_config", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 39 }, { "content": " def _write_deploy_file(self, tag):\n timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')\n tag_info = {\n 'tag': tag.name,\n 'sync-time': timestamp,\n 'time': timestamp,\n 'user': self.conf.config['user.name'],\n }\n try:\n f = open(self._deploy_file, 'w+')\n f.write(json.dumps(tag_info))\n f.close()\n except OSError:\n raise SyncDriverError('Failed to write deploy file', 1)", "metadata": "root.SyncDriver._write_deploy_file", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 47 }, { "content": " def _update_server_info(self, tag):\n # TODO (ryan-lane): Use GitPython for this function if possible\n # TODO (ryan-lane): Check return values from these commands\n p = subprocess.Popen(['git','update-server-info'],\n cwd=self._deploy_dir,\n stderr=subprocess.PIPE)\n p.communicate()\n # Also update server info for all submodules\n if self.conf.config['deploy.checkout-submodules']:\n # The same tag used in the parent needs to exist in the submodule\n p = subprocess.Popen(['git','submodule','foreach','--recursive',\n 'git','tag',tag.name],\n cwd=self.conf.repo.working_dir,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n p.communicate()\n p = subprocess.Popen(['git','submodule','foreach','--recursive',\n 'trigger-submodule-update'],\n cwd=self.conf.repo.working_dir,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n p.communicate()", "metadata": "root.SyncDriver._update_server_info", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 62 }, { "content": " def _fetch(self, args):\n # TODO (ryan-lane): Check return values from these commands\n repo_name = self.conf.config['deploy.repo-name']\n p = subprocess.Popen(['sudo','salt-call','-l','quiet','publish.runner',\n 'deploy.fetch', repo_name],\n stdout=subprocess.PIPE)\n p.communicate()", "metadata": "root.SyncDriver._fetch", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 85 }, { "content": " def _checkout(self, args):\n # TODO (ryan-lane): Check return values from these commands\n repo_name = self.conf.config['deploy.repo-name']\n p = subprocess.Popen(['sudo','salt-call','-l','quiet','publish.runner',\n 'deploy.checkout', repo_name+','+str(args.force)],\n stdout=subprocess.PIPE)\n p.communicate()", "metadata": "root.SyncDriver._checkout", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 93 }, { "content": " def _ask(self, stage, args, tag):\n self._report_driver.report_sync(tag,\n report_type=stage)\n while True:\n answer = raw_input(\"Continue? ([d]etailed/[C]oncise report,\"\n \"[y]es,[n]o,[r]etry): \")\n if not answer or answer == \"c\" or answer == \"C\":\n self._report_driver.report_sync(tag,\n report_type=stage)\n elif answer == \"d\" or answer == \"D\":\n self._report_driver.report_sync(tag,\n report_type=stage,\n detailed=True)\n elif answer == \"Y\" or answer == \"y\":\n return True\n elif answer == \"N\" or answer == \"n\":\n return False\n elif answer == \"R\" or answer == \"r\":\n if stage == \"fetch\":\n self._fetch(args)\n if stage == \"checkout\":\n self._checkout(args)", "metadata": "root.SyncDriver._ask", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 101 }, { "content": " def sync(self, tag, args):\n # TODO (ryan-lane): Break sync up into two stages and move this\n # logic out of the driver\n self._write_deploy_file(tag)\n self._update_server_info(tag)\n self._fetch(args)\n # TODO (ryan-lane): Add repo dependencies here\n if not self._ask('fetch', args, tag.name):\n msg = ('Not continuing to checkout phase. A deployment is still'\n ' underway, please finish, sync, or abort.')\n raise SyncDriverError(msg, 2)\n self._checkout(args)\n if not self._ask('checkout', args, tag.name):\n msg = ('Not continuing to finish phase. A checkout has already'\n ' occurred. Please finish, sync or revert. Aborting'\n ' at this phase is not recommended.')\n raise SyncDriverError(msg, 3)", "metadata": "root.SyncDriver.sync", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 124 }, { "content": " def get_deploy_info(self):\n try:\n f = open(self._deploy_file, 'r')\n deploy_info = json.loads(f.read())\n f.close()\n return deploy_info\n except OSError:\n raise SyncDriverError('Failed to load deploy file', 3)", "metadata": "root.SyncDriver.get_deploy_info", "header": "['class', 'SyncDriver', '(', 'drivers', '.', 'SyncDriver', ')', ':', '___EOS___']", "index": 142 }, { "content": "class LockDriver(drivers.LockDriver):\n\n\n\n\n", "metadata": "root.LockDriver", "header": "['module', '___EOS___']", "index": 152 }, { "content": " def __init__(self, conf):\n self.conf = conf\n self._deploy_dir = os.path.join(self.conf.repo.git_dir,\n 'deploy')\n self._lock_file = os.path.join(self._deploy_dir, 'lock')\n self._create_deploy_dir()", "metadata": "root.LockDriver.__init__", "header": "['class', 'LockDriver', '(', 'drivers', '.', 'LockDriver', ')', ':', '___EOS___']", "index": 154 }, { "content": " def _create_deploy_dir(self):\n if os.path.isdir(self._deploy_dir):\n return\n try:\n os.mkdir(self._deploy_dir)\n except OSError:\n raise LockDriverError('Failed to create deploy directory', 1)", "metadata": "root.LockDriver._create_deploy_dir", "header": "['class', 'LockDriver', '(', 'drivers', '.', 'LockDriver', ')', ':', '___EOS___']", "index": 161 }, { "content": " def add_lock(self, args):\n timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')\n lock_info = {\n 'time': timestamp,\n 'user': self.conf.config['user.name'],\n }\n try:\n f = open(self._lock_file, 'w+')\n f.write(json.dumps(lock_info))\n f.close()\n except (OSError, IOError):\n raise LockDriverError('Failed to write lock file', 1)", "metadata": "root.LockDriver.add_lock", "header": "['class', 'LockDriver', '(', 'drivers', '.', 'LockDriver', ')', ':', '___EOS___']", "index": 169 }, { "content": " def remove_lock(self, args):\n try:\n os.remove(self._lock_file)\n except OSError:\n raise LockDriverError('Failed to remove lock file', 3)", "metadata": "root.LockDriver.remove_lock", "header": "['class', 'LockDriver', '(', 'drivers', '.', 'LockDriver', ')', ':', '___EOS___']", "index": 182 }, { "content": " def check_lock(self, args):\n try:\n f = open(self._lock_file, 'r')\n lock_info = f.read()\n lock_info = json.loads(lock_info)\n f.close()\n return lock_info\n except (OSError, IOError):\n return {}\n except (KeyError, ValueError):\n return {'user': None, 'time': None}", "metadata": "root.LockDriver.check_lock", "header": "['class', 'LockDriver', '(', 'drivers', '.', 'LockDriver', ')', ':', '___EOS___']", "index": 188 }, { "content": "class ServiceDriver(drivers.ServiceDriver):\n\n", "metadata": "root.ServiceDriver", "header": "['module', '___EOS___']", "index": 201 }, { "content": " def __init__(self, conf):\n self.conf = conf", "metadata": "root.ServiceDriver.__init__", "header": "['class', 'ServiceDriver', '(', 'drivers', '.', 'ServiceDriver', ')', ':', '___EOS___']", "index": 203 }, { "content": " def restart(self, args):\n repo_name = self.conf.config['deploy.repo-name']\n p = subprocess.Popen(['sudo','salt-call','-l','quiet','--out=json',\n 'publish.runner','deploy.restart',\n repo_name+','+str(args.batch)],\n stdout=subprocess.PIPE)\n out = p.communicate()[0]\n ## Disabled until salt bug is fixed:\n ## https://github.com/saltstack/salt/issues/9146\n #LOG.info('Service restart sent to salt. Check the status using:'\n # ' deploy-info --repo={0} --restart'.format(repo))\n ## Display the data directly from the runner return until bug is fixed.\n try:\n minion_data = json.loads(out)\n except (ValueError, AttributeError):\n msg = 'Could not parse salt return; raw output:\\n\\n{0}'\n raise ServiceDriverError(msg.format(out), 1)\n minion_data = minion_data['local']\n if isinstance(minion_data, basestring):\n msg = 'Error received from salt; raw output:\\n\\n{0}'\n raise ServiceDriverError(msg.format(minion_data), 2)\n for i in minion_data:\n try:\n for minion, data in i.items():\n try:\n LOG.info('{0}: {1}'.format(minion, data['status']))\n except KeyError:\n LOG.info('{0}: No status available'.format(minion))\n except AttributeError:\n LOG.error('Got bad return from salt. Here is the raw data:')\n LOG.error('{}'.format(i))", "metadata": "root.ServiceDriver.restart", "header": "['class', 'ServiceDriver', '(', 'drivers', '.', 'ServiceDriver', ')', ':', '___EOS___']", "index": 206 }, { "content": "class ReportDriver(drivers.ReportDriver):\n\n\n\n\n\n\n", "metadata": "root.ReportDriver", "header": "['module', '___EOS___']", "index": 239 }, { "content": " def __init__(self, conf):\n self.conf = conf", "metadata": "root.ReportDriver.__init__", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 241 }, { "content": " def _get_redis_serv(self):\n # TODO (ryan-lane): Load this info from config\n return redis.Redis(host='localhost', port=6379, db=0)", "metadata": "root.ReportDriver._get_redis_serv", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 244 }, { "content": " def _mins_ago(self, now, timestamp):\n if timestamp:\n time = datetime.fromtimestamp(float(timestamp))\n delta = now - time\n mins = delta.seconds / 60\n else:\n mins = None\n return mins", "metadata": "root.ReportDriver._mins_ago", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 248 }, { "content": " def _get_minion_data(self, serv, repo, minion):\n # TODO (ryan-lane): use hgetall, this is absurd\n data = {}\n now = datetime.now()\n minion_key = 'deploy:{0}:minions:{1}'.format(repo, minion)\n data['fetch_status'] = serv.hget(minion_key, 'fetch_status')\n fetch_checkin_timestamp = serv.hget(minion_key,\n 'fetch_checkin_timestamp')\n data['fetch_checkin_mins'] = self._mins_ago(now,\n fetch_checkin_timestamp)\n fetch_timestamp = serv.hget(minion_key, 'fetch_timestamp')\n data['fetch_mins'] = self._mins_ago(now, fetch_timestamp)\n data['checkout_status'] = serv.hget(minion_key, 'checkout_status')\n checkout_checkin_timestamp = serv.hget(minion_key,\n 'checkout_checkin_timestamp')\n _c_checkin_t = self._mins_ago(now, checkout_checkin_timestamp)\n data['checkout_checkin_mins'] = _c_checkin_t\n checkout_timestamp = serv.hget(minion_key, 'checkout_timestamp')\n data['checkout_mins'] = self._mins_ago(now, checkout_timestamp)\n data['tag'] = serv.hget(minion_key, 'tag')\n data['fetch_tag'] = serv.hget(minion_key, 'fetch_tag')\n restart_checkin_timestamp = serv.hget(minion_key,\n 'restart_checkin_timestamp')\n _r_c_t = self._mins_ago(now, restart_checkin_timestamp)\n data['restart_checkin_mins'] = _r_c_t\n data['restart_status'] = serv.hget(minion_key, 'restart_status')\n restart_timestamp = serv.hget(minion_key, 'restart_timestamp')\n data['restart_mins'] = self._mins_ago(now, restart_timestamp)\n return data", "metadata": "root.ReportDriver._get_minion_data", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 257 }, { "content": " def report_sync(self, tag, report_type='full', detailed=False):\n serv = self._get_redis_serv()\n repo_name = self.conf.config['deploy.repo-name']\n LOG.info('Repo: {}'.format(repo_name))\n LOG.info('Tag: {}'.format(tag))\n minions = serv.smembers('deploy:{0}:minions'.format(repo_name))\n _fetch_info = self._get_fetch_info(serv, repo_name, minions, tag)\n _checkout_info = self._get_checkout_info(serv, repo_name, minions, tag)\n min_len = len(minions)\n fetch_len = len(_fetch_info['complete'])\n checkout_len = len(_checkout_info['complete'])\n fetch_report = \"{0}/{1} minions completed fetch\"\n fetch_report = fetch_report.format(fetch_len, min_len)\n checkout_report = \"{0}/{1} minions completed checkout\"\n checkout_report = checkout_report.format(checkout_len, min_len)\n if report_type == 'fetch':\n msgs = fetch_report\n elif report_type == 'checkout':\n msgs = checkout_report\n else:\n msgs = '{0}; {1}'.format(fetch_report, checkout_report)\n LOG.info(\"\")\n LOG.info(msgs)\n if detailed:\n LOG.info(\"\")\n LOG.info(\"Details:\")\n LOG.info(\"\")\n msg = (\"{0} status: {1} [started: {2} mins ago,\"\n \" last-return: {3} mins ago]\")\n for minion in minions:\n try:\n data = _fetch_info['pending'][minion]\n except KeyError:\n if report_type == 'fetch':\n continue\n data = _fetch_info['complete'][minion]\n fetch_msg = msg.format('fetch',\n data['fetch_status'],\n data['fetch_checkin_mins'],\n data['fetch_mins'])\n try:\n data = _checkout_info['pending'][minion]\n except KeyError:\n if report_type == 'checkout':\n continue\n data = _checkout_info['complete'][minion]\n checkout_msg = msg.format('checkout',\n data['checkout_status'],\n data['checkout_checkin_mins'],\n data['checkout_mins'])\n if report_type == 'fetch':\n msgs = '\\n\\t{}'.format(fetch_msg)\n elif report_type == 'checkout':\n msgs = '\\n\\t{}'.format(checkout_msg)\n else:\n msgs = '\\n\\t{0}\\n\\t{1}'.format(fetch_msg, checkout_msg)\n msgs = \"{0}: {1}\".format(minion, msgs)\n LOG.info(msgs)", "metadata": "root.ReportDriver.report_sync", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 287 }, { "content": " def _get_fetch_info(self, serv, repo_name, minions, tag):\n ret = {'complete': {}, 'pending': {}}\n for minion in minions:\n data = self._get_minion_data(serv, repo_name, minion)\n if data['fetch_tag'] == tag:\n ret['complete'][minion] = data\n else:\n ret['pending'][minion] = data\n return ret", "metadata": "root.ReportDriver._get_fetch_info", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 346 }, { "content": " def _get_checkout_info(self, serv, repo_name, minions, tag):\n ret = {'complete': {}, 'pending': {}}\n for minion in minions:\n data = self._get_minion_data(serv, repo_name, minion)\n if data['tag'] == tag:\n ret['complete'][minion] = data\n else:\n ret['pending'][minion] = data\n return ret", "metadata": "root.ReportDriver._get_checkout_info", "header": "['class', 'ReportDriver', '(', 'drivers', '.', 'ReportDriver', ')', ':', '___EOS___']", "index": 356 } ]
[ { "span": "from trigger.drivers import ReportDriverError", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "trigger_", "._", "config_", "as_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "trigger_", "._", "drivers_", "as_", "drivers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trigger_", "._", "drivers_", "import_", "Sync", "Drive", "r", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trigger_", "._", "drivers_", "import_", "Lock", "Drive", "r", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trigger_", "._", "drivers_", "import_", "Service", "Drive", "r", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trigger_", "._", "drivers_", "import_", "Report", "Drive", "r", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "config_", "._", "LOG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\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_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conf_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deploy", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "conf_", "._", "repo_", "._", "git", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deploy", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "deploy", "\\u", "dir_", ",_", "'", "deploy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report", "\\u", "driver_", "=_", "conf_", "._", "drivers_", "[_", "'", "report", "-", "driver", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", ".", "check", "out", "-", "submodules", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "deploy", "\\u", "file_", "(_", "self_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "datetime_", "._", "now_", "(_", ")_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "d", "-%", "H", "%", "M", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "'_", ":_", "tag_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sync", "-", "time", "'_", ":_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "self_", "._", "conf_", "._", "config_", "[_", "'", "user", ".", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "self_", "._", "\\u", "deploy", "\\u", "file_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "tag", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\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 ", " _", "raise_", "Sync", "Drive", "r", "Error_", "(_", "'", "Fail", "ed", " ", "to", " ", "write", " ", "deploy", " ", "file", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\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", "update", "\\u", "server", "\\u", "info_", "(_", "self_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Us", "e", " ", "Git", "Pyth", "on", " ", "for", " ", "this", " ", "function", " ", "if", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Check", " ", "return", " ", "values", " ", "from", " ", "these", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "git", "'_", ",_", "'", "update", "-", "server", "-", "info", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "\\u", "deploy", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", " ", "update", " ", "server", " ", "info", " ", "for", " ", "all", " ", "submodules", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "conf_", "._", "config_", "[_", "'", "deploy", ".", "check", "out", "-", "submodules", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "same", " ", "tag", " ", "used", " ", "in", " ", "the", " ", "parent", " ", "need", "s", " ", "to", " ", "exist", " ", "in", " ", "the", " ", "submodule_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "git", "'_", ",_", "'", "submodule", "'_", ",_", "'", "foreach", "'_", ",_", "'--", "recurs", "ive", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "git", "'_", ",_", "'", "tag", "'_", ",_", "tag_", "._", "name_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "conf_", "._", "repo_", "._", "working", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "git", "'_", ",_", "'", "submodule", "'_", ",_", "'", "foreach", "'_", ",_", "'--", "recurs", "ive", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trigger", "-", "submodule", "-", "update", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "conf_", "._", "repo_", "._", "working", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\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", "fetch_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Check", " ", "return", " ", "values", " ", "from", " ", "these", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "name_", "=_", "self_", "._", "conf_", "._", "config_", "[_", "'", "deploy", ".", "repo", "-", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "sudo", "'_", ",_", "'", "salt", "-", "call", "'_", ",_", "'-", "l", "'_", ",_", "'", "quie", "t", "'_", ",_", "'", "publi", "sh", ".", "runn", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", ".", "fetch", "'_", ",_", "repo", "\\u", "name_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "checkout_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Check", " ", "return", " ", "values", " ", "from", " ", "these", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "name_", "=_", "self_", "._", "conf_", "._", "config_", "[_", "'", "deploy", ".", "repo", "-", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "sudo", "'_", ",_", "'", "salt", "-", "call", "'_", ",_", "'-", "l", "'_", ",_", "'", "quie", "t", "'_", ",_", "'", "publi", "sh", ".", "runn", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", ".", "check", "out", "'_", ",_", "repo", "\\u", "name_", "+_", "','_", "+_", "str_", "(_", "args_", "._", "force_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ask_", "(_", "self_", ",_", "stage_", ",_", "args_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report", "\\u", "driver_", "._", "report", "\\u", "sync_", "(_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "type_", "=_", "stage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "answer_", "=_", "raw", "\\u", "input_", "(_", "\"", "Continu", "e", "?", " ", "([", "d", "]", "eta", "ile", "d", "/", "[", "C", "]", "onc", "ise", " ", "report", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "y", "]", "es", ",", "[", "n", "]", "o", ",", "[", "r", "]", "etry", "):", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "answer_", "or_", "answer_", "==_", "\"", "c", "\"_", "or_", "answer_", "==_", "\"", "C", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report", "\\u", "driver_", "._", "report", "\\u", "sync_", "(_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "type_", "=_", "stage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "answer_", "==_", "\"", "d", "\"_", "or_", "answer_", "==_", "\"", "D", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report", "\\u", "driver_", "._", "report", "\\u", "sync_", "(_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "type_", "=_", "stage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "detailed", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "answer_", "==_", "\"", "Y", "\"_", "or_", "answer_", "==_", "\"", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "answer_", "==_", "\"", "N", "\"_", "or_", "answer_", "==_", "\"", "n", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "answer_", "==_", "\"", "R", "\"_", "or_", "answer_", "==_", "\"", "r", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "stage_", "==_", "\"", "fetch", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "fetch_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stage_", "==_", "\"", "check", "out", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "checkout_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\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_", "sync_", "(_", "self_", ",_", "tag_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Break", " ", "sync", " ", "up", " ", "int", "o", " ", "two", " ", "stage", "s", " ", "and", " ", "move", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logic", " ", "out", " ", "of", " ", "the", " ", "driver_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "deploy", "\\u", "file_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "server", "\\u", "info_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fetch_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Add", " ", "repo", " ", "dependen", "cies", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "ask_", "(_", "'", "fetch", "'_", ",_", "args_", ",_", "tag_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "'", "Not", " ", "continui", "ng", " ", "to", " ", "check", "out", " ", "phase", ".", " ", "A", " ", "deploy", "ment", " ", "is", " ", "still", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "under", "way", ",", " ", "plea", "se", " ", "finish", ",", " ", "sync", ",", " ", "or", " ", "abort", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sync", "Drive", "r", "Error_", "(_", "msg_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "checkout_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "ask_", "(_", "'", "check", "out", "'_", ",_", "args_", ",_", "tag_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "'", "Not", " ", "continui", "ng", " ", "to", " ", "finish", " ", "phase", ".", " ", "A", " ", "check", "out", " ", "has", " ", "alr", "ead", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "occur", "red", ".", " ", "Ple", "ase", " ", "finish", ",", " ", "sync", " ", "or", " ", "revert", ".", " ", "Abo", "rti", "ng", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "at", " ", "this", " ", "phase", " ", "is", " ", "not", " ", "recommende", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sync", "Drive", "r", "Error_", "(_", "msg_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Driver_", "(_", "drivers_", "._", "Sync", "Driver_", ")_", ":_", "\\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", "deploy", "\\u", "info_", "(_", "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 ", " _", "f_", "=_", "open_", "(_", "self_", "._", "\\u", "deploy", "\\u", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "\\u", "info_", "=_", "json_", "._", "loads_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "deploy", "\\u", "info_", "\\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 ", " _", "raise_", "Sync", "Drive", "r", "Error_", "(_", "'", "Fail", "ed", " ", "to", " ", "load", " ", "deploy", " ", "file", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\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_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conf_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deploy", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "conf_", "._", "repo_", "._", "git", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "deploy", "\\u", "dir_", ",_", "'", "lock", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "deploy", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "deploy", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "\\u", "deploy", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "self_", "._", "\\u", "deploy", "\\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 ", " _", "raise_", "Lock", "Drive", "r", "Error_", "(_", "'", "Fail", "ed", " ", "to", " ", "create", " ", "deploy", " ", "director", "y", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "lock_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "datetime_", "._", "now_", "(_", ")_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "d", "-%", "H", "%", "M", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "self_", "._", "conf_", "._", "config_", "[_", "'", "user", ".", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "self_", "._", "\\u", "lock", "\\u", "file_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "lock", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Lock", "Drive", "r", "Error_", "(_", "'", "Fail", "ed", " ", "to", " ", "write", " ", "lock", " ", "file", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "lock_", "(_", "self_", ",_", "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 ", " _", "os_", "._", "remove_", "(_", "self_", "._", "\\u", "lock", "\\u", "file_", ")_", "\\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 ", " _", "raise_", "Lock", "Drive", "r", "Error_", "(_", "'", "Fail", "ed", " ", "to", " ", "remove", " ", "lock", " ", "file", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lock", "Driver_", "(_", "drivers_", "._", "Lock", "Driver_", ")_", ":_", "\\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", "lock_", "(_", "self_", ",_", "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 ", " _", "f_", "=_", "open_", "(_", "self_", "._", "\\u", "lock", "\\u", "file_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "\\u", "info_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lock", "\\u", "info_", "=_", "json_", "._", "loads_", "(_", "lock", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lock", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\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_", "except_", "(_", "Key", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "user", "'_", ":_", "None_", ",_", "'", "time", "'_", ":_", "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_", "Service", "Driver_", "(_", "drivers_", "._", "Service", "Driver_", ")_", ":_", "\\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_", "Service", "Driver_", "(_", "drivers_", "._", "Service", "Driver_", ")_", ":_", "\\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_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conf_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Driver_", "(_", "drivers_", "._", "Service", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restart_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "\\u", "name_", "=_", "self_", "._", "conf_", "._", "config_", "[_", "'", "deploy", ".", "repo", "-", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "sudo", "'_", ",_", "'", "salt", "-", "call", "'_", ",_", "'-", "l", "'_", ",_", "'", "quie", "t", "'_", ",_", "'--", "out", "=", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sh", ".", "runn", "er", "'_", ",_", "'", "deploy", ".", "restart", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "name_", "+_", "','_", "+_", "str_", "(_", "args_", "._", "batch_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "p_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Disa", "ble", "d", " ", "unti", "l", " ", "salt", " ", "bug", " ", "is", " ", "fixed", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "914", "6_", "\\u\\u\\uNL\\u\\u\\u_", "#", "LOG", ".", "info", "('", "Service", " ", "restart", " ", "sent", " ", "to", " ", "salt", ".", " ", "Check", " ", "the", " ", "status", " ", "usi", "ng", ":'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", " ", "deploy", "-", "info", " ", "--", "repo", "={", "0", "}", " ", "--", "restart", "'.", "format", "(", "repo", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Display", " ", "the", " ", "data", " ", "direct", "ly", " ", "from", " ", "the", " ", "runn", "er", " ", "return", " ", "unti", "l", " ", "bug", " ", "is", " ", "fixed", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minion", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Cou", "ld", " ", "not", " ", "parse", " ", "salt", " ", "return", ";", " ", "raw", " ", "output", ":\\\\", "n", "\\\\", "n", "{", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Service", "Drive", "r", "Error_", "(_", "msg_", "._", "format_", "(_", "out_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "minion", "\\u", "data_", "=_", "minion", "\\u", "data_", "[_", "'", "local", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "minion", "\\u", "data_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Error", " ", "receive", "d", " ", "from", " ", "salt", ";", " ", "raw", " ", "output", ":\\\\", "n", "\\\\", "n", "{", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Service", "Drive", "r", "Error_", "(_", "msg_", "._", "format_", "(_", "minion", "\\u", "data_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "minion", "\\u", "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 ", " _", "for_", "minion", "_", ",_", "data_", "in_", "i_", "._", "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 ", " ", " _", "LOG_", "._", "info_", "(_", "'{", "0", "}:", " ", "{", "1", "}'_", "._", "format_", "(_", "minion", "_", ",_", "data_", "[_", "'", "status", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "LOG_", "._", "info_", "(_", "'{", "0", "}:", " ", "No", " ", "status", " ", "avail", "able", "'_", "._", "format_", "(_", "minion", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "'", "Got", " ", "bad", " ", "return", " ", "from", " ", "salt", ".", " ", "Her", "e", " ", "is", " ", "the", " ", "raw", " ", "data", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "error_", "(_", "'{}'_", "._", "format_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\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_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conf_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "redis", "\\u", "serv_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "Load", " ", "this", " ", "info", " ", "from", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redis_", "._", "Redis_", "(_", "host_", "=_", "'", "local", "host", "'_", ",_", "port_", "=_", "6379", "_", ",_", "db_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mins", "\\u", "ago_", "(_", "self_", ",_", "now_", ",_", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "timestamp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "float_", "(_", "timestamp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "now_", "-_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mins_", "=_", "delta_", "._", "seconds_", "/_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mins_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "minion", "\\u", "data_", "(_", "self_", ",_", "serv_", ",_", "repo_", ",_", "minion", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "(", "ry", "an", "-", "lan", "e", "):", " ", "use", " ", "hge", "tall", ",", " ", "this", " ", "is", " ", "abs", "ur", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minion", "\\u", "key_", "=_", "'", "deploy", ":", "{", "0", "}:", "minion", "s", ":", "{", "1", "}'_", "._", "format_", "(_", "repo_", ",_", "minion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "status", "'_", "]_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "fetch", "\\u", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "\\u", "checkin", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fetch", "\\u", "checkin", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "checkin", "\\u", "mins", "'_", "]_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "\\u", "checkin", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "fetch", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "mins", "'_", "]_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "fetch", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "status", "'_", "]_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "check", "out", "\\u", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "out", "\\u", "checkin", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "out", "\\u", "checkin", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "c\\u", "checkin", "\\u", "t_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "check", "out", "\\u", "checkin", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "checkin", "\\u", "mins", "'_", "]_", "=_", "\\u", "c\\u", "checkin", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "out", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "check", "out", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "mins", "'_", "]_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "check", "out", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "tag", "'_", "]_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "tag", "'_", "]_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "fetch", "\\u", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restart", "\\u", "checkin", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "restart", "\\u", "checkin", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "r", "\\u", "c\\u", "t_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "restart", "\\u", "checkin", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "restart", "\\u", "checkin", "\\u", "mins", "'_", "]_", "=_", "\\u", "r", "\\u", "c\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "restart", "\\u", "status", "'_", "]_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "restart", "\\u", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restart", "\\u", "timestamp_", "=_", "serv_", "._", "hge", "t_", "(_", "minion", "\\u", "key_", ",_", "'", "restart", "\\u", "timestamp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "restart", "\\u", "mins", "'_", "]_", "=_", "self_", "._", "\\u", "mins", "\\u", "ago_", "(_", "now_", ",_", "restart", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "report", "\\u", "sync_", "(_", "self_", ",_", "tag_", ",_", "report", "\\u", "type_", "=_", "'", "full", "'_", ",_", "detailed", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv_", "=_", "self_", "._", "\\u", "get", "\\u", "redis", "\\u", "serv_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "name_", "=_", "self_", "._", "conf_", "._", "config_", "[_", "'", "deploy", ".", "repo", "-", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "'", "Rep", "o", ":", " ", "{}'_", "._", "format_", "(_", "repo", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "'", "Ta", "g", ":", " ", "{}'_", "._", "format_", "(_", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minions_", "=_", "serv_", "._", "sme", "mber", "s_", "(_", "'", "deploy", ":", "{", "0", "}:", "minion", "s", "'_", "._", "format_", "(_", "repo", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fetch", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "fetch", "\\u", "info_", "(_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minions_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "out", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "check", "out", "\\u", "info_", "(_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minions_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "len_", "=_", "len_", "(_", "minions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "\\u", "len_", "=_", "len_", "(_", "\\u", "fetch", "\\u", "info_", "[_", "'", "complete", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "out", "\\u", "len_", "=_", "len_", "(_", "\\u", "check", "out", "\\u", "info_", "[_", "'", "complete", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "\\u", "report_", "=_", "\"{", "0", "}/", "{", "1", "}", " ", "minion", "s", " ", "complete", "d", " ", "fetch", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "\\u", "report_", "=_", "fetch", "\\u", "report_", "._", "format_", "(_", "fetch", "\\u", "len_", ",_", "min", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "out", "\\u", "report_", "=_", "\"{", "0", "}/", "{", "1", "}", " ", "minion", "s", " ", "complete", "d", " ", "check", "out", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "out", "\\u", "report_", "=_", "check", "out", "\\u", "report_", "._", "format_", "(_", "check", "out", "\\u", "len_", ",_", "min", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "report", "\\u", "type_", "==_", "'", "fetch", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "fetch", "\\u", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "report", "\\u", "type_", "==_", "'", "check", "out", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "check", "out", "\\u", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msgs_", "=_", "'{", "0", "};", " ", "{", "1", "}'_", "._", "format_", "(_", "fetch", "\\u", "report_", ",_", "check", "out", "\\u", "report_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "detailed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\"", "Det", "ail", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "(_", "\"{", "0", "}", " ", "status", ":", " ", "{", "1", "}", " ", "[", "start", "ed", ":", " ", "{", "2", "}", " ", "mins", " ", "ago", ",\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "last", "-", "return", ":", " ", "{", "3", "}", " ", "mins", " ", "ago", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "minion", "_", "in_", "minions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\\u", "fetch", "\\u", "info_", "[_", "'", "pend", "ing", "'_", "]_", "[_", "minion", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "report", "\\u", "type_", "==_", "'", "fetch", "'_", ":_", "\\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_", "data_", "=_", "\\u", "fetch", "\\u", "info_", "[_", "'", "complete", "'_", "]_", "[_", "minion", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fetch", "\\u", "msg_", "=_", "msg_", "._", "format_", "(_", "'", "fetch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "status", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "checkin", "\\u", "mins", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "fetch", "\\u", "mins", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "\\u", "check", "out", "\\u", "info_", "[_", "'", "pend", "ing", "'_", "]_", "[_", "minion", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "report", "\\u", "type_", "==_", "'", "check", "out", "'_", ":_", "\\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_", "data_", "=_", "\\u", "check", "out", "\\u", "info_", "[_", "'", "complete", "'_", "]_", "[_", "minion", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "out", "\\u", "msg_", "=_", "msg_", "._", "format_", "(_", "'", "check", "out", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "status", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "checkin", "\\u", "mins", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "check", "out", "\\u", "mins", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "report", "\\u", "type_", "==_", "'", "fetch", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msgs_", "=_", "'\\\\", "n", "\\\\", "t", "{}'_", "._", "format_", "(_", "fetch", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "report", "\\u", "type_", "==_", "'", "check", "out", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msgs_", "=_", "'\\\\", "n", "\\\\", "t", "{}'_", "._", "format_", "(_", "check", "out", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msgs_", "=_", "'\\\\", "n", "\\\\", "t", "{", "0", "}\\\\", "n", "\\\\", "t", "{", "1", "}'_", "._", "format_", "(_", "fetch", "\\u", "msg_", ",_", "check", "out", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msgs_", "=_", "\"{", "0", "}:", " ", "{", "1", "}\"_", "._", "format_", "(_", "minion", "_", ",_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "fetch", "\\u", "info_", "(_", "self_", ",_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minions_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "{_", "'", "complete", "'_", ":_", "{_", "}_", ",_", "'", "pend", "ing", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "minion", "_", "in_", "minions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "get", "\\u", "minion", "\\u", "data_", "(_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "'", "fetch", "\\u", "tag", "'_", "]_", "==_", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "complete", "'_", "]_", "[_", "minion", "_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "pend", "ing", "'_", "]_", "[_", "minion", "_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "Driver_", "(_", "drivers_", "._", "Report", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "check", "out", "\\u", "info_", "(_", "self_", ",_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minions_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "{_", "'", "complete", "'_", ":_", "{_", "}_", ",_", "'", "pend", "ing", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "minion", "_", "in_", "minions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "get", "\\u", "minion", "\\u", "data_", "(_", "serv_", ",_", "repo", "\\u", "name_", ",_", "minion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "'", "tag", "'_", "]_", "==_", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "complete", "'_", "]_", "[_", "minion", "_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "pend", "ing", "'_", "]_", "[_", "minion", "_", "]_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nasa/CrisisMappingToolkit/bin/measure_interface.py
[ { "content": " def apply_update(self, lakes_number, lakes_total, lake_name, lake_date, lake_image, lake_image_total):\n if self.lake_totals == None:\n self.lake_totals = [10] * lakes_total\n self.lake_counts = [0] * lakes_total\n self.lake_totals[lakes_number] = lake_image_total\n self.lake_counts[lakes_number] = lake_image\n total = sum(self.lake_totals)\n progress = sum(self.lake_counts)\n self.status.setText('Completed processing %s on %s.' % (lake_name, lake_date))\n self.progressBar.setValue(float(progress) / total * 100)", "metadata": "root.ProgressPopup.apply_update", "header": "['class', 'ProgressPopup', '(', 'QtGui', '.', 'QWidget', ')', ':', '___EOS___']", "index": 61 } ]
[ { "span": "self.lake_totals == None:", "start_line": 62, "start_column": 11, "end_line": 62, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Progres", "s", "Popup_", "(_", "Qt", "Gui_", "._", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "update_", "(_", "self_", ",_", "lake", "s", "\\u", "number_", ",_", "lake", "s", "\\u", "total_", ",_", "lake", "\\u", "name_", ",_", "lake", "\\u", "date_", ",_", "lake", "\\u", "image_", ",_", "lake", "\\u", "image", "\\u", "total_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "lake", "\\u", "totals_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lake", "\\u", "totals_", "=_", "[_", "10_", "]_", "*_", "lake", "s", "\\u", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lake", "\\u", "counts_", "=_", "[_", "0_", "]_", "*_", "lake", "s", "\\u", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "lake", "\\u", "totals_", "[_", "lake", "s", "\\u", "number_", "]_", "=_", "lake", "\\u", "image", "\\u", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lake", "\\u", "counts_", "[_", "lake", "s", "\\u", "number_", "]_", "=_", "lake", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "sum_", "(_", "self_", "._", "lake", "\\u", "totals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "=_", "sum_", "(_", "self_", "._", "lake", "\\u", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "._", "set", "Text_", "(_", "'", "Complete", "d", " ", "process", "ing", " ", "%", "s", " ", "on", " ", "%", "s", ".'_", "%_", "(_", "lake", "\\u", "name_", ",_", "lake", "\\u", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress", "Bar_", "._", "set", "Value_", "(_", "float_", "(_", "progress_", ")_", "/_", "total_", "*_", "100_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
apache/libcloud/libcloud/test/compute/test_gce.py
[ { "content": " def test_ex_list(self):\n d = self.driver\n # Test the default case for all list methods\n # (except list_volume_snapshots, which requires an arg)\n for list_fn in (d.ex_list_addresses,\n d.ex_list_backendservices,\n d.ex_list_disktypes,\n d.ex_list_firewalls,\n d.ex_list_forwarding_rules,\n d.ex_list_healthchecks,\n d.ex_list_networks,\n d.ex_list_project_images,\n d.ex_list_regions,\n d.ex_list_routes,\n d.ex_list_snapshots,\n d.ex_list_targethttpproxies,\n d.ex_list_targetinstances,\n d.ex_list_targetpools,\n d.ex_list_urlmaps,\n d.ex_list_zones,\n d.list_images,\n d.list_locations,\n d.list_nodes,\n d.list_sizes,\n d.list_volumes):\n full_list = [item.name for item in list_fn()]\n li = d.ex_list(list_fn)\n iter_list = [item.name for sublist in li for item in sublist]\n self.assertEqual(full_list, iter_list)\n\n # Test paging & filtering with a single list function as they require\n # additional test fixtures\n list_fn = d.ex_list_regions\n for count, sublist in zip((2, 1), d.ex_list(list_fn).page(2)):\n self.assertTrue(len(sublist) == count)\n for sublist in d.ex_list(list_fn).filter('name eq us-central1'):\n self.assertTrue(len(sublist) == 1)\n self.assertEqual(sublist[0].name, 'us-central1')", "metadata": "root.GCENodeDriverTest.test_ex_list", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 119 }, { "content": " def test_ex_list_addresses(self):\n address_list = self.driver.ex_list_addresses()\n address_list_all = self.driver.ex_list_addresses('all')\n address_list_uc1 = self.driver.ex_list_addresses('us-central1')\n address_list_global = self.driver.ex_list_addresses('global')\n self.assertEqual(len(address_list), 2)\n self.assertEqual(len(address_list_all), 5)\n self.assertEqual(len(address_list_global), 1)\n self.assertEqual(address_list[0].name, 'libcloud-demo-address')\n self.assertEqual(address_list_uc1[0].name, 'libcloud-demo-address')\n self.assertEqual(address_list_global[0].name, 'lcaddressglobal')\n names = [a.name for a in address_list_all]\n self.assertTrue('libcloud-demo-address' in names)", "metadata": "root.GCENodeDriverTest.test_ex_list_addresses", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 158 }, { "content": " def test_ex_list_forwarding_rules(self):\n forwarding_rules = self.driver.ex_list_forwarding_rules()\n forwarding_rules_all = self.driver.ex_list_forwarding_rules('all')\n forwarding_rules_uc1 = self.driver.ex_list_forwarding_rules(\n 'us-central1')\n self.assertEqual(len(forwarding_rules), 2)\n self.assertEqual(len(forwarding_rules_all), 2)\n self.assertEqual(forwarding_rules[0].name, 'lcforwardingrule')\n self.assertEqual(forwarding_rules_uc1[0].name, 'lcforwardingrule')\n names = [f.name for f in forwarding_rules_all]\n self.assertTrue('lcforwardingrule' in names)", "metadata": "root.GCENodeDriverTest.test_ex_list_forwarding_rules", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 194 }, { "content": " def test_ex_list_routes(self):\n routes = self.driver.ex_list_routes()\n self.assertEqual(len(routes), 3)\n self.assertTrue('lcdemoroute' in [route.name for route in routes])", "metadata": "root.GCENodeDriverTest.test_ex_list_routes", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 230 }, { "content": " def test_list_nodes(self):\n nodes = self.driver.list_nodes()\n nodes_all = self.driver.list_nodes(ex_zone='all')\n nodes_uc1a = self.driver.list_nodes(ex_zone='us-central1-a')\n self.assertEqual(len(nodes), 1)\n self.assertEqual(len(nodes_all), 8)\n self.assertEqual(len(nodes_uc1a), 1)\n self.assertEqual(nodes[0].name, 'node-name')\n self.assertEqual(nodes_uc1a[0].name, 'node-name')\n names = [n.name for n in nodes_all]\n self.assertTrue('node-name' in names)", "metadata": "root.GCENodeDriverTest.test_list_nodes", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 240 }, { "content": " def test_ex_list_targetinstances(self):\n target_instances = self.driver.ex_list_targetinstances()\n target_instances_all = self.driver.ex_list_targetinstances('all')\n target_instances_uc1 = self.driver.ex_list_targetinstances('us-central1-a')\n self.assertEqual(len(target_instances), 2)\n self.assertEqual(len(target_instances_all), 2)\n self.assertEqual(len(target_instances_uc1), 2)\n self.assertEqual(target_instances[0].name, 'hello')\n self.assertEqual(target_instances_uc1[0].name, 'hello')\n names = [t.name for t in target_instances_all]\n self.assertTrue('lctargetinstance' in names)", "metadata": "root.GCENodeDriverTest.test_ex_list_targetinstances", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test_ex_list_targetpools(self):\n target_pools = self.driver.ex_list_targetpools()\n target_pools_all = self.driver.ex_list_targetpools('all')\n target_pools_uc1 = self.driver.ex_list_targetpools('us-central1')\n self.assertEqual(len(target_pools), 4)\n self.assertEqual(len(target_pools_all), 5)\n self.assertEqual(len(target_pools_uc1), 4)\n self.assertEqual(target_pools[0].name, 'lctargetpool')\n self.assertEqual(target_pools_uc1[0].name, 'lctargetpool')\n names = [t.name for t in target_pools_all]\n self.assertTrue('www-pool' in names)", "metadata": "root.GCENodeDriverTest.test_ex_list_targetpools", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 281 }, { "content": " def test_list_disktypes(self):\n disktypes = self.driver.ex_list_disktypes()\n disktypes_all = self.driver.ex_list_disktypes('all')\n disktypes_uc1a = self.driver.ex_list_disktypes('us-central1-a')\n self.assertEqual(len(disktypes), 2)\n self.assertEqual(len(disktypes_all), 9)\n self.assertEqual(len(disktypes_uc1a), 2)\n self.assertEqual(disktypes[0].name, 'pd-ssd')\n self.assertEqual(disktypes_uc1a[0].name, 'pd-ssd')\n names = [v.name for v in disktypes_all]\n self.assertTrue('pd-standard' in names)\n self.assertTrue('local-ssd' in names)", "metadata": "root.GCENodeDriverTest.test_list_disktypes", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 308 }, { "content": " def test_list_volumes(self):\n volumes = self.driver.list_volumes()\n volumes_all = self.driver.list_volumes('all')\n volumes_uc1a = self.driver.list_volumes('us-central1-a')\n self.assertEqual(len(volumes), 2)\n self.assertEqual(len(volumes_all), 10)\n self.assertEqual(len(volumes_uc1a), 2)\n self.assertEqual(volumes[0].name, 'lcdisk')\n self.assertEqual(volumes_uc1a[0].name, 'lcdisk')\n names = [v.name for v in volumes_all]\n self.assertTrue('libcloud-demo-europe-boot-disk' in names)", "metadata": "root.GCENodeDriverTest.test_list_volumes", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 329 }, { "content": " def test_ex_create_route(self):\n route_name = 'lcdemoroute'\n dest_range = '192.168.25.0/24'\n priority = 1000\n route = self.driver.ex_create_route(route_name, dest_range)\n self.assertTrue(isinstance(route, GCERoute))\n self.assertEqual(route.name, route_name)\n self.assertEqual(route.priority, priority)\n self.assertTrue(\"tag1\" in route.tags)\n self.assertTrue(route.extra['nextHopInstance'].endswith('libcloud-100'))\n self.assertEqual(route.dest_range, dest_range)", "metadata": "root.GCENodeDriverTest.test_ex_create_route", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 461 }, { "content": " def test_create_node_req_with_serviceaccounts(self):\n image = self.driver.ex_get_image('debian-7')\n size = self.driver.ex_get_size('n1-standard-1')\n location = self.driver.zone\n network = self.driver.ex_get_network('default')\n # ex_service_accounts with specific scopes, default 'email'\n ex_sa = [{'scopes': ['compute-ro', 'pubsub', 'storage-ro']}]\n node_request, node_data = self.driver._create_node_req('lcnode', size,\n image, location,\n network,\n ex_service_accounts=ex_sa)\n self.assertIsInstance(node_data['serviceAccounts'], list)\n self.assertIsInstance(node_data['serviceAccounts'][0], dict)\n self.assertEqual(node_data['serviceAccounts'][0]['email'], 'default')\n self.assertIsInstance(node_data['serviceAccounts'][0]['scopes'], list)\n self.assertEqual(len(node_data['serviceAccounts'][0]['scopes']), 3)\n self.assertTrue('https://www.googleapis.com/auth/devstorage.read_only'\n in node_data['serviceAccounts'][0]['scopes'])\n self.assertTrue('https://www.googleapis.com/auth/compute.readonly'\n in node_data['serviceAccounts'][0]['scopes'])", "metadata": "root.GCENodeDriverTest.test_create_node_req_with_serviceaccounts", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 646 }, { "content": " def test_format_metadata(self):\n in_md = [{'key': 'k0', 'value': 'v0'}, {'key': 'k1', 'value': 'v1'}]\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = [{'k0': 'v0'}, {'k1': 'v1'}]\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = {'key': 'k0', 'value': 'v0'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 1, out_md)\n self.assertEqual(out_md['items'][0]['key'], 'k0')\n self.assertEqual(out_md['items'][0]['value'], 'v0')\n\n in_md = {'k0': 'v0'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 1)\n self.assertEqual(out_md['items'][0]['key'], 'k0')\n self.assertEqual(out_md['items'][0]['value'], 'v0')\n\n in_md = {'k0': 'v0', 'k1': 'v1', 'k2': 'v2'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 3)\n keys = [x['key'] for x in out_md['items']]\n vals = [x['value'] for x in out_md['items']]\n keys.sort()\n vals.sort()\n self.assertEqual(keys, ['k0', 'k1', 'k2'])\n self.assertEqual(vals, ['v0', 'v1', 'v2'])\n\n in_md = {'items': [{'key': 'k0', 'value': 'v0'},\n {'key': 'k1', 'value': 'v1'}]}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = {'items': 'foo'}\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)\n in_md = {'items': {'key': 'k1', 'value': 'v0'}}\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)\n in_md = ['k0', 'v1']\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)", "metadata": "root.GCENodeDriverTest.test_format_metadata", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 667 }, { "content": " def test_create_node_with_metadata(self):\n node_name = 'node-name'\n image = self.driver.ex_get_image('debian-7')\n size = self.driver.ex_get_size('n1-standard-1')\n zone = self.driver.ex_get_zone('us-central1-a')\n\n # md is a list of dicts, each with 'key' and 'value' for\n # backwards compatibility\n md = [{'key': 'k0', 'value': 'v0'}, {'key': 'k1', 'value': 'v1'}]\n request, data = self.driver._create_node_req(node_name, size, image,\n zone, metadata=md)\n self.assertTrue('items' in data['metadata'])\n self.assertEqual(len(data['metadata']['items']), 2)\n\n # md doesn't contain \"items\" key\n md = {'key': 'key1', 'value': 'value1'}\n request, data = self.driver._create_node_req(node_name, size, image,\n zone, metadata=md)\n self.assertTrue('items' in data['metadata'])\n self.assertEqual(len(data['metadata']['items']), 1)\n\n # md contains \"items\" key\n md = {'items': [{'key': 'k0', 'value': 'v0'}]}\n request, data = self.driver._create_node_req(node_name, size, image,\n zone, metadata=md)\n self.assertTrue('items' in data['metadata'])\n self.assertEqual(len(data['metadata']['items']), 1)\n self.assertEqual(data['metadata']['items'][0]['key'], 'k0')\n self.assertEqual(data['metadata']['items'][0]['value'], 'v0')", "metadata": "root.GCENodeDriverTest.test_create_node_with_metadata", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 734 }, { "content": " def test_ex_targetpool_gethealth(self):\n targetpool = self.driver.ex_get_targetpool('lb-pool')\n health = targetpool.get_health('libcloud-lb-demo-www-000')\n self.assertEqual(len(health), 1)\n self.assertTrue('node' in health[0])\n self.assertTrue('health' in health[0])\n self.assertEqual(health[0]['health'], 'UNHEALTHY')", "metadata": "root.GCENodeDriverTest.test_ex_targetpool_gethealth", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 903 }, { "content": " def test_ex_targetpool_with_backup_pool(self):\n targetpool = self.driver.ex_get_targetpool('lb-pool')\n self.assertTrue('backupPool' in targetpool.extra)\n self.assertTrue('failoverRatio' in targetpool.extra)", "metadata": "root.GCENodeDriverTest.test_ex_targetpool_with_backup_pool", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 911 }, { "content": " def test_ex_get_image_license(self):\n image = self.driver.ex_get_image('sles-12-v20141023')\n self.assertTrue('licenses' in image.extra)\n self.assertEqual(image.extra['licenses'][0].name, 'sles-12')\n self.assertTrue(image.extra['licenses'][0].charges_use_fee)", "metadata": "root.GCENodeDriverTest.test_ex_get_image_license", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1184 }, { "content": " def test_ex_get_project(self):\n project = self.driver.ex_get_project()\n self.assertEqual(project.name, 'project_name')\n networks_quota = project.quotas[1]\n self.assertEqual(networks_quota['usage'], 3)\n self.assertEqual(networks_quota['limit'], 5)\n self.assertEqual(networks_quota['metric'], 'NETWORKS')\n self.assertTrue('fingerprint' in project.extra['commonInstanceMetadata'])\n self.assertTrue('items' in project.extra['commonInstanceMetadata'])\n self.assertTrue('usageExportLocation' in project.extra)\n self.assertTrue('bucketName' in project.extra['usageExportLocation'])\n self.assertEqual(project.extra['usageExportLocation']['bucketName'], 'gs://graphite-usage-reports')", "metadata": "root.GCENodeDriverTest.test_ex_get_project", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 1273 } ]
[ { "span": "self.assertTrue(len(sublist) == count)", "start_line": 153, "start_column": 12, "end_line": 153, "end_column": 50 }, { "span": "self.assertTrue(len(sublist) == 1)", "start_line": 155, "start_column": 12, "end_line": 155, "end_column": 46 }, { "span": "self.assertTrue('libcloud-demo-address' in names)", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 57 }, { "span": "self.assertTrue('lcforwardingrule' in names)", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 52 }, { "span": "self.assertTrue('lcdemoroute' in [route.name for route in routes])", "start_line": 233, "start_column": 8, "end_line": 233, "end_column": 74 }, { "span": "self.assertTrue('node-name' in names)", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 45 }, { "span": "self.assertTrue('lctargetinstance' in names)", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 52 }, { "span": "self.assertTrue('www-pool' in names)", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 44 }, { "span": "self.assertTrue('pd-standard' in names)", "start_line": 318, "start_column": 8, "end_line": 318, "end_column": 47 }, { "span": "self.assertTrue('local-ssd' in names)", "start_line": 319, "start_column": 8, "end_line": 319, "end_column": 45 }, { "span": "self.assertTrue('libcloud-demo-europe-boot-disk' in names)", "start_line": 339, "start_column": 8, "end_line": 339, "end_column": 66 }, { "span": "self.assertTrue(\"tag1\" in route.tags)", "start_line": 469, "start_column": 8, "end_line": 469, "end_column": 45 }, { "span": "self.assertTrue('https://www.googleapis.com/auth/devstorage.read_only'\n in node_data['serviceAccounts'][0]['scopes'])", "start_line": 662, "start_column": 8, "end_line": 663, "end_column": 69 }, { "span": "self.assertTrue('https://www.googleapis.com/auth/compute.readonly'\n in node_data['serviceAccounts'][0]['scopes'])", "start_line": 664, "start_column": 8, "end_line": 665, "end_column": 69 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 670, "start_column": 8, "end_line": 670, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 672, "start_column": 8, "end_line": 672, "end_column": 42 }, { "span": "self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])", "start_line": 674, "start_column": 8, "end_line": 674, "end_column": 66 }, { "span": "self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])", "start_line": 675, "start_column": 8, "end_line": 675, "end_column": 68 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 679, "start_column": 8, "end_line": 679, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 681, "start_column": 8, "end_line": 681, "end_column": 42 }, { "span": "self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])", "start_line": 683, "start_column": 8, "end_line": 683, "end_column": 66 }, { "span": "self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])", "start_line": 684, "start_column": 8, "end_line": 684, "end_column": 68 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 688, "start_column": 8, "end_line": 688, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 690, "start_column": 8, "end_line": 690, "end_column": 42 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 697, "start_column": 8, "end_line": 697, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 699, "start_column": 8, "end_line": 699, "end_column": 42 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 706, "start_column": 8, "end_line": 706, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 708, "start_column": 8, "end_line": 708, "end_column": 42 }, { "span": "self.assertTrue('fingerprint' in out_md)", "start_line": 720, "start_column": 8, "end_line": 720, "end_column": 48 }, { "span": "self.assertTrue('items' in out_md)", "start_line": 722, "start_column": 8, "end_line": 722, "end_column": 42 }, { "span": "self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])", "start_line": 724, "start_column": 8, "end_line": 724, "end_column": 66 }, { "span": "self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])", "start_line": 725, "start_column": 8, "end_line": 725, "end_column": 68 }, { "span": "self.assertTrue('items' in data['metadata'])", "start_line": 745, "start_column": 8, "end_line": 745, "end_column": 52 }, { "span": "self.assertTrue('items' in data['metadata'])", "start_line": 752, "start_column": 8, "end_line": 752, "end_column": 52 }, { "span": "self.assertTrue('items' in data['metadata'])", "start_line": 759, "start_column": 8, "end_line": 759, "end_column": 52 }, { "span": "self.assertTrue('node' in health[0])", "start_line": 907, "start_column": 8, "end_line": 907, "end_column": 44 }, { "span": "self.assertTrue('health' in health[0])", "start_line": 908, "start_column": 8, "end_line": 908, "end_column": 46 }, { "span": "self.assertTrue('backupPool' in targetpool.extra)", "start_line": 913, "start_column": 8, "end_line": 913, "end_column": 57 }, { "span": "self.assertTrue('failoverRatio' in targetpool.extra)", "start_line": 914, "start_column": 8, "end_line": 914, "end_column": 60 }, { "span": "self.assertTrue('licenses' in image.extra)", "start_line": 1186, "start_column": 8, "end_line": 1186, "end_column": 50 }, { "span": "self.assertTrue('fingerprint' in project.extra['commonInstanceMetadata'])", "start_line": 1280, "start_column": 8, "end_line": 1280, "end_column": 81 }, { "span": "self.assertTrue('items' in project.extra['commonInstanceMetadata'])", "start_line": 1281, "start_column": 8, "end_line": 1281, "end_column": 75 }, { "span": "self.assertTrue('usageExportLocation' in project.extra)", "start_line": 1282, "start_column": 8, "end_line": 1282, "end_column": 63 }, { "span": "self.assertTrue('bucketName' in project.extra['usageExportLocation'])", "start_line": 1283, "start_column": 8, "end_line": 1283, "end_column": 77 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "default", " ", "case", " ", "for", " ", "all", " ", "list", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "except", " ", "list", "\\u", "volume", "\\u", "snapshot", "s", ",", " ", "whi", "ch", " ", "require", "s", " ", "an", " ", "arg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "list", "\\u", "fn_", "in_", "(_", "d_", "._", "ex", "\\u", "list", "\\u", "addresses_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "back", "ends", "ervice", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "disk", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "firew", "alls", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "forward", "ing", "\\u", "rules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "healthcheck", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "project", "\\u", "images_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "regions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "routes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "snapshots_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "target", "http", "proxies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "targeti", "nstance", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "target", "pools_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "url", "maps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "ex", "\\u", "list", "\\u", "zones_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "list", "\\u", "images_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "list", "\\u", "locations_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "list", "\\u", "nodes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "list", "\\u", "sizes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "list", "\\u", "volumes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "list_", "=_", "[_", "item_", "._", "name_", "for_", "item_", "in_", "list", "\\u", "fn_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "=_", "d_", "._", "ex", "\\u", "list_", "(_", "list", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "\\u", "list_", "=_", "[_", "item_", "._", "name_", "for_", "sublist_", "in_", "li_", "for_", "item_", "in_", "sublist_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "full", "\\u", "list_", ",_", "iter", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "paging", " ", "&", " ", "filtering", " ", "with", " ", "a", " ", "single", " ", "list", " ", "function", " ", "as", " ", "the", "y", " ", "require_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "test", " ", "fixtures_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "fn_", "=_", "d_", "._", "ex", "\\u", "list", "\\u", "regions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "count_", ",_", "sublist_", "in_", "zip_", "(_", "(_", "2_", ",_", "1_", ")_", ",_", "d_", "._", "ex", "\\u", "list_", "(_", "list", "\\u", "fn_", ")_", "._", "page_", "(_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "len_", "(_", "sublist_", ")_", "==_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sublist_", "in_", "d_", "._", "ex", "\\u", "list_", "(_", "list", "\\u", "fn_", ")_", "._", "filter_", "(_", "'", "name", " ", "eq", " ", "us", "-", "central", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "len_", "(_", "sublist_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sublist_", "[_", "0_", "]_", "._", "name_", ",_", "'", "us", "-", "central", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "addresses_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address", "\\u", "list_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "addresses_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "addresses_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list", "\\u", "uc", "1_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "addresses_", "(_", "'", "us", "-", "central", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "list", "\\u", "global_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "addresses_", "(_", "'", "global", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "address", "\\u", "list_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "address", "\\u", "list", "\\u", "all_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "address", "\\u", "list", "\\u", "global_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "address", "\\u", "list_", "[_", "0_", "]_", "._", "name_", ",_", "'", "libc", "loud", "-", "demo", "-", "address", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "address", "\\u", "list", "\\u", "uc", "1_", "[_", "0_", "]_", "._", "name_", ",_", "'", "libc", "loud", "-", "demo", "-", "address", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "address", "\\u", "list", "\\u", "global_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lca", "ddress", "global", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "a_", "._", "name_", "for_", "a_", "in_", "address", "\\u", "list", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "libc", "loud", "-", "demo", "-", "address", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "forward", "ing", "\\u", "rules_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forward", "ing", "\\u", "rules_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "forward", "ing", "\\u", "rules_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward", "ing", "\\u", "rule", "s", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "forward", "ing", "\\u", "rules_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward", "ing", "\\u", "rule", "s", "\\u", "uc", "1_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "forward", "ing", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "us", "-", "central", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "forward", "ing", "\\u", "rules_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "forward", "ing", "\\u", "rule", "s", "\\u", "all_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "forward", "ing", "\\u", "rules_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lc", "forward", "ingr", "ule", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "forward", "ing", "\\u", "rule", "s", "\\u", "uc", "1_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lc", "forward", "ingr", "ule", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "f_", "._", "name_", "for_", "f_", "in_", "forward", "ing", "\\u", "rule", "s", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "lc", "forward", "ingr", "ule", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "routes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "routes_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "routes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "routes_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "lcd", "emo", "route", "'_", "in_", "[_", "route_", "._", "name_", "for_", "route_", "in_", "routes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", "ex", "\\u", "zone_", "=_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes", "\\u", "uc", "1a_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", "ex", "\\u", "zone_", "=_", "'", "us", "-", "central", "1", "-", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes", "\\u", "all_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes", "\\u", "uc", "1a_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "name_", ",_", "'", "node", "-", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes", "\\u", "uc", "1a_", "[_", "0_", "]_", "._", "name_", ",_", "'", "node", "-", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "n_", "._", "name_", "for_", "n_", "in_", "nodes", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "node", "-", "name", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "targeti", "nstance", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "instances_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "targeti", "nstance", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "instance", "s", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "targeti", "nstance", "s_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "instance", "s", "\\u", "uc", "1_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "targeti", "nstance", "s_", "(_", "'", "us", "-", "central", "1", "-", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "instances_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "instance", "s", "\\u", "all_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "instance", "s", "\\u", "uc", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "target", "\\u", "instances_", "[_", "0_", "]_", "._", "name_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "target", "\\u", "instance", "s", "\\u", "uc", "1_", "[_", "0_", "]_", "._", "name_", ",_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "t_", "._", "name_", "for_", "t_", "in_", "target", "\\u", "instance", "s", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "lc", "targeti", "nstance", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "list", "\\u", "target", "pools_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "pools_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "target", "pools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "pools", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "target", "pools_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "pools", "\\u", "uc", "1_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "target", "pools_", "(_", "'", "us", "-", "central", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "pools_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "pools", "\\u", "all_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "target", "\\u", "pools", "\\u", "uc", "1_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "target", "\\u", "pools_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lc", "target", "pool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "target", "\\u", "pools", "\\u", "uc", "1_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lc", "target", "pool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "t_", "._", "name_", "for_", "t_", "in_", "target", "\\u", "pools", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", "-", "pool", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "disk", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disk", "types_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "disk", "types_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "types", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "disk", "types_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "types", "\\u", "uc", "1a_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "disk", "types_", "(_", "'", "us", "-", "central", "1", "-", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "disk", "types_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "disk", "types", "\\u", "all_", ")_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "disk", "types", "\\u", "uc", "1a_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "disk", "types_", "[_", "0_", "]_", "._", "name_", ",_", "'", "pd", "-", "ssd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "disk", "types", "\\u", "uc", "1a_", "[_", "0_", "]_", "._", "name_", ",_", "'", "pd", "-", "ssd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "v_", "._", "name_", "for_", "v_", "in_", "disk", "types", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "pd", "-", "standard", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "local", "-", "ssd", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "volumes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volumes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "volumes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume", "s", "\\u", "all_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "volumes_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume", "s", "\\u", "uc", "1a_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "volumes_", "(_", "'", "us", "-", "central", "1", "-", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "volumes_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "volume", "s", "\\u", "all_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "volume", "s", "\\u", "uc", "1a_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "volumes_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lcd", "isk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "volume", "s", "\\u", "uc", "1a_", "[_", "0_", "]_", "._", "name_", ",_", "'", "lcd", "isk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "v_", "._", "name_", "for_", "v_", "in_", "volume", "s", "\\u", "all_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "libc", "loud", "-", "demo", "-", "europ", "e-", "boot", "-", "disk", "'_", "in_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "create", "\\u", "route_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "route", "\\u", "name_", "=_", "'", "lcd", "emo", "route", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "\\u", "range_", "=_", "'", "192", ".1", "68.", "25.0", "/", "24", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "priority_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "create", "\\u", "route_", "(_", "route", "\\u", "name_", ",_", "dest", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "route_", ",_", "GC", "ER", "oute", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "route_", "._", "name_", ",_", "route", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "route_", "._", "priority_", ",_", "priority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "tag", "1", "\"_", "in_", "route_", "._", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "route_", "._", "extra_", "[_", "'", "next", "Hop", "Insta", "nce", "'_", "]_", "._", "endswith_", "(_", "'", "libc", "loud", "-1", "00", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "route_", "._", "dest", "\\u", "range_", ",_", "dest", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "node", "\\u", "req", "\\u", "with", "\\u", "service", "accounts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "image_", "(_", "'", "debi", "an", "-", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "size_", "(_", "'", "n1", "-", "standard", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "self_", "._", "driver_", "._", "zone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "network_", "(_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ex", "\\u", "service", "\\u", "account", "s", " ", "with", " ", "specific", " ", "scope", "s", ",", " ", "default", " ", "'", "email", "'_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "sa_", "=_", "[_", "{_", "'", "scope", "s", "'_", ":_", "[_", "'", "compute", "-", "ro", "'_", ",_", "'", "pubs", "ub", "'_", ",_", "'", "storage", "-", "ro", "'_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "request_", ",_", "node", "\\u", "data_", "=_", "self_", "._", "driver_", "._", "\\u", "create", "\\u", "node", "\\u", "req_", "(_", "'", "lc", "node", "'_", ",_", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image_", ",_", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "service", "\\u", "accounts_", "=_", "ex", "\\u", "sa_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", ",_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "email", "'_", "]_", ",_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "scope", "s", "'_", "]_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "scope", "s", "'_", "]_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "https", "://", "www", ".", "google", "apis", ".", "com", "/", "auth", "/", "devs", "tora", "ge", ".", "read", "\\u", "only", "'_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "scope", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "https", "://", "www", ".", "google", "apis", ".", "com", "/", "auth", "/", "compute", ".", "read", "only", "'_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "node", "\\u", "data_", "[_", "'", "service", "Account", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "scope", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "format\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "md_", "=_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v1", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "[_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "{_", "'", "k", "1", "'_", ":_", "'", "v1", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ",_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", ",_", "'", "k", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "v", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", ",_", "'", "k", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "v", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", ",_", "'", "k", "1", "'_", ":_", "'", "v1", "'_", ",_", "'", "k2", "'_", ":_", "'", "v2", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "x_", "[_", "'", "key", "'_", "]_", "for_", "x_", "in_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "=_", "[_", "x_", "[_", "'", "value", "'_", "]_", "for_", "x_", "in_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keys_", ",_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", ",_", "'", "k2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vals_", ",_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", ",_", "'", "v2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v1", "'_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "'", "foo", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "md_", "=_", "[_", "'", "k", "0", "'_", ",_", "'", "v1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "node", "\\u", "with", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "name_", "=_", "'", "node", "-", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "image_", "(_", "'", "debi", "an", "-", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "size_", "(_", "'", "n1", "-", "standard", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "zone_", "(_", "'", "us", "-", "central", "1", "-", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "md", " ", "is", " ", "a", " ", "list", " ", "of", " ", "dict", "s", ",", " ", "each", " ", "with", " ", "'", "key", "'", " ", "and", " ", "'", "value", "'", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "back", "ward", "s", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "md_", "=_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v1", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "data_", "=_", "self_", "._", "driver_", "._", "\\u", "create", "\\u", "node", "\\u", "req_", "(_", "node", "\\u", "name_", ",_", "size_", ",_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", ",_", "metadata_", "=_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "data_", "[_", "'", "metadata", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", "[_", "'", "metadata", "'_", "]_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "md", " ", "doe", "sn", "'", "t", " ", "contain", " ", "\"", "items", "\"", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "md_", "=_", "{_", "'", "key", "'_", ":_", "'", "key", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "value", "1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "data_", "=_", "self_", "._", "driver_", "._", "\\u", "create", "\\u", "node", "\\u", "req_", "(_", "node", "\\u", "name_", ",_", "size_", ",_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", ",_", "metadata_", "=_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "data_", "[_", "'", "metadata", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", "[_", "'", "metadata", "'_", "]_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "md", " ", "contain", "s", " ", "\"", "items", "\"", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "md_", "=_", "{_", "'", "items", "'_", ":_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "data_", "=_", "self_", "._", "driver_", "._", "\\u", "create", "\\u", "node", "\\u", "req_", "(_", "node", "\\u", "name_", ",_", "size_", ",_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", ",_", "metadata_", "=_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "data_", "[_", "'", "metadata", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "data_", "[_", "'", "metadata", "'_", "]_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "metadata", "'_", "]_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", ",_", "'", "k", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "metadata", "'_", "]_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "v", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "target", "pool", "\\u", "geth", "eal", "th_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "pool_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "target", "pool_", "(_", "'", "lb", "-", "pool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "health_", "=_", "target", "pool_", "._", "get", "\\u", "health_", "(_", "'", "libc", "loud", "-", "lb", "-", "demo", "-", "www", "-0", "00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "health_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "node", "'_", "in_", "health_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "health", "'_", "in_", "health_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "health_", "[_", "0_", "]_", "[_", "'", "health", "'_", "]_", ",_", "'", "UN", "HEAL", "TH", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "target", "pool", "\\u", "with", "\\u", "backup", "\\u", "pool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "pool_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "target", "pool_", "(_", "'", "lb", "-", "pool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "backup", "Poo", "l", "'_", "in_", "target", "pool_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "failover", "Rati", "o", "'_", "in_", "target", "pool_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "get", "\\u", "image", "\\u", "license_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "image_", "(_", "'", "sle", "s", "-1", "2", "-", "v2", "014", "1023", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "license", "s", "'_", "in_", "image_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "image_", "._", "extra_", "[_", "'", "license", "s", "'_", "]_", "[_", "0_", "]_", "._", "name_", ",_", "'", "sle", "s", "-1", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "image_", "._", "extra_", "[_", "'", "license", "s", "'_", "]_", "[_", "0_", "]_", "._", "charge", "s", "\\u", "use", "\\u", "fee_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ex", "\\u", "get", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "get", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "project_", "._", "name_", ",_", "'", "project", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "s", "\\u", "quota_", "=_", "project_", "._", "quotas_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "network", "s", "\\u", "quota_", "[_", "'", "usage", "'_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "network", "s", "\\u", "quota_", "[_", "'", "limit", "'_", "]_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "network", "s", "\\u", "quota_", "[_", "'", "metric", "'_", "]_", ",_", "'", "NET", "WORKS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "project_", "._", "extra_", "[_", "'", "common", "Insta", "nce", "Meta", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "project_", "._", "extra_", "[_", "'", "common", "Insta", "nce", "Meta", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "usage", "Export", "Locat", "ion", "'_", "in_", "project_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "bucket", "Name", "'_", "in_", "project_", "._", "extra_", "[_", "'", "usage", "Export", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "project_", "._", "extra_", "[_", "'", "usage", "Export", "Locat", "ion", "'_", "]_", "[_", "'", "bucket", "Name", "'_", "]_", ",_", "'", "gs", "://", "graphite", "-", "usage", "-", "report", "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, 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1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unused import
ImageEngine/gaffer/python/GafferImageUI/ImageTransformUI.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2014, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport itertools\n\nimport Gaffer\nimport GafferUI\nimport GafferImage\n\nGaffer.Metadata.registerNode(\n\n\tGafferImage.ImageTransform,\n\n\t\"description\",\n\t\"\"\"\n\tScales, rotates and translates an image within its display window.\n\tNote that although the format is not changed, the data window is\n\texpanded to include the portions of the image which have been\n\ttransformed outside of the display window, and these out-of-frame\n\tpixels can still be used by downstream nodes.\n\t\"\"\",\n\n\tplugs = {\n\n\t\t\"transform\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tThe transformation to be applied to the image. The translate\n\t\t\tand pivot values are specified in pixels, and the rotate\n\t\t\tvalue is specified in degrees.\n\t\t\t\"\"\",\n\n\t\t\t\"plugValueWidget:type\", \"GafferUI.LayoutPlugValueWidget\",\n\n\t\t],\n\n\t\t\"filter\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tThe pixel filter used when transforming the image. Each\n\t\t\tfilter provides different tradeoffs between sharpness and\n\t\t\tthe danger of aliasing or ringing.\n\t\t\t\"\"\",\n\n\t\t\t\"plugValueWidget:type\", \"GafferUI.PresetsPlugValueWidget\",\n\n\t\t] + list( itertools.chain(\n\n\t\t\t# Disk doesn't make much sense as a resizing filter, and also causes artifacts because\n\t\t\t# its default width is small enough to fall into the gaps between pixels.\n\t\t\t*[ ( \"preset:\" + x.title(), x ) for x in GafferImage.Resample.filters() if x != \"disk\" ]\n\n\t\t) ),\n\n\t}\n\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferUI", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "_", "._", "Metadata_", "._", "register", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "Image_", "._", "Image", "Transform_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "Scale", "s", ",", " ", "rota", "tes", " ", "and", " ", "translat", "es", " ", "an", " ", "image", " ", "within", " ", "its", " ", "display", " ", "window", ".", "\\", "10", ";", "\t", "Not", "e", " ", "tha", "t", " ", "alth", "ou", "gh", " ", "the", " ", "format", " ", "is", " ", "not", " ", "change", "d", ",", " ", "the", " ", "data", " ", "window", " ", "is", "\\", "10", ";", "\t", "expand", "ed", " ", "to", " ", "include", " ", "the", " ", "porti", "ons", " ", "of", " ", "the", " ", "image", " ", "whi", "ch", " ", "have", " ", "bee", "n", "\\", "10", ";", "\t", "transforme", "d", " ", "outsi", "de", " ", "of", " ", "the", " ", "display", " ", "window", ",", " ", "and", " ", "these", " ", "out", "-", "of", "-", "frame", "\\", "10", ";", "\t", "pixel", "s", " ", "can", " ", "still", " ", "be", " ", "used", " ", "by", " ", "downstream", " ", "nodes", ".", "\\", "10", ";", "\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plug", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "transform", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "The", " ", "transformation", " ", "to", " ", "be", " ", "applied", " ", "to", " ", "the", " ", "image", ".", " ", "The", " ", "translat", "e", "\\", "10", ";", "\t\t\t", "and", " ", "piv", "ot", " ", "values", " ", "are", " ", "specified", " ", "in", " ", "pixel", "s", ",", " ", "and", " ", "the", " ", "rota", "te", "\\", "10", ";", "\t\t\t", "value", " ", "is", " ", "specified", " ", "in", " ", "degr", "ees", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "UI", ".", "Lay", "out", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "filter", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "The", " ", "pixel", " ", "filter", " ", "used", " ", "whe", "n", " ", "transform", "ing", " ", "the", " ", "image", ".", " ", "Ea", "ch", "\\", "10", ";", "\t\t\t", "filter", " ", "provide", "s", " ", "different", " ", "trade", "offs", " ", "bet", "ween", " ", "sharp", "ness", " ", "and", "\\", "10", ";", "\t\t\t", "the", " ", "danger", " ", "of", " ", "alias", "ing", " ", "or", " ", "ring", "ing", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"", "Ga", "ffer", "UI", ".", "Preset", "s", "Plug", "Value", "Wid", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "list_", "(_", "itertools_", "._", "chain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disk", " ", "doe", "sn", "'", "t", " ", "make", " ", "muc", "h", " ", "sense", " ", "as", " ", "a", " ", "resiz", "ing", " ", "filter", ",", " ", "and", " ", "als", "o", " ", "caus", "es", " ", "artifact", "s", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "default", " ", "widt", "h", " ", "is", " ", "small", " ", "eno", "ugh", " ", "to", " ", "fall", " ", "int", "o", " ", "the", " ", "gap", "s", " ", "bet", "ween", " ", "pixel", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "*_", "[_", "(_", "\"", "prese", "t", ":\"_", "+_", "x_", "._", "title_", "(_", ")_", ",_", "x_", ")_", "for_", "x_", "in_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bytefish/facerec/py/facerec/visual.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) Philipp Wagner. All rights reserved.\n# Licensed under the BSD license. See LICENSE file in the project root for full license information.\n\nfrom facerec.normalization import minmax\n\nimport os as os\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.cm as cm\n# try to import the PIL Image module\ntry:\n from PIL import Image\nexcept ImportError:\n import Image\nimport math as math\n\n\n\n \n \n\n\n# using plt plot:\n#filename=\"/home/philipp/facerec/at_database_vs_accuracy_xy.png\"\n#t = np.arange(2., 10., 1.)\n#fig = plt.figure()\n#plt.plot(t, r0, 'k--', t, r1, 'k')\n#plt.legend((\"Eigenfaces\", \"Fisherfaces\"), 'lower right', shadow=True, fancybox=True)\n#plt.ylim(0,1)\n#plt.ylabel('Recognition Rate')\n#plt.xlabel('Database Size (Images per Person)')\n#fig.savefig(filename, format=\"png\", transparent=False)\n#plt.show()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_font(fontname='Tahoma', fontsize=10):\n return { 'fontname': fontname, 'fontsize':fontsize }", "metadata": "root.create_font", "header": "['module', '___EOS___']", "index": 20 }, { "content": "def plot_gray(X, sz=None, filename=None):\n if not sz is None:\n X = X.reshape(sz)\n X = minmax(I, 0, 255)\n fig = plt.figure()\n implot = plt.imshow(np.asarray(Ig), cmap=cm.gray)\n if filename is None:\n plt.show()\n else:\n fig.savefig(filename, format=\"png\", transparent=False)", "metadata": "root.plot_gray", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def plot_eigenvectors(eigenvectors, num_components, sz, filename=None, start_component=0, rows = None, cols = None, title=\"Subplot\", color=True):\n if (rows is None) or (cols is None):\n rows = cols = int(math.ceil(np.sqrt(num_components)))\n num_components = np.min(num_components, eigenvectors.shape[1])\n fig = plt.figure()\n for i in range(start_component, num_components):\n vi = eigenvectors[0:,i].copy()\n vi = minmax(np.asarray(vi), 0, 255, dtype=np.uint8)\n vi = vi.reshape(sz)\n \n ax0 = fig.add_subplot(rows,cols,(i-start_component)+1)\n \n plt.setp(ax0.get_xticklabels(), visible=False)\n plt.setp(ax0.get_yticklabels(), visible=False)\n plt.title(\"%s #%d\" % (title, i), create_font('Tahoma',10))\n if color:\n implot = plt.imshow(np.asarray(vi))\n else:\n implot = plt.imshow(np.asarray(vi), cmap=cm.grey)\n if filename is None:\n fig.show()\n else:\n fig.savefig(filename, format=\"png\", transparent=False)", "metadata": "root.plot_eigenvectors", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def subplot(title, images, rows, cols, sptitle=\"subplot\", sptitles=[], colormap=cm.gray, ticks_visible=True, filename=None):\n fig = plt.figure()\n # main title\n fig.text(.5, .95, title, horizontalalignment='center') \n for i in xrange(len(images)):\n ax0 = fig.add_subplot(rows,cols,(i+1))\n plt.setp(ax0.get_xticklabels(), visible=False)\n plt.setp(ax0.get_yticklabels(), visible=False)\n if len(sptitles) == len(images):\n plt.title(\"%s #%s\" % (sptitle, str(sptitles[i])), create_font('Tahoma',10))\n else:\n plt.title(\"%s #%d\" % (sptitle, (i+1)), create_font('Tahoma',10))\n plt.imshow(np.asarray(images[i]), cmap=colormap)\n if filename is None:\n plt.show()\n else:\n fig.savefig(filename)", "metadata": "root.subplot", "header": "['module', '___EOS___']", "index": 58 } ]
[ { "span": "import os as os", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "from PIL import Image", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 25 }, { "span": "import Image", "start_line": 16, "start_column": 4, "end_line": 16, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Phil", "ipp", " ", "Wa", "gne", "r", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "BS", "D", " ", "license", ".", " ", "See", " ", "LICENSE", " ", "file", " ", "in", " ", "the", " ", "project", " ", "root", " ", "for", " ", "full", " ", "license", " ", "informati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "face", "rec_", "._", "normalization_", "import_", "minmax", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "as_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "cm_", "as_", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "import", " ", "the", " ", "PI", "L", " ", "Image", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "PIL_", "import_", "Image_", "\\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_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "math_", "as_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "usi", "ng", " ", "plt", " ", "plot", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", "=\"", "/", "home", "/", "phil", "ipp", "/", "face", "rec", "/", "at", "\\u", "databa", "se", "\\u", "vs", "\\u", "accu", "rac", "y", "\\u", "xy", ".", "png", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "t", " ", "=", " ", "np", ".", "aran", "ge", "(", "2", ".,", " ", "10.", ",", " ", "1", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fig", " ", "=", " ", "plt", ".", "figure", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "plot", "(", "t", ",", " ", "r", "0", ",", " ", "'", "k", "--", "',", " ", "t", ",", " ", "r1", ",", " ", "'", "k", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "legend", "((", "\"", "Eigen", "face", "s", "\",", " ", "\"", "Fish", "erf", "aces", "\")", ",", " ", "'", "lower", " ", "right", "',", " ", "shadow", "=", "Tru", "e", ",", " ", "fancy", "box", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "ylim", "(", "0", ",", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "ylabel", "('", "Reco", "gni", "tion", " ", "Rat", "e", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "xlabel", "('", "Databa", "se", " ", "Size", " ", "(", "Image", "s", " ", "per", " ", "Person", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fig", ".", "save", "fig", "(", "filename", ",", " ", "format", "=\"", "png", "\",", " ", "transp", "arent", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "plt", ".", "show", "()", "_", "\\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_", "create", "\\u", "font_", "(_", "font", "name_", "=_", "'", "Ta", "hom", "a", "'_", ",_", "fontsize_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "font", "name", "'_", ":_", "font", "name_", ",_", "'", "font", "size", "'_", ":_", "fontsize_", "}_", "\\u\\u\\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_", "plot", "\\u", "gray_", "(_", "X_", ",_", "sz_", "=_", "None_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "sz_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "X_", "._", "reshape_", "(_", "sz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "minmax", "_", "(_", "I_", ",_", "0_", ",_", "255_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "Ig", "_", ")_", ",_", "cmap_", "=_", "cm_", "._", "gray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "._", "savefig_", "(_", "filename_", ",_", "format_", "=_", "\"", "png", "\"_", ",_", "transparent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "eigenvector", "s_", "(_", "eigenvector", "s_", ",_", "num", "\\u", "components_", ",_", "sz_", ",_", "filename_", "=_", "None_", ",_", "start", "\\u", "component_", "=_", "0_", ",_", "rows_", "=_", "None_", ",_", "cols_", "=_", "None_", ",_", "title_", "=_", "\"", "Subp", "lot", "\"_", ",_", "color_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "rows_", "is_", "None_", ")_", "or_", "(_", "cols_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "cols_", "=_", "int_", "(_", "math_", "._", "ceil_", "(_", "np_", "._", "sqrt_", "(_", "num", "\\u", "components_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "components_", "=_", "np_", "._", "min_", "(_", "num", "\\u", "components_", ",_", "eigenvector", "s_", "._", "shape_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "start", "\\u", "component_", ",_", "num", "\\u", "components_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vi_", "=_", "eigenvector", "s_", "[_", "0_", ":_", ",_", "i_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi_", "=_", "minmax", "_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ",_", "0_", ",_", "255_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi_", "=_", "vi_", "._", "reshape_", "(_", "sz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax", "0_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "rows_", ",_", "cols_", ",_", "(_", "i_", "-_", "start", "\\u", "component_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "xticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "yticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"%", "s", " ", "#", "%", "d", "\"_", "%_", "(_", "title_", ",_", "i_", ")_", ",_", "create", "\\u", "font_", "(_", "'", "Ta", "hom", "a", "'_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ",_", "cmap_", "=_", "cm_", "._", "grey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "._", "savefig_", "(_", "filename_", ",_", "format_", "=_", "\"", "png", "\"_", ",_", "transparent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "subplot_", "(_", "title_", ",_", "images_", ",_", "rows_", ",_", "cols_", ",_", "spt", "itle_", "=_", "\"", "subplot", "\"_", ",_", "spt", "itle", "s_", "=_", "[_", "]_", ",_", "colormap_", "=_", "cm_", "._", "gray_", ",_", "tick", "s", "\\u", "visible_", "=_", "True_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "main", " ", "title_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "._", "text_", "(_", ".5_", ",_", ".95", "_", ",_", "title_", ",_", "horizon", "tal", "alignment_", "=_", "'", "center", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "images_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax", "0_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "rows_", ",_", "cols_", ",_", "(_", "i_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "xticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "yticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "spt", "itle", "s_", ")_", "==_", "len_", "(_", "images_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "title_", "(_", "\"%", "s", " ", "#", "%", "s", "\"_", "%_", "(_", "spt", "itle_", ",_", "str_", "(_", "spt", "itle", "s_", "[_", "i_", "]_", ")_", ")_", ",_", "create", "\\u", "font_", "(_", "'", "Ta", "hom", "a", "'_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "title_", "(_", "\"%", "s", " ", "#", "%", "d", "\"_", "%_", "(_", "spt", "itle_", ",_", "(_", "i_", "+_", "1_", ")_", ")_", ",_", "create", "\\u", "font_", "(_", "'", "Ta", "hom", "a", "'_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "images_", "[_", "i_", "]_", ")_", ",_", "cmap_", "=_", "colormap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "._", "savefig_", "(_", "filename_", ")_", "\\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, 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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 ]
`__eq__` not overridden when adding attributes
chromaway/ngcccbase/coloredcoinlib/colorvalue.py
[ { "content": "class ColorValue(object):\n\n\n\n\n\n", "metadata": "root.ColorValue", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, **kwargs):\n self.colordef = kwargs.pop('colordef')", "metadata": "root.ColorValue.__init__", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 12 }, { "content": " def get_kwargs(self):\n kwargs = {}\n kwargs['colordef'] = self.get_colordef()\n return kwargs", "metadata": "root.ColorValue.get_kwargs", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 15 }, { "content": " def clone(self):\n kwargs = self.get_kwargs()\n return self.__class__(**kwargs)", "metadata": "root.ColorValue.clone", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def check_compatibility(self, other):\n if self.get_color_id() != other.get_color_id():\n raise IncompatibleTypesError", "metadata": "root.ColorValue.check_compatibility", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_colordef(self):\n return self.colordef", "metadata": "root.ColorValue.get_colordef", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": " def get_color_id(self):\n return self.colordef.get_color_id()", "metadata": "root.ColorValue.get_color_id", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 31 }, { "content": " def is_uncolored(self):\n return self.get_color_id() == 0", "metadata": "root.ColorValue.is_uncolored", "header": "['class', 'ColorValue', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": "class AdditiveColorValue(ColorValue, ComparableMixin):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AdditiveColorValue", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def __init__(self, **kwargs):\n super(AdditiveColorValue, self).__init__(**kwargs)\n self.value = int(kwargs.pop('value'))\n if not isinstance(self.value, int):\n raise InvalidValueError('Not an int but a %s' % self.value.__class__)", "metadata": "root.AdditiveColorValue.__init__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 39 }, { "content": " def get_kwargs(self):\n kwargs = super(AdditiveColorValue, self).get_kwargs()\n kwargs['value'] = self.get_value()\n return kwargs", "metadata": "root.AdditiveColorValue.get_kwargs", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 45 }, { "content": " def get_value(self):\n return self.value", "metadata": "root.AdditiveColorValue.get_value", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 50 }, { "content": " def get_satoshi(self):\n return self.get_colordef().__class__.color_to_satoshi(self)", "metadata": "root.AdditiveColorValue.get_satoshi", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 53 }, { "content": " def __add__(self, other):\n if isinstance(other, int) and other == 0:\n return self\n self.check_compatibility(other)\n kwargs = self.get_kwargs()\n kwargs['value'] = self.get_value() + other.get_value()\n return self.__class__(**kwargs)", "metadata": "root.AdditiveColorValue.__add__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 56 }, { "content": " def __neg__(self):\n kwargs = self.get_kwargs()\n kwargs['value'] = - self.get_value()\n return self.__class__(**kwargs)", "metadata": "root.AdditiveColorValue.__neg__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 64 }, { "content": " def __radd__(self, other):\n return self + other", "metadata": "root.AdditiveColorValue.__radd__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 69 }, { "content": " def __sub__(self, other):\n if isinstance(other, int) and other == 0:\n return self\n self.check_compatibility(other)\n kwargs = self.get_kwargs()\n kwargs['value'] = self.get_value() - other.get_value()\n return self.__class__(**kwargs)", "metadata": "root.AdditiveColorValue.__sub__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 72 }, { "content": " def __iadd__(self, other):\n self.check_compatibility(other)\n self.value += other.value\n return self", "metadata": "root.AdditiveColorValue.__iadd__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 80 }, { "content": " def __eq__(self, other):\n if self.get_colordef() != other.get_colordef():\n return False\n else:\n return self.get_value() == other.get_value()", "metadata": "root.AdditiveColorValue.__eq__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 85 }, { "content": " def __lt__(self, other):\n self.check_compatibility(other)\n return self.get_value() < other.get_value()", "metadata": "root.AdditiveColorValue.__lt__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 91 }, { "content": " def __gt__(self, other):\n if isinstance(other, int) and other == 0:\n return self.get_value() > 0\n return other < self", "metadata": "root.AdditiveColorValue.__gt__", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 95 }, { "content": " @classmethod\n def sum(cls, items):\n return reduce(lambda x,y:x + y, items)", "metadata": "root.AdditiveColorValue.sum", "header": "['class', 'AdditiveColorValue', '(', 'ColorValue', ',', 'ComparableMixin', ')', ':', '___EOS___']", "index": 100 }, { "content": "class SimpleColorValue(AdditiveColorValue):\n\n\n", "metadata": "root.SimpleColorValue", "header": "['module', '___EOS___']", "index": 105 }, { "content": " def __init__(self, **kwargs):\n super(SimpleColorValue, self).__init__(**kwargs)\n if kwargs.get('label'):\n self.label = kwargs.pop('label')\n else:\n self.label = ''", "metadata": "root.SimpleColorValue.__init__", "header": "['class', 'SimpleColorValue', '(', 'AdditiveColorValue', ')', ':', '___EOS___']", "index": 106 }, { "content": " def get_kwargs(self):\n kwargs = super(SimpleColorValue, self).get_kwargs()\n kwargs['label'] = self.get_label()\n return kwargs", "metadata": "root.SimpleColorValue.get_kwargs", "header": "['class', 'SimpleColorValue', '(', 'AdditiveColorValue', ')', ':', '___EOS___']", "index": 113 }, { "content": " def get_label(self):\n return self.label", "metadata": "root.SimpleColorValue.get_label", "header": "['class', 'SimpleColorValue', '(', 'AdditiveColorValue', ')', ':', '___EOS___']", "index": 118 }, { "content": " def __repr__(self):\n return \"%s: %s\" % (self.get_label() or self.get_colordef(), self.value)", "metadata": "root.SimpleColorValue.__repr__", "header": "['class', 'SimpleColorValue', '(', 'AdditiveColorValue', ')', ':', '___EOS___']", "index": 121 } ]
[ { "span": "class SimpleColorValue(AdditiveColorValue):", "start_line": 105, "start_column": 0, "end_line": 105, "end_column": 43 } ]
[ { "span": "def __eq__(self, other):", "start_line": 85, "start_column": 4, "end_line": 85, "end_column": 28 }, { "span": "self.label ", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 22 }, { "span": "self.label ", "start_line": 111, "start_column": 12, "end_line": 111, "end_column": 22 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "color", "def_", "=_", "kwargs_", "._", "pop_", "(_", "'", "color", "def", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "color", "def", "'_", "]_", "=_", "self_", "._", "get", "\\u", "color", "def_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "compatibility", "_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "color", "\\u", "id_", "(_", ")_", "!=_", "other_", "._", "get", "\\u", "color", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Incomp", "atible", "Type", "s", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "color", "def_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "color", "def_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "color", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "color", "def_", "._", "get", "\\u", "color", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Value_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "unco", "lore", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "color", "\\u", "id_", "(_", ")_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\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_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Add", "iti", "ve", "Color", "Value_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "int_", "(_", "kwargs_", "._", "pop_", "(_", "'", "value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "self_", "._", "value_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Value", "Error_", "(_", "'", "Not", " ", "an", " ", "int", " ", "but", " ", "a", " ", "%", "s", "'_", "%_", "self_", "._", "value_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "super_", "(_", "Add", "iti", "ve", "Color", "Value_", ",_", "self_", ")_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "value", "'_", "]_", "=_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sat", "osh", "i_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "color", "def_", "(_", ")_", "._", "\\u\\u", "class\\u\\u_", "._", "color", "\\u", "to", "\\u", "sat", "osh", "i_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "int_", ")_", "and_", "other_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "check", "\\u", "compatibility", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "self_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "value", "'_", "]_", "=_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "+_", "other_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "value", "'_", "]_", "=_", "-_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "+_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "int_", ")_", "and_", "other_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "check", "\\u", "compatibility", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "self_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "value", "'_", "]_", "=_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "-_", "other_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "compatibility", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "+=_", "other_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\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_", "self_", "._", "get", "\\u", "color", "def_", "(_", ")_", "!=_", "other_", "._", "get", "\\u", "color", "def_", "(_", ")_", ":_", "\\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_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "other_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "compatibility", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "get", "\\u", "value_", "(_", ")_", "<_", "other_", "._", "get", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "Mixin_", ")_", ":_", "\\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_", "isinstance_", "(_", "other_", ",_", "int_", ")_", "and_", "other_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "value_", "(_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "<_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "iti", "ve", "Color", "Value_", "(_", "Color", "Value_", ",_", "Compara", "ble", "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_", "sum_", "(_", "cls_", ",_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reduce_", "(_", "lambda_", "x_", ",_", "y_", ":_", "x_", "+_", "y_", ",_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "Color", "Value_", "(_", "Add", "iti", "ve", "Color", "Value_", ")_", ":_", "\\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_", "Simple", "Color", "Value_", "(_", "Add", "iti", "ve", "Color", "Value_", ")_", ":_", "\\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_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Simple", "Color", "Value_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kwargs_", "._", "get_", "(_", "'", "label", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "label_", "=_", "kwargs_", "._", "pop_", "(_", "'", "label", "'_", ")_", "\\u\\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_", "._", "label_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Color", "Value_", "(_", "Add", "iti", "ve", "Color", "Value_", ")_", ":_", "\\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", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "super_", "(_", "Simple", "Color", "Value_", ",_", "self_", ")_", "._", "get", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "label", "'_", "]_", "=_", "self_", "._", "get", "\\u", "label_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Color", "Value_", "(_", "Add", "iti", "ve", "Color", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "label_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Color", "Value_", "(_", "Add", "iti", "ve", "Color", "Value_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "get", "\\u", "label_", "(_", ")_", "or_", "self_", "._", "get", "\\u", "color", "def_", "(_", ")_", ",_", "self_", "._", "value_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 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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kodi/plugin.video.specto/resources/lib/resolvers/divxpress.py
[ { "content": "# -*- coding: utf-8 -*-\n\n'''\n Specto Add-on\n Copyright (C) 2015 lambda\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'''\n\n\nimport re,urllib\nfrom resources.lib.libraries import client\nfrom resources.lib.libraries import jsunpack\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def resolve(url):\n try:\n url = url.replace('/embed-', '/')\n url = re.compile('//.+?/([\\w]+)').findall(url)[0]\n url = 'http://divxpress.com/embed-%s.html' % url\n\n result = client.request(url, close=False)\n\n post = {}\n f = client.parseDOM(result, 'form', attrs = {'method': 'POST'})[0]\n k = client.parseDOM(f, 'input', ret='name', attrs = {'type': 'hidden'})\n for i in k: post.update({i: client.parseDOM(f, 'input', ret='value', attrs = {'name': i})[0]})\n post = post\n\n result = client.request(url, post=post)\n\n result = re.compile('(eval.*?\\)\\)\\))').findall(result)[-1]\n result = jsunpack.unpack(result)\n\n url = client.parseDOM(result, 'embed', ret='src')\n url += re.compile(\"'file' *, *'(.+?)'\").findall(result)\n url = [i for i in url if not i.endswith('.srt')]\n url = 'http://' + url[0].split('://', 1)[-1]\n\n return url\n except:\n return", "metadata": "root.resolve", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "import re,urllib", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 16 } ]
[]
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_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Spect", "o", " ", "Add", "-", "on", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", "lambda", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "\\", "10", ";", " ", " ", " ", " ", "along", " ", "with", " ", "this", " ", "program", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", ",_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "libraries_", "import_", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "libraries_", "import_", "js", "unpack_", "\\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_", "resolve_", "(_", "url_", ")_", ":_", "\\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 ", " _", "url_", "=_", "url_", "._", "replace_", "(_", "'/", "embed", "-'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "re_", "._", "compile_", "(_", "'//", ".+?", "/([", "\\\\", "w", "]+)'_", ")_", "._", "findall_", "(_", "url_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'", "http", "://", "div", "xpr", "ess", ".", "com", "/", "embed", "-%", "s", ".", "html", "'_", "%_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "client_", "._", "request_", "(_", "url_", ",_", "close_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "client_", "._", "parse", "DOM_", "(_", "result_", ",_", "'", "form", "'_", ",_", "attrs_", "=_", "{_", "'", "method", "'_", ":_", "'", "POST", "'_", "}_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "client_", "._", "parse", "DOM_", "(_", "f_", ",_", "'", "input", "'_", ",_", "ret_", "=_", "'", "name", "'_", ",_", "attrs_", "=_", "{_", "'", "type", "'_", ":_", "'", "hidden", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "k_", ":_", "post_", "._", "update_", "(_", "{_", "i_", ":_", "client_", "._", "parse", "DOM_", "(_", "f_", ",_", "'", "input", "'_", ",_", "ret_", "=_", "'", "value", "'_", ",_", "attrs_", "=_", "{_", "'", "name", "'_", ":_", "i_", "}_", ")_", "[_", "0_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "=_", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "client_", "._", "request_", "(_", "url_", ",_", "post_", "=_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "re_", "._", "compile_", "(_", "'(", "eval", ".*?\\\\", ")\\\\", ")\\\\", "))'_", ")_", "._", "findall_", "(_", "result_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "js", "unpack_", "._", "unpack_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "client_", "._", "parse", "DOM_", "(_", "result_", ",_", "'", "embed", "'_", ",_", "ret_", "=_", "'", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "+=_", "re_", "._", "compile_", "(_", "\"'", "file", "'", " ", "*", ",", " ", "*'", "(.+?)", "'\"_", ")_", "._", "findall_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "[_", "i_", "for_", "i_", "in_", "url_", "if_", "not_", "i_", "._", "endswith_", "(_", "'.", "srt", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'", "http", "://'_", "+_", "url_", "[_", "0_", "]_", "._", "split_", "(_", "':/", "/'_", ",_", "1_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "url_", "\\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_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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\n\tt.a = a\n\tb = []\n\tt.b = b\n\t#self.chkrel(t, T, 'type(%s)')\n\tself.chkrel(t, T, '%s->ob_type')\n\tself.chkrelattr(t, 'a', 'b')\n\t# We shouldn't have a __dict__ here - just make sure this is the case\n\tself.failUnlessRaises(AttributeError, lambda:t.__dict__)\n\n\tclass U(T):\n\t pass\n\tu = U()\n\tu.a = a\n\tself.chkpath(u, T, \"%s->ob_type.__base__\")\n\tself.chkrel(u, a, '%s.a')\n\n\tc = []\n\tu.c = c\n\tself.chkrel(u, c, '%s.c')\n\tself.chkrel(u, u.__dict__, '%s.__dict__')\n\n\tclass V(U):\n\t pass\n\tv = V()\n\tv.c = c\n\tself.chkrelattr(v, '__dict__')\n\n\tclass W(V):\n\t __slots__ = 'c', 'd', 'b'\n\t pass\n\tw = W()\n\tw.a = a\n\tw.b = b\n\tw.c = c\n\tw.d = []\n\tw.e = []\n\tself.chkrelattr(w, '__dict__', 'a', 'b', 'c', 'd', 'e')\n\tself.chkpath(w, w.a, '%s.a')\n\tself.chkpath(w, w.b, '%s.b')\n\tself.chkpath(w, w.c, '%s.c')\n\tself.chkpath(w, w.d, '%s.d')\n\tself.chkpath(w, w.e, \"%s.__dict__['e']\")\n\n\tclass R(object):\n\t rvar = []\n\tclass S(R, T):\n\t svar = []\n\t \n\ts = S()\n\ts.a = a\n\ts.b = b\n\ts.c = c\n\tself.chkrelattr(s, '__dict__', 'a', 'b', 'c')\n\tself.chkpath(s, s.a, '%s.a')\n\tself.chkpath(s, s.b, '%s.b')\n\tself.chkpath(s, s.c, \"%s.__dict__['c']\")\n\n\t# Class variables are not directly related- should they be that?\n\t# Possibly, but the compression could as well be done in Python.\n\t# We just check that we can get the path.\n\tself.chkpath(s, s.svar, \"%s->ob_type.__dict__['svar']\")\n\tself.chkpath(s, s.rvar, [\"%s->ob_type.__bases__[0].__dict__['rvar']\",\n\t\t\t\t \"%s->ob_type.__mro__[1].__dict__['rvar']\"])\n\tself.chkpath(s, s.__slots__, \"%s->ob_type.__base__.__dict__['__slots__']\")", "metadata": "root.RelationTestCase.test_object_relation", "header": "['class', 'RelationTestCase', '(', 'TestCase', ')', ':', '___NEWLINE___', '# Test relations from standard types and some simple paths', '___NL___', '___EOS___']", "index": 257 } ]
[ { "span": "pass", "start_line": 291, "start_column": 5, "end_line": 291, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Relation", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "relation", "s", " ", "from", " ", "standard", " ", "types", " ", "and", " ", "some", " ", "simple", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "object\\u", "relation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "class_", "T_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u\\u", "slots\\u\\u_", "=_", "'", "a", "'_", ",_", "'", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "chk", "rel", "(", "t", ",", " ", "T", ",", " ", "'", "type", "(%", "s", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "chk", "rel_", "(_", "t_", ",_", "T_", ",_", "'%", "s", "->", "ob", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rela", "ttr", "_", "(_", "t_", ",_", "'", "a", "'_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", "n", "'", "t", " ", "have", " ", "a", " ", "\\u\\u", "dict", "\\u\\u", " ", "here", " ", "-", " ", "just", " ", "make", " ", "sure", " ", "this", " ", "is", " ", "the", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Attribute", "Error_", ",_", "lambda_", ":_", "t_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "U_", "(_", "T_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u_", "=_", "U_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "u_", ",_", "T_", ",_", "\"%", "s", "->", "ob", "\\u", "type", ".\\u", "\\u", "base", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rel_", "(_", "u_", ",_", "a_", ",_", "'%", "s", ".", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "c_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rel_", "(_", "u_", ",_", "c_", ",_", "'%", "s", ".", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rel_", "(_", "u_", ",_", "u_", "._", "\\u\\u", "dict\\u\\u_", ",_", "'%", "s", ".\\u", "\\u", "dict", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "V_", "(_", "U_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "V_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "._", "c_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rela", "ttr", "_", "(_", "v_", ",_", "'\\u", "\\u", "dict", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "W_", "(_", "V_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u\\u", "slots\\u\\u_", "=_", "'", "c", "'_", ",_", "'", "d", "'_", ",_", "'", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "w_", "=_", "W_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "c_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "e_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rela", "ttr", "_", "(_", "w_", ",_", "'\\u", "\\u", "dict", "\\u\\u'_", ",_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", ",_", "'", "d", "'_", ",_", "'", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "w_", ",_", "w_", "._", "a_", ",_", "'%", "s", ".", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "w_", ",_", "w_", "._", "b_", ",_", "'%", "s", ".", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "w_", ",_", "w_", "._", "c_", ",_", "'%", "s", ".", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "w_", ",_", "w_", "._", "d_", ",_", "'%", "s", ".", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "w_", ",_", "w_", "._", "e_", ",_", "\"%", "s", ".\\u", "\\u", "dict", "\\u\\u", "['", "e", "']\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "R_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "rva", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "S_", "(_", "R_", ",_", "T_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "sv", "ar_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "S_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "c_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "rela", "ttr", "_", "(_", "s_", ",_", "'\\u", "\\u", "dict", "\\u\\u'_", ",_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "a_", ",_", "'%", "s", ".", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "b_", ",_", "'%", "s", ".", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "c_", ",_", "\"%", "s", ".\\u", "\\u", "dict", "\\u\\u", "['", "c", "']\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Class", " ", "variab", "les", " ", "are", " ", "not", " ", "direct", "ly", " ", "relate", "d", "-", " ", "shou", "ld", " ", "the", "y", " ", "be", " ", "tha", "t", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Poss", "ibl", "y", ",", " ", "but", " ", "the", " ", "compress", "ion", " ", "coul", "d", " ", "as", " ", "well", " ", "be", " ", "don", "e", " ", "in", " ", "Pyth", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "just", " ", "check", " ", "tha", "t", " ", "we", " ", "can", " ", "get", " ", "the", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "sv", "ar_", ",_", "\"%", "s", "->", "ob", "\\u", "type", ".\\u", "\\u", "dict", "\\u\\u", "['", "sv", "ar", "']\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "rva", "r_", ",_", "[_", "\"%", "s", "->", "ob", "\\u", "type", ".\\u", "\\u", "bases\\u", "\\u", "[", "0", "].", "\\u\\u", "dict", "\\u\\u", "['", "rva", "r", "']\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "->", "ob", "\\u", "type", ".\\u", "\\u", "mro", "\\u\\u", "[", "1", "].", "\\u\\u", "dict", "\\u\\u", "['", "rva", "r", "']\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chk", "path_", "(_", "s_", ",_", "s_", "._", "\\u\\u", "slots\\u\\u_", ",_", "\"%", "s", "->", "ob", "\\u", "type", ".\\u", "\\u", "base", "\\u\\u", ".\\u", "\\u", "dict", "\\u\\u", "['", "\\u\\u", "slot", "s", "\\u\\u'", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused local variable
gustavla/autocolorize/autocolorize/extraction.py
[ { "content": "def extract_sparse(classifier, grayscale, *chs):\n \"\"\"\n Extract using sparse model (slower).\n\n classifier: Caffe Classifier object\n\n \"\"\"\n # Set scale so that the longest is MAX_SIDE\n min_side = np.min(img.shape[:2])\n max_side = np.max(img.shape[:2])\n scale = min(MIN_SIDE / min_side, 1)\n if max_side * scale >= MAX_SIDE:\n scale = MAX_SIDE / max_side\n\n samples = classifier.blobs['centroids'].data.shape[1]\n size = classifier.blobs['data'].data.shape[2]\n centroids = np.zeros((1, samples, 2), dtype=np.float32)\n full_shape = grayscale.shape[:2]\n grayscale = resize_by_factor(grayscale, scale)\n raw_shape = grayscale.shape[:2]\n\n st0 = (size - raw_shape[0])//2\n en0 = st0 + raw_shape[0]\n st1 = (size - raw_shape[1])//2\n en1 = st1 + raw_shape[1]\n\n grayscale = image.center_crop_reflect(grayscale, (size, size))\n\n #bgr = raw_img.transpose(2, 0, 1)[np.newaxis]\n #data = bgr.mean(1, keepdims=True)\n data = grayscale[np.newaxis, np.newaxis]\n\n print('data', data.shape)\n\n shape = raw_img.shape[:2]\n\n scaled_size = size // HOLE\n\n scaled_shape = tuple([shi // HOLE for shi in raw_shape[:2]])\n\n #scaled_chs = []\n #scaled_a = np.zeros(scaled_shape + (1,))\n #scaled_b = np.zeros(scaled_shape + (1,))\n scaleds = [None] * len(chs)\n\n img_ii, img_jj = np.meshgrid(range(scaled_shape[0]), range(scaled_shape[1]))\n\n ii = HOLE//2 + st0 + img_ii * HOLE\n jj = HOLE//2 + st1 + img_jj * HOLE\n\n indices = np.arange(0, ii.size, samples)\n for chunk in indices:\n chunk_slice = np.s_[chunk:chunk + samples]\n ii_ = ii.ravel()[chunk_slice]\n jj_ = jj.ravel()[chunk_slice]\n centroids[0, :len(ii_), 0] = ii_\n centroids[0, :len(jj_), 1] = jj_\n\n ret = classifier.forward(data=grayscale, centroids=centroids)\n\n ii_ = img_ii.ravel()[chunk_slice]\n jj_ = img_jj.ravel()[chunk_slice]\n\n for i, ch in enumerate(chs):\n if scaleds[i] is None:\n scaleds[i] = np.zeros(scaled_shape + (ret[chs[i]].shape[-1],))\n scaleds[i][ii_, jj_] = ret[ch][:len(ii_)]\n\n scaled_combined = np.concatenate(scaleds, axis=-1)\n\n full_combined = resize_by_factor(scaled_combined, HOLE / scale)\n full_combined = image.center_crop(full_combined, img.shape[:2])\n assert full_combined.shape[:2] == img.shape[:2]\n combined = full_combined\n\n res = []\n cur = 0\n for i, ch in enumerate(chs):\n C = scaleds[i].shape[-1]\n res.append(combined[..., cur:cur + C])\n cur += C\n\n return tuple(res)", "metadata": "root.extract_sparse", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def extract(classifier, grayscale, *chs):\n \"\"\"\n Extract using dense model (faster).\n\n classifier: Caffe Classifier object\n grayscale: Input image\n \"\"\"\n # Set scale so that the longest is MAX_SIDE\n min_side = np.min(grayscale.shape[:2])\n max_side = np.max(grayscale.shape[:2])\n scale = min(MIN_SIDE / min_side, 1)\n if max_side * scale >= MAX_SIDE:\n scale = MAX_SIDE / max_side\n\n HOLE = 4\n\n #samples = classifier.blobs['centroids'].data.shape[1]\n size = classifier.blobs['data'].data.shape[2]\n #centroids = np.zeros((1, samples, 2), dtype=np.float32)\n full_shape = grayscale.shape[:2]\n raw_grayscale = grayscale.copy()\n if scale != 1:\n grayscale = resize_by_factor(grayscale, scale)\n raw_shape = grayscale.shape[:2]\n\n st0 = (size - raw_shape[0])//2\n en0 = st0 + raw_shape[0]\n st1 = (size - raw_shape[1])//2\n en1 = st1 + raw_shape[1]\n\n #raw_img = image.center_crop_reflect(raw_img, (size, size))\n grayscale = image.center_crop(grayscale, (size, size))\n\n #bgr = raw_img.transpose(2, 0, 1)[np.newaxis]\n\n data = grayscale[np.newaxis, np.newaxis]\n\n #shape = grayscale.shape[:2]\n\n scaled_size = size // HOLE\n\n scaled_shape = tuple([shi // HOLE for shi in raw_shape[:2]])\n\n ret = classifier.forward(data=data)\n\n data = {key: classifier.blobs[key].data for key in classifier.blobs}\n\n scaleds = [ret['prediction_h_full'][0].transpose(1, 2, 0), ret['prediction_c_full'][0].transpose(1, 2,0)]\n\n scaled_combined = np.concatenate(scaleds, axis=-1)\n\n #full_combined = resize_by_factor(scaled_combined, HOLE / scale)\n full_combined = resize_by_factor(scaled_combined, 1 / scale)\n full_combined = image.center_crop(full_combined, full_shape)\n assert full_combined.shape[:2] == full_shape\n combined = full_combined\n\n res = []\n cur = 0\n for i, ch in enumerate(chs):\n C = scaleds[i].shape[-1]\n res.append(combined[..., cur:cur + C])\n cur += C\n\n return tuple(res)", "metadata": "root.extract", "header": "['module', '___EOS___']", "index": 132 } ]
[ { "span": "full_shape ", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 14 }, { "span": "en0 ", "start_line": 69, "start_column": 4, "end_line": 69, "end_column": 7 }, { "span": "en1 ", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 7 }, { "span": "shape ", "start_line": 81, "start_column": 4, "end_line": 81, "end_column": 9 }, { "span": "scaled_size ", "start_line": 83, "start_column": 4, "end_line": 83, "end_column": 15 }, { "span": "raw_grayscale ", "start_line": 152, "start_column": 4, "end_line": 152, "end_column": 17 }, { "span": "en0 ", "start_line": 158, "start_column": 4, "end_line": 158, "end_column": 7 }, { "span": "en1 ", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 7 }, { "span": "scaled_size ", "start_line": 171, "start_column": 4, "end_line": 171, "end_column": 15 }, { "span": "scaled_shape ", "start_line": 173, "start_column": 4, "end_line": 173, "end_column": 16 }, { "span": "data ", "start_line": 177, "start_column": 4, "end_line": 177, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "sparse_", "(_", "classifier_", ",_", "grayscale", "_", ",_", "*_", "chs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Extract", " ", "usi", "ng", " ", "spars", "e", " ", "model", " ", "(", "slowe", "r", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "classif", "ier", ":", " ", "Ca", "ffe", " ", "Classif", "ier", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "scale", " ", "so", " ", "tha", "t", " ", "the", " ", "long", "est", " ", "is", " ", "MAX", "\\u", "SIDE", "_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "side_", "=_", "np_", "._", "min_", "(_", "img_", "._", "shape_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "side_", "=_", "np_", "._", "max_", "(_", "img_", "._", "shape_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "min_", "(_", "MIN", "\\u", "SIDE", "_", "/_", "min", "\\u", "side_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "side_", "*_", "scale_", ">=_", "MAX", "\\u", "SIDE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "MAX", "\\u", "SIDE", "_", "/_", "max", "\\u", "side_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "samples_", "=_", "classifier_", "._", "blobs_", "[_", "'", "centroid", "s", "'_", "]_", "._", "data_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "classifier_", "._", "blobs_", "[_", "'", "data", "'_", "]_", "._", "data_", "._", "shape_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroids_", "=_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "samples_", ",_", "2_", ")_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "shape_", "=_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grayscale", "_", "=_", "resiz", "e\\u", "by", "\\u", "factor_", "(_", "grayscale", "_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "shape_", "=_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "st", "0_", "=_", "(_", "size_", "-_", "raw", "\\u", "shape_", "[_", "0_", "]_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "0_", "=_", "st", "0_", "+_", "raw", "\\u", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "(_", "size_", "-_", "raw", "\\u", "shape_", "[_", "1_", "]_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "1_", "=_", "st1", "_", "+_", "raw", "\\u", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grayscale", "_", "=_", "image_", "._", "center", "\\u", "crop", "\\u", "reflect", "_", "(_", "grayscale", "_", ",_", "(_", "size_", ",_", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "bgr", " ", "=", " ", "raw", "\\u", "img", ".", "transpose", "(", "2", ",", " ", "0", ",", " ", "1", ")[", "np", ".", "newa", "xis", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", " ", "=", " ", "bgr", ".", "mean", "(", "1", ",", " ", "keep", "dims", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "grayscale", "_", "[_", "np_", "._", "newaxis_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "data", "'_", ",_", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "raw", "\\u", "img_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "size_", "=_", "size_", "//_", "HO", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "shape_", "=_", "tuple_", "(_", "[_", "shi", "_", "//_", "HO", "LE_", "for_", "shi", "_", "in_", "raw", "\\u", "shape_", "[_", ":_", "2_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "scale", "d\\u", "chs", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "scale", "d\\u", "a", " ", "=", " ", "np", ".", "zero", "s", "(", "scale", "d\\u", "shape", " ", "+", " ", "(", "1", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "scale", "d\\u", "b", " ", "=", " ", "np", ".", "zero", "s", "(", "scale", "d\\u", "shape", " ", "+", " ", "(", "1", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "ds_", "=_", "[_", "None_", "]_", "*_", "len_", "(_", "chs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "ii_", ",_", "img", "\\u", "jj_", "=_", "np_", "._", "meshgrid_", "(_", "range_", "(_", "scale", "d\\u", "shape_", "[_", "0_", "]_", ")_", ",_", "range_", "(_", "scale", "d\\u", "shape_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ii_", "=_", "HO", "LE_", "//_", "2_", "+_", "st", "0_", "+_", "img", "\\u", "ii_", "*_", "HO", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jj_", "=_", "HO", "LE_", "//_", "2_", "+_", "st1", "_", "+_", "img", "\\u", "jj_", "*_", "HO", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "indices_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "ii_", "._", "size_", ",_", "samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chunk_", "in_", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "\\u", "slice_", "=_", "np_", "._", "s\\u_", "[_", "chunk_", ":_", "chunk_", "+_", "samples_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "\\u_", "=_", "ii_", "._", "ravel_", "(_", ")_", "[_", "chunk", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jj", "\\u_", "=_", "jj_", "._", "ravel_", "(_", ")_", "[_", "chunk", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroids_", "[_", "0_", ",_", ":_", "len_", "(_", "ii", "\\u_", ")_", ",_", "0_", "]_", "=_", "ii", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroids_", "[_", "0_", ",_", ":_", "len_", "(_", "jj", "\\u_", ")_", ",_", "1_", "]_", "=_", "jj", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "classifier_", "._", "forward_", "(_", "data_", "=_", "grayscale", "_", ",_", "centroids_", "=_", "centroids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ii", "\\u_", "=_", "img", "\\u", "ii_", "._", "ravel_", "(_", ")_", "[_", "chunk", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jj", "\\u_", "=_", "img", "\\u", "jj_", "._", "ravel_", "(_", ")_", "[_", "chunk", "\\u", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "ch_", "in_", "enumerate_", "(_", "chs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "scale", "ds_", "[_", "i_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale", "ds_", "[_", "i_", "]_", "=_", "np_", "._", "zeros_", "(_", "scale", "d\\u", "shape_", "+_", "(_", "ret_", "[_", "chs", "_", "[_", "i_", "]_", "]_", "._", "shape_", "[_", "-_", "1_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale", "ds_", "[_", "i_", "]_", "[_", "ii", "\\u_", ",_", "jj", "\\u_", "]_", "=_", "ret_", "[_", "ch_", "]_", "[_", ":_", "len_", "(_", "ii", "\\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_", "scale", "d\\u", "combined_", "=_", "np_", "._", "concatenate_", "(_", "scale", "ds_", ",_", "axis_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "combined_", "=_", "resiz", "e\\u", "by", "\\u", "factor_", "(_", "scale", "d\\u", "combined_", ",_", "HO", "LE_", "/_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "combined_", "=_", "image_", "._", "center", "\\u", "crop_", "(_", "full", "\\u", "combined_", ",_", "img_", "._", "shape_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "full", "\\u", "combined_", "._", "shape_", "[_", ":_", "2_", "]_", "==_", "img_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "combined_", "=_", "full", "\\u", "combined_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "ch_", "in_", "enumerate_", "(_", "chs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "=_", "scale", "ds_", "[_", "i_", "]_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "append_", "(_", "combined_", "[_", "..._", ",_", "cur_", ":_", "cur_", "+_", "C_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "+=_", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tuple_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract_", "(_", "classifier_", ",_", "grayscale", "_", ",_", "*_", "chs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Extract", " ", "usi", "ng", " ", "dens", "e", " ", "model", " ", "(", "faste", "r", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "classif", "ier", ":", " ", "Ca", "ffe", " ", "Classif", "ier", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "grayscale", ":", " ", "Inp", "ut", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "scale", " ", "so", " ", "tha", "t", " ", "the", " ", "long", "est", " ", "is", " ", "MAX", "\\u", "SIDE", "_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "side_", "=_", "np_", "._", "min_", "(_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "side_", "=_", "np_", "._", "max_", "(_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "min_", "(_", "MIN", "\\u", "SIDE", "_", "/_", "min", "\\u", "side_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "side_", "*_", "scale_", ">=_", "MAX", "\\u", "SIDE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "MAX", "\\u", "SIDE", "_", "/_", "max", "\\u", "side_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "HO", "LE_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "samples", " ", "=", " ", "classif", "ier", ".", "blobs", "['", "centroid", "s", "']", ".", "data", ".", "shape", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "classifier_", "._", "blobs_", "[_", "'", "data", "'_", "]_", "._", "data_", "._", "shape_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "centroid", "s", " ", "=", " ", "np", ".", "zero", "s", "((", "1", ",", " ", "samples", ",", " ", "2", "),", " ", "dt", "ype", "=", "np", ".", "float", "32", ")_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "shape_", "=_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "grayscale", "_", "=_", "grayscale", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scale_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grayscale", "_", "=_", "resiz", "e\\u", "by", "\\u", "factor_", "(_", "grayscale", "_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raw", "\\u", "shape_", "=_", "grayscale", "_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "st", "0_", "=_", "(_", "size_", "-_", "raw", "\\u", "shape_", "[_", "0_", "]_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "0_", "=_", "st", "0_", "+_", "raw", "\\u", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "(_", "size_", "-_", "raw", "\\u", "shape_", "[_", "1_", "]_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "1_", "=_", "st1", "_", "+_", "raw", "\\u", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "raw", "\\u", "img", " ", "=", " ", "image", ".", "center", "\\u", "crop", "\\u", "reflect", "(", "raw", "\\u", "img", ",", " ", "(", "size", ",", " ", "size", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "grayscale", "_", "=_", "image_", "._", "center", "\\u", "crop_", "(_", "grayscale", "_", ",_", "(_", "size_", ",_", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "bgr", " ", "=", " ", "raw", "\\u", "img", ".", "transpose", "(", "2", ",", " ", "0", ",", " ", "1", ")[", "np", ".", "newa", "xis", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "grayscale", "_", "[_", "np_", "._", "newaxis_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shape", " ", "=", " ", "grayscale", ".", "shape", "[:", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "size_", "=_", "size_", "//_", "HO", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "shape_", "=_", "tuple_", "(_", "[_", "shi", "_", "//_", "HO", "LE_", "for_", "shi", "_", "in_", "raw", "\\u", "shape_", "[_", ":_", "2_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "classifier_", "._", "forward_", "(_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "key_", ":_", "classifier_", "._", "blobs_", "[_", "key_", "]_", "._", "data_", "for_", "key_", "in_", "classifier_", "._", "blobs_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "ds_", "=_", "[_", "ret_", "[_", "'", "predicti", "on", "\\u", "h", "\\u", "full", "'_", "]_", "[_", "0_", "]_", "._", "transpose_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", ",_", "ret_", "[_", "'", "predicti", "on", "\\u", "c\\u", "full", "'_", "]_", "[_", "0_", "]_", "._", "transpose_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "d\\u", "combined_", "=_", "np_", "._", "concatenate_", "(_", "scale", "ds_", ",_", "axis_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "full", "\\u", "combin", "ed", " ", "=", " ", "resiz", "e\\u", "by", "\\u", "factor", "(", "scale", "d\\u", "combin", "ed", ",", " ", "HO", "LE", " ", "/", " ", "scale", ")_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "combined_", "=_", "resiz", "e\\u", "by", "\\u", "factor_", "(_", "scale", "d\\u", "combined_", ",_", "1_", "/_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "combined_", "=_", "image_", "._", "center", "\\u", "crop_", "(_", "full", "\\u", "combined_", ",_", "full", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "full", "\\u", "combined_", "._", "shape_", "[_", ":_", "2_", "]_", "==_", "full", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "combined_", "=_", "full", "\\u", "combined_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "ch_", "in_", "enumerate_", "(_", "chs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "=_", "scale", "ds_", "[_", "i_", "]_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "append_", "(_", "combined_", "[_", "..._", ",_", "cur_", ":_", "cur_", "+_", "C_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "+=_", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tuple_", "(_", "res_", ")_" ]
[ 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,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nfrom appvalidator.constants import JS_DEBUG\nfrom call_definitions import python_wrap\nfrom entity_values import entity\nfrom jstypes import JSGlobal, JSLiteral\n\n\n# See https://github.com/mozilla/app-validator/wiki/JS-Predefined-Entities\n# for details on entity properties.\n\n\n\nglobal_identity = {\"value\": lambda *args: GLOBAL_ENTITIES}\nREADONLY = {\"readonly\": True}\n\n\n\n\nMOZAPPS = {\n u'installPackage': feature('PACKAGED_APPS'),\n}\n\n\nNAVIGATOR = {\n u\"apps\": feature(\"APPS\", MOZAPPS),\n u\"mozApps\": feature(\"APPS\", MOZAPPS),\n u\"pay\": feature(\"PAY\"),\n u\"mozPay\": feature(\"PAY\"),\n u\"battery\": feature(\"BATTERY\"),\n u\"bluetooth\": feature(\"BLUETOOTH\"),\n u\"mozBluetooth\": feature(\"BLUETOOTH\"),\n u\"contacts\": feature(\"CONTACTS\"),\n u\"mozContacts\": feature(\"CONTACTS\"),\n u\"getDeviceStorage\": feature(\"DEVICE_STORAGE\"),\n u\"geolocation\": feature(\"GEOLOCATION\"),\n u\"getCurrentPosition\": feature(\"GEOLOCATION\"),\n u\"addIdleObserver\": feature(\"IDLE\"),\n u\"removeIdleObserver\": feature(\"IDLE\"),\n u\"connection\": feature(\"NETWORK_INFO\"),\n u\"mozConnection\": feature(\"NETWORK_INFO\"),\n u\"mozMobileConnection\": feature(\"NETWORK_INFO\"),\n u\"networkStats\": feature(\"NETWORK_STATS\"),\n u\"mozNetworkStats\": feature(\"NETWORK_STATS\"),\n u\"push\": feature(\"PUSH\"),\n u\"mozPush\": feature(\"PUSH\"),\n u\"time\": feature(\"TIME_CLOCK\"),\n u\"mozTime\": feature(\"TIME_CLOCK\"),\n u\"vibrate\": feature(\"VIBRATE\"),\n u\"FM\": feature(\"FM\"),\n u\"mozFM\": feature(\"FM\"),\n u\"mozFMRadio\": feature(\"FM\"),\n # XXX: The \"SMS\" API's capitalization seems to be inconsistent at the moment.\n u\"SMS\": feature(\"SMS\"),\n u\"mozSMS\": feature(\"SMS\"),\n u\"mozSms\": feature(\"SMS\"),\n u\"mozNotification\": feature(\"NOTIFICATION\"),\n u\"mozAlarms\": feature(\"ALARM\"),\n u\"getGamepad\": feature(\"GAMEPAD\"),\n u\"mozGetGamepad\": feature(\"GAMEPAD\"),\n u\"webkitGetGamepad\": feature(\"GAMEPAD\"),\n u\"mozTCPSocket\": feature(\"TCPSOCKET\"),\n u\"mozInputMethod\": feature(\"THIRDPARTY_KEYBOARD_SUPPORT\"),\n u\"mozMobileConnections\": feature(\"NETWORK_INFO_MULTIPLE\"),\n u\"getMobileIdAssertion\": feature(\"MOBILEID\"),\n u\"getUserMedia\": entity(\"getUserMedia\"),\n}\n\n\n# GLOBAL_ENTITIES is also representative of the `window` object.\nGLOBAL_ENTITIES = {\n u\"window\": global_identity,\n u\"null\": {\"literal\": None},\n\n u\"document\":\n {\"value\":\n {u\"defaultView\": global_identity,\n\n u\"cancelFullScreen\": feature(\"FULLSCREEN\"),\n u\"mozCancelFullScreen\": feature(\"FULLSCREEN\"),\n u\"webkitCancelFullScreen\": feature(\"FULLSCREEN\"),\n\n u\"fullScreenElement\": feature(\"FULLSCREEN\"),\n u\"mozFullScreenElement\": feature(\"FULLSCREEN\"),\n u\"webkitFullScreenElement\": feature(\"FULLSCREEN\"),\n },\n },\n\n # The nefariuos timeout brothers!\n u\"setTimeout\": entity(\"setTimeout\"),\n u\"setInterval\": entity(\"setInterval\"),\n\n u\"encodeURI\": READONLY,\n u\"decodeURI\": READONLY,\n u\"encodeURIComponent\": READONLY,\n u\"decodeURIComponent\": READONLY,\n u\"escape\": READONLY,\n u\"unescape\": READONLY,\n u\"isFinite\": READONLY,\n u\"isNaN\": READONLY,\n u\"parseFloat\": READONLY,\n u\"parseInt\": READONLY,\n\n u\"eval\": entity(\"eval\"),\n u\"Function\": entity(\"Function\"),\n u\"Object\":\n {\"value\": {u\"constructor\": {\"value\": get_global(\"Function\")}}},\n u\"String\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}},\n \"return\": call_definitions.string_global,\n \"new\": call_definitions.string_global,\n \"typeof\": \"string\"},\n u\"Array\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}},\n \"return\": call_definitions.array_global,\n \"new\": call_definitions.array_global},\n u\"Number\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")},\n u\"POSITIVE_INFINITY\": {\"literal\": float('inf')},\n u\"NEGATIVE_INFINITY\": {\"literal\": float('-inf')},\n u\"isNaN\": get_global(\"isNaN\")},\n \"return\": call_definitions.number_global,\n \"new\": call_definitions.number_global,\n \"typeof\": \"number\"},\n u\"Boolean\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}},\n \"return\": call_definitions.boolean_global,\n \"new\": call_definitions.boolean_global,\n \"typeof\": \"boolean\"},\n u\"RegExp\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}}},\n u\"Date\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}}},\n u\"File\":\n {\"value\":\n {u\"constructor\": {\"value\": get_global(\"Function\")}}},\n\n u\"Math\":\n {\"value\":\n {u\"PI\": {\"literal\": math.pi},\n u\"E\": {\"literal\": math.e},\n u\"LN2\": {\"literal\": math.log(2)},\n u\"LN10\": {\"literal\": math.log(10)},\n u\"LOG2E\": {\"literal\": math.log(math.e, 2)},\n u\"LOG10E\": {\"literal\": math.log10(math.e)},\n u\"SQRT2\": {\"literal\": math.sqrt(2)},\n u\"SQRT1_2\": {\"literal\": math.sqrt(1/2)},\n u\"abs\": {\"return\": python_wrap(abs, [(\"num\", 0)])},\n u\"acos\": {\"return\": python_wrap(math.acos, [(\"num\", 0)])},\n u\"asin\": {\"return\": python_wrap(math.asin, [(\"num\", 0)])},\n u\"atan\": {\"return\": python_wrap(math.atan, [(\"num\", 0)])},\n u\"atan2\": {\"return\": python_wrap(math.atan2, [(\"num\", 0),\n (\"num\", 1)])},\n u\"ceil\": {\"return\": python_wrap(math.ceil, [(\"num\", 0)])},\n u\"cos\": {\"return\": python_wrap(math.cos, [(\"num\", 0)])},\n u\"exp\": {\"return\": python_wrap(math.exp, [(\"num\", 0)])},\n u\"floor\": {\"return\": python_wrap(math.floor, [(\"num\", 0)])},\n u\"log\": {\"return\": call_definitions.math_log},\n u\"max\": {\"return\": python_wrap(max, [(\"num\", 0)], nargs=True)},\n u\"min\": {\"return\": python_wrap(min, [(\"num\", 0)], nargs=True)},\n u\"pow\": {\"return\": python_wrap(math.pow, [(\"num\", 0),\n (\"num\", 0)])},\n # Random always returns 0.5 in our fantasy land.\n u\"random\": {\"return\": lambda **kw: JSLiteral(0.5)},\n u\"round\": {\"return\": call_definitions.math_round},\n u\"sin\": {\"return\": python_wrap(math.sin, [(\"num\", 0)])},\n u\"sqrt\": {\"return\": python_wrap(math.sqrt, [(\"num\", 1)])},\n u\"tan\": {\"return\": python_wrap(math.tan, [(\"num\", 0)])},\n },\n },\n\n u\"XMLHttpRequest\": entity('XMLHttpRequest'),\n\n # Global properties are inherently read-only, though this formalizes it.\n u\"Infinity\": get_global(\"Number\", \"POSITIVE_INFINITY\"),\n u\"NaN\": READONLY,\n u\"undefined\": {\"readonly\": True, \"undefined\": True, \"literal\": None},\n\n u\"opener\": global_identity,\n\n u\"navigator\": {\"value\": NAVIGATOR},\n\n u\"Activity\": feature(\"ACTIVITY\"),\n u\"MozActivity\": feature(\"ACTIVITY\"),\n u\"ondevicelight\": feature(\"LIGHT_EVENTS\"),\n u\"ArchiveReader\": feature(\"ARCHIVE\"),\n u\"indexedDB\": feature(\"INDEXEDDB\"),\n u\"mozIndexedDB\": feature(\"INDEXEDDB\"),\n u\"ondeviceproximity\": feature(\"PROXIMITY\"),\n u\"ondeviceorientation\": feature(\"ORIENTATION\"),\n u\"ontouchstart\": feature(\"TOUCH\"),\n u\"Audio\": feature(\"AUDIO\"),\n u\"webkitAudioContext\": feature(\"WEBAUDIO\"),\n u\"mozAudioContext\": feature(\"WEBAUDIO\"),\n u\"AudioContext\": feature(\"WEBAUDIO\"),\n u\"persistentStorage\": feature(\"QUOTA\"),\n u\"mozPersistentStorage\": feature(\"QUOTA\"),\n u\"webkitPersistentStorage\": feature(\"QUOTA\"),\n u\"StorageInfo\": feature(\"QUOTA\"),\n u\"fullScreen\": feature(\"FULLSCREEN\"),\n\n U\"MediaStream\": feature(\"WEBRTC_MEDIA\"),\n u\"DataChannel\": feature(\"WEBRTC_DATA\"),\n\n u\"RTCPeerConnection\": feature(\"WEBRTC_PEER\"),\n u\"mozRTCPeerConnection\": feature(\"WEBRTC_PEER\"),\n u\"webkitRTCPeerConnection\": feature(\"WEBRTC_PEER\"),\n\n u\"speechSynthesis\": feature(\"SPEECH_SYN\"),\n u\"SpeechSynthesisUtterance\": feature(\"SPEECH_SYN\"),\n u\"SpeechRecognition\": feature(\"SPEECH_REC\"),\n\n u\"UDPSocket\": feature(\"UDPSOCKET\"),\n}\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def resolve_entity(traverser, *args):\n element = GLOBAL_ENTITIES[args[0]]\n for layer in args[1:]:\n value = element[\"value\"]\n while callable(value):\n value = value(t=t)\n element = value[layer]\n return element", "metadata": "root.resolve_entity", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def get_global(*args):\n return lambda trav: resolve_entity(trav, *args)", "metadata": "root.get_global", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def feature(constant, fallback=None):\n def wrap(t):\n t.log_feature(constant)\n t._debug(\"Found feature: %s\" % constant)\n if fallback:\n t._debug(\"Feature has fallback: %s\" % repr(fallback))\n return lambda *a: fallback if fallback else {}\n\n return {'value': wrap,\n 'return': lambda **kw: kw['traverser'].log_feature(constant)}", "metadata": "root.feature", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def enable_debug():\n def assert_(wrapper, arguments, traverser):\n traverser.asserts = True\n for arg in arguments:\n if not arg.get_literal_value(traverser):\n traverser.err.error(\n err_id=(\"js\", \"debug\", \"assert\"),\n error=\"`%s` expected to be truthy\" % arg,\n description=\"Assertion error\")\n\n GLOBAL_ENTITIES[u\"__assert\"] = {\"return\": assert_}\n\n def callable_(wrapper, arguments, traverser):\n traverser.asserts = True\n for arg in arguments:\n if not arg.callable:\n traverser.err.error(\n err_id=(\"js\", \"debug\", \"callable\"),\n error=\"`%s` expected to be callable\" % arg,\n description=\"Assertion error\")\n\n GLOBAL_ENTITIES[u\"__callable\"] = {\"return\": assert_}", "metadata": "root.enable_debug", "header": "['module', '___EOS___']", "index": 243 } ]
[ { "span": "from appvalidator.constants import JS_DEBUG", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 43 }, { "span": "from jstypes import JSGlobal, JSLiteral", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "call", "\\u", "definitions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "app", "validator_", "._", "constants_", "import_", "JS", "\\u", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "call", "\\u", "definitions_", "import_", "python", "\\u", "wrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "entity", "\\u", "values_", "import_", "entity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jst", "ypes_", "import_", "JS", "Global_", ",_", "JS", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "https", "://", "git", "hub", ".", "com", "/", "moz", "illa", "/", "app", "-", "validator", "/", "wiki", "/", "JS", "-", "Pred", "efin", "ed", "-", "Entities_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "deta", "il", "s", " ", "on", " ", "entity", " ", "proper", "ties", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "identity_", "=_", "{_", "\"", "value", "\"_", ":_", "lambda_", "*_", "args_", ":_", "GLOB", "AL", "\\u", "ENTI", "TIES", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "READO", "NLY", "_", "=_", "{_", "\"", "read", "only", "\"_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MO", "ZA", "PP", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "install", "Packa", "ge", "'_", ":_", "feature_", "(_", "'", "PACKAG", "ED", "\\u", "APP", "S", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NAV", "IG", "ATOR", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "apps", "\"_", ":_", "feature_", "(_", "\"", "APP", "S", "\"_", ",_", "MO", "ZA", "PP", "S_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "App", "s", "\"_", ":_", "feature_", "(_", "\"", "APP", "S", "\"_", ",_", "MO", "ZA", "PP", "S_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "pay", "\"_", ":_", "feature_", "(_", "\"", "PAY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Pay", "\"_", ":_", "feature_", "(_", "\"", "PAY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "battery", "\"_", ":_", "feature_", "(_", "\"", "BAT", "TER", "Y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "bluetooth", "\"_", ":_", "feature_", "(_", "\"", "BLUE", "TOO", "TH", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Bluetooth", "\"_", ":_", "feature_", "(_", "\"", "BLUE", "TOO", "TH", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "contact", "s", "\"_", ":_", "feature_", "(_", "\"", "CONTACT", "S", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Conta", "ct", "s", "\"_", ":_", "feature_", "(_", "\"", "CONTACT", "S", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "get", "Dev", "ice", "Stor", "age", "\"_", ":_", "feature_", "(_", "\"", "DEV", "ICE", "\\u", "STOR", "AGE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "geoloca", "tion", "\"_", ":_", "feature_", "(_", "\"", "GEO", "LOCATION", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "get", "Curr", "ent", "Position", "\"_", ":_", "feature_", "(_", "\"", "GEO", "LOCATION", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "add", "Id", "le", "Observer", "\"_", ":_", "feature_", "(_", "\"", "IDLE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "remove", "Id", "le", "Observer", "\"_", ":_", "feature_", "(_", "\"", "IDLE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "connecti", "on", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "INFO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Connect", "ion", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "INFO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Mob", "ile", "Connect", "ion", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "INFO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "network", "Stat", "s", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "STATS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Network", "Stat", "s", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "STATS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "push", "\"_", ":_", "feature_", "(_", "\"", "PUSH", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Push", "\"_", ":_", "feature_", "(_", "\"", "PUSH", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "time", "\"_", ":_", "feature_", "(_", "\"", "TIME", "\\u", "CLOCK", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Time", "\"_", ":_", "feature_", "(_", "\"", "TIME", "\\u", "CLOCK", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "vib", "rate", "\"_", ":_", "feature_", "(_", "\"", "VI", "BRA", "TE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "FM", "\"_", ":_", "feature_", "(_", "\"", "FM", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "FM", "\"_", ":_", "feature_", "(_", "\"", "FM", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "FM", "Radio", "\"_", ":_", "feature_", "(_", "\"", "FM", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "The", " ", "\"", "SMS", "\"", " ", "API", "'", "s", " ", "capitaliz", "ation", " ", "see", "ms", " ", "to", " ", "be", " ", "inconsistent", " ", "at", " ", "the", " ", "moment", "._", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "SMS", "\"_", ":_", "feature_", "(_", "\"", "SMS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "SMS", "\"_", ":_", "feature_", "(_", "\"", "SMS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Sm", "s", "\"_", ":_", "feature_", "(_", "\"", "SMS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Notifi", "cation", "\"_", ":_", "feature_", "(_", "\"", "NOTIFICATION", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Alarm", "s", "\"_", ":_", "feature_", "(_", "\"", "ALARM", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "get", "Game", "pad", "\"_", ":_", "feature_", "(_", "\"", "GAME", "PAD", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Get", "Game", "pad", "\"_", ":_", "feature_", "(_", "\"", "GAME", "PAD", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "Get", "Game", "pad", "\"_", ":_", "feature_", "(_", "\"", "GAME", "PAD", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "TC", "PS", "ocket", "\"_", ":_", "feature_", "(_", "\"", "TC", "PS", "OCK", "ET", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Inp", "ut", "Meth", "od", "\"_", ":_", "feature_", "(_", "\"", "THI", "RD", "PART", "Y", "\\u", "KEYB", "OARD", "\\u", "SUPPORT", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Mob", "ile", "Connect", "ion", "s", "\"_", ":_", "feature_", "(_", "\"", "NET", "WORK", "\\u", "INFO", "\\u", "MULTIPLE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "get", "Mob", "ile", "Id", "Assert", "ion", "\"_", ":_", "feature_", "(_", "\"", "MOB", "ILE", "ID", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "get", "User", "Media", "\"_", ":_", "entity_", "(_", "\"", "get", "User", "Media", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GLOB", "AL", "\\u", "ENTI", "TIES", " ", "is", " ", "als", "o", " ", "representative", " ", "of", " ", "the", " ", "`", "window", "`", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "GLOB", "AL", "\\u", "ENTI", "TIES", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "window", "\"_", ":_", "global", "\\u", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "null", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "document", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "default", "View", "\"_", ":_", "global", "\\u", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "cancel", "Full", "Scr", "een", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Cancel", "Full", "Scr", "een", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "Cancel", "Full", "Scr", "een", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "full", "Scr", "een", "Element", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Full", "Scr", "een", "Element", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "Full", "Scr", "een", "Element", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "nef", "ari", "uo", "s", " ", "timeo", "ut", " ", "bro", "ther", "s", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "set", "Time", "out", "\"_", ":_", "entity_", "(_", "\"", "set", "Time", "out", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "set", "Interv", "al", "\"_", ":_", "entity_", "(_", "\"", "set", "Interv", "al", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "encode", "URI", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "decode", "URI", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "encode", "URI", "Compo", "nent", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "decode", "URI", "Compo", "nent", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "escape", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "unescape", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "is", "Fini", "te", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "is", "Na", "N", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "parse", "Float", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "parse", "Int", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "eval", "\"_", ":_", "entity_", "(_", "\"", "eval", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Function", "\"_", ":_", "entity_", "(_", "\"", "Function", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Object", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "String", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "string", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\"_", ":_", "call", "\\u", "definitions_", "._", "string", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "typeof", "\"_", ":_", "\"", "string", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Array", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "array", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\"_", ":_", "call", "\\u", "definitions_", "._", "array", "\\u", "global_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Number", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "POSI", "TIVE", "\\u", "INFINIT", "Y", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "float_", "(_", "'", "inf", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "NEGAT", "IV", "E", "\\u", "INFINIT", "Y", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "float_", "(_", "'-", "inf", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "is", "Na", "N", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "is", "Na", "N", "\"_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "number", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\"_", ":_", "call", "\\u", "definitions_", "._", "number", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "typeof", "\"_", ":_", "\"", "number", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Boo", "lean", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "boolean", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "new", "\"_", ":_", "call", "\\u", "definitions_", "._", "boolean", "\\u", "global_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "typeof", "\"_", ":_", "\"", "boolean", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Reg", "Exp", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Date", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "File", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "construct", "or", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Function", "\"_", ")_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Math", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "value", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "u", "\"", "PI", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "pi_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "E", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "e_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "LN", "2", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "log_", "(_", "2_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "LN", "10", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "log_", "(_", "10_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "LOG", "2E", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "log_", "(_", "math_", "._", "e_", ",_", "2_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "LOG", "10", "E", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "log10_", "(_", "math_", "._", "e_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "SQ", "RT", "2", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "sqrt_", "(_", "2_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "SQ", "RT", "1", "\\u", "2", "\"_", ":_", "{_", "\"", "literal", "\"_", ":_", "math_", "._", "sqrt_", "(_", "1_", "/_", "2_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "abs", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "abs_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "acos", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "acos", "_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "asin", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "asin", "_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "atan", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "atan", "_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "atan", "2", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "atan2_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "num", "\"_", ",_", "1_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "ceil", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "ceil_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "cos", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "cos_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "exp", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "exp_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "floor", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "floor_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "log", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "math", "\\u", "log_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "max", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "max_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ",_", "nargs_", "=_", "True_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "min", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "min_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ",_", "nargs_", "=_", "True_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "pow", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "pow_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Random", " ", "alw", "ay", "s", " ", "return", "s", " ", "0.", "5", " ", "in", " ", "our", " ", "fantas", "y", " ", "land", "._", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "random", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "lambda_", "**_", "kw_", ":_", "JS", "Literal_", "(_", "0.5_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "round", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "call", "\\u", "definitions_", "._", "math", "\\u", "round_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "sin", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "sin_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "sqrt", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "sqrt_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "1_", ")_", "]_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "tan", "\"_", ":_", "{_", "\"", "return", "\"_", ":_", "python", "\\u", "wrap_", "(_", "math_", "._", "tan_", ",_", "[_", "(_", "\"", "num", "\"_", ",_", "0_", ")_", "]_", ")_", "}_", ",_", "\\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", "\"", "XML", "Http", "Request", "\"_", ":_", "entity_", "(_", "'", "XML", "Http", "Request", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Global", " ", "proper", "ties", " ", "are", " ", "inh", "eren", "tl", "y", " ", "read", "-", "only", ",", " ", "tho", "ugh", " ", "this", " ", "formal", "izes", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Infinit", "y", "\"_", ":_", "get", "\\u", "global_", "(_", "\"", "Number", "\"_", ",_", "\"", "POSI", "TIVE", "\\u", "INFINIT", "Y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Na", "N", "\"_", ":_", "READO", "NLY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "undefined", "\"_", ":_", "{_", "\"", "read", "only", "\"_", ":_", "True_", ",_", "\"", "undefined", "\"_", ":_", "True_", ",_", "\"", "literal", "\"_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "opene", "r", "\"_", ":_", "global", "\\u", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "navigator", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "NAV", "IG", "ATOR", "_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Activ", "it", "y", "\"_", ":_", "feature_", "(_", "\"", "ACTIVITY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Mo", "z", "Activ", "it", "y", "\"_", ":_", "feature_", "(_", "\"", "ACTIVITY", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "onde", "vice", "light", "\"_", ":_", "feature_", "(_", "\"", "LIGHT", "\\u", "EVENTS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Archive", "Read", "er", "\"_", ":_", "feature_", "(_", "\"", "ARCHIVE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "indexe", "d", "DB", "\"_", ":_", "feature_", "(_", "\"", "INDE", "XE", "DD", "B", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Indexe", "d", "DB", "\"_", ":_", "feature_", "(_", "\"", "INDE", "XE", "DD", "B", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "onde", "vice", "proxim", "it", "y", "\"_", ":_", "feature_", "(_", "\"", "PROX", "IM", "IT", "Y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "onde", "vice", "orientation", "\"_", ":_", "feature_", "(_", "\"", "ORIE", "NTA", "TIO", "N", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "onto", "uch", "start", "\"_", ":_", "feature_", "(_", "\"", "TOU", "CH", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Audi", "o", "\"_", ":_", "feature_", "(_", "\"", "AUDIO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "Audi", "o", "Context", "\"_", ":_", "feature_", "(_", "\"", "WEB", "AUDIO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Audi", "o", "Context", "\"_", ":_", "feature_", "(_", "\"", "WEB", "AUDIO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Audi", "o", "Context", "\"_", ":_", "feature_", "(_", "\"", "WEB", "AUDIO", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "persiste", "nt", "Stor", "age", "\"_", ":_", "feature_", "(_", "\"", "QUOTA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "Persisten", "t", "Stor", "age", "\"_", ":_", "feature_", "(_", "\"", "QUOTA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "Persisten", "t", "Stor", "age", "\"_", ":_", "feature_", "(_", "\"", "QUOTA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Stor", "age", "Info", "\"_", ":_", "feature_", "(_", "\"", "QUOTA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "full", "Scr", "een", "\"_", ":_", "feature_", "(_", "\"", "FULL", "SCREEN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "U", "\"", "Media", "Stream", "\"_", ":_", "feature_", "(_", "\"", "WEB", "RTC", "\\u", "MEDIA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Data", "Chan", "nel", "\"_", ":_", "feature_", "(_", "\"", "WEB", "RTC", "\\u", "DATA", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "RTC", "Peer", "Connect", "ion", "\"_", ":_", "feature_", "(_", "\"", "WEB", "RTC", "\\u", "PEER", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "moz", "RTC", "Peer", "Connect", "ion", "\"_", ":_", "feature_", "(_", "\"", "WEB", "RTC", "\\u", "PEER", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "webkit", "RTC", "Peer", "Connect", "ion", "\"_", ":_", "feature_", "(_", "\"", "WEB", "RTC", "\\u", "PEER", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "spe", "ech", "Synthe", "sis", "\"_", ":_", "feature_", "(_", "\"", "SPE", "EC", "H", "\\u", "SYN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Spee", "ch", "Synthe", "sis", "Ut", "tera", "nce", "\"_", ":_", "feature_", "(_", "\"", "SPE", "EC", "H", "\\u", "SYN", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Spee", "ch", "Reco", "gni", "tion", "\"_", ":_", "feature_", "(_", "\"", "SPE", "EC", "H", "\\u", "REC", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "UD", "PS", "ocket", "\"_", ":_", "feature_", "(_", "\"", "UD", "PS", "OCK", "ET", "\"_", ")_", ",_", "\\u\\u\\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_", "resolve", "\\u", "entity_", "(_", "traverse", "r_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "element_", "=_", "GLOB", "AL", "\\u", "ENTI", "TIES", "_", "[_", "args_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "layer_", "in_", "args_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "element_", "[_", "\"", "value", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "callable_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "(_", "t_", "=_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "element_", "=_", "value_", "[_", "layer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "global_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "trav", "_", ":_", "resolve", "\\u", "entity_", "(_", "trav", "_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "feature_", "(_", "constant_", ",_", "fallback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrap_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "log", "\\u", "feature_", "(_", "constant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "\\u", "debug_", "(_", "\"", "Foun", "d", " ", "feature", ":", " ", "%", "s", "\"_", "%_", "constant_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fallback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "\\u", "debug_", "(_", "\"", "Feature", " ", "has", " ", "fall", "back", ":", " ", "%", "s", "\"_", "%_", "repr_", "(_", "fallback_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lambda_", "*_", "a_", ":_", "fallback_", "if_", "fallback_", "else_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "value", "'_", ":_", "wrap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "'_", ":_", "lambda_", "**_", "kw_", ":_", "kw_", "[_", "'", "traverse", "r", "'_", "]_", "._", "log", "\\u", "feature_", "(_", "constant_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "enable", "\\u", "debug_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert\\u_", "(_", "wrapper_", ",_", "arguments_", ",_", "traverse", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traverse", "r_", "._", "asserts", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "arg_", "._", "get", "\\u", "literal", "\\u", "value_", "(_", "traverse", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traverse", "r_", "._", "err_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "id_", "=_", "(_", "\"", "js", "\"_", ",_", "\"", "debug", "\"_", ",_", "\"", "assert", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "\"`", "%", "s", "`", " ", "expected", " ", "to", " ", "be", " ", "truth", "y", "\"_", "%_", "arg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Assert", "ion", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "GLOB", "AL", "\\u", "ENTI", "TIES", "_", "[_", "u", "\"\\u\\u", "assert", "\"_", "]_", "=_", "{_", "\"", "return", "\"_", ":_", "assert\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "callable\\u", "_", "(_", "wrapper_", ",_", "arguments_", ",_", "traverse", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traverse", "r_", "._", "asserts", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "arg_", "._", "callable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traverse", "r_", "._", "err_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "id_", "=_", "(_", "\"", "js", "\"_", ",_", "\"", "debug", "\"_", ",_", "\"", "calla", "ble", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "\"`", "%", "s", "`", " ", "expected", " ", "to", " ", "be", " ", "calla", "ble", "\"_", "%_", "arg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Assert", "ion", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uD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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
sunlightlabs/read_FEC/fecreader/formdata/management/commands/mark_superceded_body_rows.py
[ { "content": " def handle(self, *args, **options):\n logger=fec_logger()\n \n filings_to_process = new_filing.objects.filter(previous_amendments_processed=True,header_is_processed=True, data_is_processed=True, body_rows_superceded=False).order_by('filing_number')\n \n for this_filing in filings_to_process:\n print \"processing %s \" % (this_filing.filing_number)\n \n \n # Create summary data for some forms that don't have it in the header. This script only runs after all the body rows of these filings have been entered; most other summary data is entered earlier in the process. \n if this_filing.form_type.upper() in ['F24', 'F24A', 'F24N']:\n summarize_f24(this_filing)\n elif this_filing.form_type.upper() in ['F6', 'F6A', 'F6N']:\n summarize_f6(this_filing)\n \n\n elif this_filing.form_type.startswith('F5') and not this_filing.is_f5_quarterly:\n summarize_nonquarterly_f5(this_filing)\n \n elif this_filing.form_type.startswith('F5') and this_filing.is_f5_quarterly:\n mark_superceded_F57s(this_filing)\n \n # if it's got sked E's and it's an F3X, overwrite 24 hr report\n elif this_filing.form_type.startswith('F3'): \n try:\n this_filing.lines_present['E']\n mark_superceded_F24s(this_filing)\n except KeyError:\n pass\n\n\n try:\n this_filing.lines_present['A']\n mark_superceded_F65s(this_filing)\n except KeyError:\n pass\n \n # By now we should have dates for all filings, including the ones that don't start with a coverage from date\n # that we added by finding the first transaction date, so we can safely set the cycle. \n if not this_filing.cycle:\n # we're about to save it, so don't hit the db twice.\n this_filing.set_cycle(save_now=False)\n \n this_filing.body_rows_superceded = True\n this_filing.save()", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 99 } ]
[ { "span": "logger=", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "fec", "\\u", "logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filing", "s", "\\u", "to", "\\u", "process_", "=_", "new", "\\u", "filing", "_", "._", "objects_", "._", "filter_", "(_", "previ", "ous", "\\u", "amend", "ment", "s", "\\u", "processed_", "=_", "True_", ",_", "header", "\\u", "is", "\\u", "processed_", "=_", "True_", ",_", "data\\u", "is", "\\u", "processed_", "=_", "True_", ",_", "body", "\\u", "rows", "\\u", "superc", "eded", "_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "filing", "\\u", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "this", "\\u", "filing", "_", "in_", "filing", "s", "\\u", "to", "\\u", "process_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "process", "ing", " ", "%", "s", " ", "\"_", "%_", "(_", "this", "\\u", "filing", "_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "summar", "y", " ", "data", " ", "for", " ", "some", " ", "forms", " ", "tha", "t", " ", "don", "'", "t", " ", "have", " ", "it", " ", "in", " ", "the", " ", "header", ".", " ", "Thi", "s", " ", "script", " ", "only", " ", "runs", " ", "after", " ", "all", " ", "the", " ", "body", " ", "rows", " ", "of", " ", "these", " ", "filing", "s", " ", "have", " ", "bee", "n", " ", "enter", "ed", ";", " ", "most", " ", "other", " ", "summar", "y", " ", "data", " ", "is", " ", "enter", "ed", " ", "ear", "lie", "r", " ", "in", " ", "the", " ", "process", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "upper_", "(_", ")_", "in_", "[_", "'", "F2", "4", "'_", ",_", "'", "F2", "4", "A", "'_", ",_", "'", "F2", "4", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "f2", "4_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "upper_", "(_", ")_", "in_", "[_", "'", "F6", "'_", ",_", "'", "F6", "A", "'_", ",_", "'", "F6", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "f6", "_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F5", "'_", ")_", "and_", "not_", "this", "\\u", "filing", "_", "._", "is", "\\u", "f5", "\\u", "quarter", "ly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "non", "quarter", "ly", "\\u", "f5_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F5", "'_", ")_", "and_", "this", "\\u", "filing", "_", "._", "is", "\\u", "f5", "\\u", "quarter", "ly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark", "\\u", "superc", "eded", "\\u", "F5", "7", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "it", "'", "s", " ", "got", " ", "ske", "d", " ", "E", "'", "s", " ", "and", " ", "it", "'", "s", " ", "an", " ", "F3", "X", ",", " ", "overwrit", "e", " ", "24", " ", "hr", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F3", "'_", ")_", ":_", "\\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 ", " ", "_", "this", "\\u", "filing", "_", "._", "lines", "\\u", "present_", "[_", "'", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "superc", "eded", "\\u", "F2", "4", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " ", "_", "this", "\\u", "filing", "_", "._", "lines", "\\u", "present_", "[_", "'", "A", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "superc", "eded", "\\u", "F6", "5", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "now", " ", "we", " ", "shou", "ld", " ", "have", " ", "dates", " ", "for", " ", "all", " ", "filing", "s", ",", " ", "inclu", "ding", " ", "the", " ", "ones", " ", "tha", "t", " ", "don", "'", "t", " ", "start", " ", "with", " ", "a", " ", "covera", "ge", " ", "from", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "we", " ", "adde", "d", " ", "by", " ", "finding", " ", "the", " ", "first", " ", "transaction", " ", "date", ",", " ", "so", " ", "we", " ", "can", " ", "safe", "ly", " ", "set", " ", "the", " ", "cycle", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "this", "\\u", "filing", "_", "._", "cycle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "abo", "ut", " ", "to", " ", "save", " ", "it", ",", " ", "so", " ", "don", "'", "t", " ", "hit", " ", "the", " ", "db", " ", "twi", "ce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "filing", "_", "._", "set\\u", "cycle_", "(_", "save", "\\u", "now_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "this", "\\u", "filing", "_", "._", "body", "\\u", "rows", "\\u", "superc", "eded", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "filing", "_", "._", "save_", "(_", ")_" ]
[ 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 ]
Unused import
swordapp/python-client-sword2/sword2/compatible_libs.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProvides the module with access to certain libraries that have more than one suitable implementation, in a optimally\ndegredating manner.\n\nProvides - `etree` and `json`\n\n`etree` can be from any of the following, if found in the local environment:\n `lxml`\n `xml.etree`\n `elementtree`\n `cElementTree`\n\n`json` can be from any of the following:\n `json` (python >= 2.6)\n `simplejson`\n \nIf no suitable library is found, then it will pass back `None`\n\"\"\"\n\nfrom sword2_logging import logging \n\ncl_l = logging.getLogger(__name__)\n\ntry:\n from lxml import etree\nexcept ImportError:\n try:\n # Python >= 2.5\n from xml.etree import ElementTree as etree\n except ImportError:\n try:\n from elementtree import ElementTree as etree\n except ImportError:\n try:\n import cElementTree as etree\n except ImportError:\n cl_l.error(\"Couldn't find a suitable ElementTree library to use in this environment.\")\n etree = None\n\ntry:\n import json\nexcept ImportError:\n try:\n import simplejson as json\n except ImportError:\n cl_l.error(\"Couldn't find a suitable simplejson-like library to use to serialise JSON\")\n json = None\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from lxml import etree", "start_line": 27, "start_column": 4, "end_line": 27, "end_column": 26 }, { "span": "from xml.etree import ElementTree as etree", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 50 }, { "span": "from elementtree import ElementTree as etree", "start_line": 34, "start_column": 12, "end_line": 34, "end_column": 56 }, { "span": "import cElementTree as etree", "start_line": 37, "start_column": 16, "end_line": 37, "end_column": 44 }, { "span": "import json", "start_line": 43, "start_column": 4, "end_line": 43, "end_column": 15 }, { "span": "import simplejson as json", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prov", "ides", " ", "the", " ", "module", " ", "with", " ", "access", " ", "to", " ", "cert", "ain", " ", "librar", "ies", " ", "tha", "t", " ", "have", " ", "more", " ", "than", " ", "one", " ", "suit", "able", " ", "implementation", ",", " ", "in", " ", "a", " ", "optim", "ally", "\\", "10", ";", "degr", "edat", "ing", " ", "manner", ".", "\\", "10", ";", "\\", "10", ";", "Prov", "ides", " ", "-", " ", "`", "etree", "`", " ", "and", " ", "`", "json", "`", "\\", "10", ";", "\\", "10", ";", "`", "etree", "`", " ", "can", " ", "be", " ", "from", " ", "any", " ", "of", " ", "the", " ", "follow", "ing", ",", " ", "if", " ", "found", " ", "in", " ", "the", " ", "local", " ", "environ", "ment", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "lx", "ml", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "xml", ".", "etree", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "element", "tree", "`", "\\", "10", ";", " ", " ", " ", " ", "`", "c", "Element", "Tree", "`", "\\", "10", ";", "\\", "10", ";", "`", "json", "`", " ", "can", " ", "be", " ", "from", " ", "any", " ", "of", " ", "the", " ", "follow", "ing", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "json", "`", " ", "(", "python", " ", ">=", " ", "2.6", ")", "\\", "10", ";", " ", " ", " ", " ", "`", "simple", "json", "`", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "If", " ", "no", " ", "suit", "able", " ", "librar", "y", " ", "is", " ", "found", ",", " ", "then", " ", "it", " ", "will", " ", "pass", " ", "back", " ", "`", "Non", "e", "`", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sword", "2", "\\u", "logging_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cl", "\\u", "l_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", ">=", " ", "2.5_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "xml_", "._", "etree_", "import_", "Element", "Tree_", "as_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "element", "tree_", "import_", "Element", "Tree_", "as_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Element", "Tree_", "as_", "etree_", "\\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 ", " _", "cl", "\\u", "l_", "._", "error_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "find", " ", "a", " ", "suit", "able", " ", "Element", "Tree", " ", "librar", "y", " ", "to", " ", "use", " ", "in", " ", "this", " ", "environ", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\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 ", " _", "cl", "\\u", "l_", "._", "error_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "find", " ", "a", " ", "suit", "able", " ", "simple", "json", "-", "like", " ", "librar", "y", " ", "to", " ", "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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
enthought/traitsui/traitsui/wx/range_editor.py
[ { "content": " def update_editor ( self ):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n value = self.value\n try:\n text = self.format % value\n 1 / (self.low <= value <= self.high)\n except:\n text = ''\n value = self.low\n\n ivalue = self._convert_to_slider( value )\n self.control.text.SetValue( text )\n self.control.slider.SetValue( ivalue )", "metadata": "root.SimpleSliderEditor.update_editor", "header": "['class', 'SimpleSliderEditor', '(', 'BaseRangeEditor', ')', ':', '___EOS___']", "index": 262 }, { "content": " def init ( self, parent ):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n factory = self.factory\n\n # Initialize using the factory range defaults:\n self.low = factory.low\n self.high = factory.high\n self.evaluate = factory.evaluate\n\n # Hook up the traits to listen to the object.\n self.sync_value( factory.low_name, 'low', 'from' )\n self.sync_value( factory.high_name, 'high', 'from' )\n self.sync_value( factory.evaluate_name, 'evaluate', 'from' )\n\n self.init_range()\n low = self.cur_low\n high = self.cur_high\n\n self._set_format()\n self.control = panel = TraitsUIPanel( parent, -1 )\n sizer = wx.BoxSizer( wx.HORIZONTAL )\n fvalue = self.value\n try:\n fvalue_text = self._format % fvalue\n 1 / (low <= fvalue <= high)\n except:\n fvalue_text = ''\n fvalue = low\n\n if high > low:\n ivalue = int( (float( fvalue - low ) / (high - low)) * 10000 )\n else:\n ivalue = low\n\n # Lower limit label:\n label_lo = wx.StaticText( panel, -1, '999999' )\n panel.label_lo = label_lo\n sizer.Add( label_lo, 2, wx.ALIGN_CENTER )\n\n # Lower limit button:\n bmp = wx.ArtProvider.GetBitmap( wx.ART_GO_BACK,\n size = ( 15, 15 ) )\n button_lo = wx.BitmapButton( panel, -1, bitmap = bmp, size = ( -1, 20 ),\n style = wx.BU_EXACTFIT | wx.NO_BORDER )\n panel.button_lo = button_lo\n button_lo.Bind( wx.EVT_BUTTON, self.reduce_range, button_lo )\n sizer.Add( button_lo, 1, wx.ALIGN_CENTER )\n\n # Slider:\n panel.slider = slider = Slider( panel, -1, ivalue, 0, 10000,\n size = wx.Size( 80, 20 ),\n style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS )\n slider.SetTickFreq( 1000, 1 )\n slider.SetPageSize( 1000 )\n slider.SetLineSize( 100 )\n wx.EVT_SCROLL( slider, self.update_object_on_scroll )\n sizer.Add( slider, 6, wx.EXPAND )\n\n # Upper limit button:\n bmp = wx.ArtProvider.GetBitmap( wx.ART_GO_FORWARD,\n size = ( 15, 15 ) )\n button_hi = wx.BitmapButton( panel, -1, bitmap = bmp, size = ( -1, 20 ),\n style = wx.BU_EXACTFIT | wx.NO_BORDER )\n panel.button_hi = button_hi\n button_hi.Bind( wx.EVT_BUTTON, self.increase_range, button_hi )\n sizer.Add( button_hi, 1, wx.ALIGN_CENTER )\n\n # Upper limit label:\n label_hi = wx.StaticText( panel, -1, '999999' )\n panel.label_hi = label_hi\n sizer.Add( label_hi, 2, wx.ALIGN_CENTER )\n\n # Text entry:\n panel.text = text = wx.TextCtrl( panel, -1, fvalue_text,\n size = wx.Size( 56, 20 ),\n style = wx.TE_PROCESS_ENTER )\n wx.EVT_TEXT_ENTER( panel, text.GetId(), self.update_object_on_enter )\n wx.EVT_KILL_FOCUS( text, self.update_object_on_enter )\n\n sizer.Add( text, 0, wx.LEFT | wx.EXPAND, 4 )\n\n # Set-up the layout:\n panel.SetSizerAndFit( sizer )\n label_lo.SetLabel( str(low) )\n label_hi.SetLabel( str(high) )\n self.set_tooltip( slider )\n self.set_tooltip( label_lo )\n self.set_tooltip( label_hi )\n self.set_tooltip( text )\n\n # Update the ranges and button just in case.\n self.update_range_ui()", "metadata": "root.LargeRangeSliderEditor.init", "header": "['class', 'LargeRangeSliderEditor', '(', 'BaseRangeEditor', ')', ':', '___EOS___']", "index": 396 }, { "content": " def update_editor ( self ):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n value = self.value\n low = self.low\n high = self.high\n try:\n text = self._format % value\n 1 / (low <= value <= high)\n except:\n value = low\n self.value = value\n\n if not self.ui_changing:\n self.init_range()\n self.update_range_ui()", "metadata": "root.LargeRangeSliderEditor.update_editor", "header": "['class', 'LargeRangeSliderEditor', '(', 'BaseRangeEditor', ')', ':', '___EOS___']", "index": 573 }, { "content": " def update_editor ( self ):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n if not self._locked:\n try:\n self.control.SetValue( int( self.value ) )\n except:\n pass", "metadata": "root.SimpleSpinEditor.update_editor", "header": "['class', 'SimpleSpinEditor', '(', 'BaseRangeEditor', ')', ':', '___EOS___']", "index": 789 } ]
[ { "span": "except:", "start_line": 270, "start_column": 8, "end_line": 270, "end_column": 15 }, { "span": "except:", "start_line": 423, "start_column": 8, "end_line": 423, "end_column": 15 }, { "span": "except:", "start_line": 583, "start_column": 8, "end_line": 583, "end_column": 15 }, { "span": "except:", "start_line": 796, "start_column": 12, "end_line": 796, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Simple", "Slide", "r", "Editor_", "(_", "Base", "Range", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Update", "s", " ", "the", " ", "editor", " ", "whe", "n", " ", "the", " ", "object", " ", "tra", "it", " ", "change", "s", " ", "external", "ly", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "editor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "self_", "._", "format_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "1_", "/_", "(_", "self_", "._", "low_", "<=_", "value_", "<=_", "self_", "._", "high_", ")_", "\\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 ", " _", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ival", "ue_", "=_", "self_", "._", "\\u", "convert", "\\u", "to", "\\u", "slider_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "text_", "._", "Set", "Value_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "slider_", "._", "Set", "Value_", "(_", "ival", "ue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Large", "Range", "Slide", "r", "Editor_", "(_", "Base", "Range", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "usi", "ng", " ", "the", " ", "factor", "y", " ", "range", " ", "default", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "low_", "=_", "factory_", "._", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "high_", "=_", "factory_", "._", "high_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "evaluate_", "=_", "factory_", "._", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hook", " ", "up", " ", "the", " ", "traits", " ", "to", " ", "listen", " ", "to", " ", "the", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "low", "\\u", "name_", ",_", "'", "low", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "high", "\\u", "name_", ",_", "'", "high", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "evaluate", "\\u", "name_", ",_", "'", "evaluate", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "init", "\\u", "range_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "low_", "=_", "self_", "._", "cur", "\\u", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high_", "=_", "self_", "._", "cur", "\\u", "high_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "format_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "=_", "panel_", "=_", "Trait", "s", "UI", "Panel_", "(_", "parent_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "=_", "wx_", "._", "Box", "Sizer_", "(_", "wx_", "._", "HORIZONTAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fval", "ue_", "=_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fval", "ue", "\\u", "text_", "=_", "self_", "._", "\\u", "format_", "%_", "fval", "ue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "1_", "/_", "(_", "low_", "<=_", "fval", "ue_", "<=_", "high_", ")_", "\\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 ", " _", "fval", "ue", "\\u", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fval", "ue_", "=_", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "high_", ">_", "low_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ival", "ue_", "=_", "int_", "(_", "(_", "float_", "(_", "fval", "ue_", "-_", "low_", ")_", "/_", "(_", "high_", "-_", "low_", ")_", ")_", "*_", "10000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ival", "ue_", "=_", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lower", " ", "limit", " ", "label", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "lo_", "=_", "wx_", "._", "Static", "Text_", "(_", "panel_", ",_", "-_", "1_", ",_", "'", "999999", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "label", "\\u", "lo_", "=_", "label", "\\u", "lo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "label", "\\u", "lo_", ",_", "2_", ",_", "wx_", "._", "ALIGN", "\\u", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lower", " ", "limit", " ", "button", ":_", "\\u\\u\\uNL\\u\\u\\u_", "bmp_", "=_", "wx_", "._", "Art", "Provider_", "._", "Get", "Bitmap_", "(_", "wx_", "._", "ART", "\\u", "GO", "\\u", "BACK_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "(_", "15_", ",_", "15_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "lo_", "=_", "wx_", "._", "Bit", "map", "Button_", "(_", "panel_", ",_", "-_", "1_", ",_", "bitmap_", "=_", "bmp_", ",_", "size_", "=_", "(_", "-_", "1_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "wx_", "._", "BU", "\\u", "EX", "ACT", "FIT", "_", "|_", "wx_", "._", "NO", "\\u", "BORDER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "button", "\\u", "lo_", "=_", "button", "\\u", "lo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "lo_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "BUTTON_", ",_", "self_", "._", "reduce", "\\u", "range_", ",_", "button", "\\u", "lo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "button", "\\u", "lo_", ",_", "1_", ",_", "wx_", "._", "ALIGN", "\\u", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Slide", "r", ":_", "\\u\\u\\uNL\\u\\u\\u_", "panel_", "._", "slider_", "=_", "slider_", "=_", "Slider_", "(_", "panel_", ",_", "-_", "1_", ",_", "ival", "ue_", ",_", "0_", ",_", "10000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "wx_", "._", "Size_", "(_", "80_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "wx_", "._", "SL", "\\u", "HORIZONTAL_", "|_", "wx_", "._", "SL", "\\u", "AUTO", "TICK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slider_", "._", "Set", "Tic", "k", "Freq_", "(_", "1000_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slider_", "._", "Set", "Page", "Size_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slider_", "._", "Set", "Line", "Size_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "EV", "T", "\\u", "SCROLL", "_", "(_", "slider_", ",_", "self_", "._", "update", "\\u", "object\\u", "on", "\\u", "scroll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "slider_", ",_", "6_", ",_", "wx_", "._", "EXPAND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Upp", "er", " ", "limit", " ", "button", ":_", "\\u\\u\\uNL\\u\\u\\u_", "bmp_", "=_", "wx_", "._", "Art", "Provider_", "._", "Get", "Bitmap_", "(_", "wx_", "._", "ART", "\\u", "GO", "\\u", "FORWARD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "(_", "15_", ",_", "15_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "hi_", "=_", "wx_", "._", "Bit", "map", "Button_", "(_", "panel_", ",_", "-_", "1_", ",_", "bitmap_", "=_", "bmp_", ",_", "size_", "=_", "(_", "-_", "1_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "wx_", "._", "BU", "\\u", "EX", "ACT", "FIT", "_", "|_", "wx_", "._", "NO", "\\u", "BORDER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "button", "\\u", "hi_", "=_", "button", "\\u", "hi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button", "\\u", "hi_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "BUTTON_", ",_", "self_", "._", "increase", "\\u", "range_", ",_", "button", "\\u", "hi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "button", "\\u", "hi_", ",_", "1_", ",_", "wx_", "._", "ALIGN", "\\u", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Upp", "er", " ", "limit", " ", "label", ":_", "\\u\\u\\uNL\\u\\u\\u_", "label", "\\u", "hi_", "=_", "wx_", "._", "Static", "Text_", "(_", "panel_", ",_", "-_", "1_", ",_", "'", "999999", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panel_", "._", "label", "\\u", "hi_", "=_", "label", "\\u", "hi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "label", "\\u", "hi_", ",_", "2_", ",_", "wx_", "._", "ALIGN", "\\u", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Text", " ", "entry", ":_", "\\u\\u\\uNL\\u\\u\\u_", "panel_", "._", "text_", "=_", "text_", "=_", "wx_", "._", "Text", "Ctrl_", "(_", "panel_", ",_", "-_", "1_", ",_", "fval", "ue", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "wx_", "._", "Size_", "(_", "56_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "wx_", "._", "TE", "\\u", "PROCESS", "\\u", "ENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "EV", "T", "\\u", "TEXT", "\\u", "ENTER_", "(_", "panel_", ",_", "text_", "._", "Get", "Id_", "(_", ")_", ",_", "self_", "._", "update", "\\u", "object\\u", "on", "\\u", "enter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wx_", "._", "EV", "T", "\\u", "KILL", "\\u", "FOC", "US_", "(_", "text_", ",_", "self_", "._", "update", "\\u", "object\\u", "on", "\\u", "enter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "text_", ",_", "0_", ",_", "wx_", "._", "LEFT_", "|_", "wx_", "._", "EXPAND_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "-", "up", " ", "the", " ", "layout", ":_", "\\u\\u\\uNL\\u\\u\\u_", "panel_", "._", "Set", "Sizer", "And", "Fit_", "(_", "sizer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "lo_", "._", "Set", "Label_", "(_", "str_", "(_", "low_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "hi_", "._", "Set", "Label_", "(_", "str_", "(_", "high_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", "slider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", "label", "\\u", "lo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", "label", "\\u", "hi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "ranges", " ", "and", " ", "button", " ", "just", " ", "in", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "range", "\\u", "ui_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Large", "Range", "Slide", "r", "Editor_", "(_", "Base", "Range", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Update", "s", " ", "the", " ", "editor", " ", "whe", "n", " ", "the", " ", "object", " ", "tra", "it", " ", "change", "s", " ", "external", "ly", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "editor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "low_", "=_", "self_", "._", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high_", "=_", "self_", "._", "high_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "self_", "._", "\\u", "format_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "1_", "/_", "(_", "low_", "<=_", "value_", "<=_", "high_", ")_", "\\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 ", " _", "value_", "=_", "low_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "ui", "\\u", "chang", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "range_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "range", "\\u", "ui_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Spin", "Editor_", "(_", "Base", "Range", "Editor_", ")_", ":_", "\\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", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Update", "s", " ", "the", " ", "editor", " ", "whe", "n", " ", "the", " ", "object", " ", "tra", "it", " ", "change", "s", " ", "external", "ly", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "editor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "locked_", ":_", "\\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_", "._", "control_", "._", "Set", "Value_", "(_", "int_", "(_", "self_", "._", "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 ", " _", "pass_", "\\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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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, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
openworm/PyOpenWorm/examples/add_reference.py
[ { "content": "\"\"\"\nHow to reference supporting evidence for some object in the database.\n\nSee: \"Metadata in PyOpenWorm\" for discussion on semantics of what giving\nevidence for an object means.\n\"\"\"\n\nimport sys\nimport PyOpenWorm as P\n\n#Create dummy database configuration.\nd = P.Data({})\n\n#Connect to database with dummy configuration\nP.connect(conf=d)\n\n#Create a new Neuron object to work with\nn = P.Neuron(name='AVAL')\n\n#Create a new Evidence object with `doi` and `pmid` fields populated.\n#See `PyOpenWorm/evidence.py` for other available fields.\ne = P.Evidence(doi='125.41.3/ploscompbiol', pmid='57182010')\n\n#Evidence object asserts something about the enclosed dataObject.\n#Here we add a receptor to the Neuron we made earlier, and \"assert it\".\n#As the discussion (see top) reads, this might be asserting the existence of\n#receptor UNC-8 on neuron AVAL.\ne.asserts(n.receptor('UNC-8'))\n\n#Save the Neuron and Evidence objects to the database.\nn.save()\ne.save()\n\n#What does my evidence object contain?\nprint e\n\n#Disconnect from the database.\nP.disconnect()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Ho", "w", " ", "to", " ", "reference", " ", "support", "ing", " ", "eviden", "ce", " ", "for", " ", "some", " ", "object", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", "See", ":", " ", "\"", "Meta", "data", " ", "in", " ", "Py", "Open", "Wor", "m", "\"", " ", "for", " ", "discuss", "ion", " ", "on", " ", "semantics", " ", "of", " ", "what", " ", "gi", "ving", "\\", "10", ";", "eviden", "ce", " ", "for", " ", "an", " ", "object", " ", "means", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Py", "Open", "Wor", "m_", "as_", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Creat", "e", " ", "dummy", " ", "databa", "se", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "P_", "._", "Data_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Connect", " ", "to", " ", "databa", "se", " ", "with", " ", "dummy", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "connect_", "(_", "conf_", "=_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Creat", "e", " ", "a", " ", "new", " ", "Neuron", " ", "object", " ", "to", " ", "work", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "P_", "._", "Neuron_", "(_", "name_", "=_", "'", "AVA", "L", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Creat", "e", " ", "a", " ", "new", " ", "Evi", "denc", "e", " ", "object", " ", "with", " ", "`", "doi", "`", " ", "and", " ", "`", "pmid", "`", " ", "fields", " ", "populate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "See", " ", "`", "Py", "Open", "Wor", "m", "/", "eviden", "ce", ".", "py", "`", " ", "for", " ", "other", " ", "avail", "able", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "e_", "=_", "P_", "._", "Evi", "denc", "e_", "(_", "doi_", "=_", "'", "125", ".4", "1.3", "/", "plo", "sco", "mp", "biol", "'_", ",_", "pmid", "_", "=_", "'", "571", "820", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Evi", "denc", "e", " ", "object", " ", "asserts", " ", "somet", "hing", " ", "abo", "ut", " ", "the", " ", "enclose", "d", " ", "data", "Object", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "Her", "e", " ", "we", " ", "add", " ", "a", " ", "receptor", " ", "to", " ", "the", " ", "Neuron", " ", "we", " ", "made", " ", "ear", "lie", "r", ",", " ", "and", " ", "\"", "assert", " ", "it", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "As", " ", "the", " ", "discuss", "ion", " ", "(", "see", " ", "top", ")", " ", "reads", ",", " ", "this", " ", "mig", "ht", " ", "be", " ", "assert", "ing", " ", "the", " ", "existence", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", "receptor", " ", "UNC", "-", "8", " ", "on", " ", "neuro", "n", " ", "AVA", "L", "._", "\\u\\u\\uNL\\u\\u\\u_", "e_", "._", "asserts", "_", "(_", "n_", "._", "receptor", "_", "(_", "'", "UNC", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Save", " ", "the", " ", "Neuron", " ", "and", " ", "Evi", "denc", "e", " ", "object", "s", " ", "to", " ", "the", " ", "databa", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "What", " ", "doe", "s", " ", "my", " ", "eviden", "ce", " ", "object", " ", "contain", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Disconnect", " ", "from", " ", "the", " ", "databa", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "disconnect_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/lxml-3.3.6/src/lxml/tests/test_unicode.py
[ { "content": "# -*- coding: utf-8 -*-\nimport unittest, doctest, sys, os.path\n\nthis_dir = os.path.dirname(__file__)\nif this_dir not in sys.path:\n sys.path.insert(0, this_dir) # needed for Py3\n\nfrom common_imports import StringIO, etree, SillyFileLike, HelperTestCase\nfrom common_imports import _str, _bytes\n\ntry:\n unicode\nexcept NameError:\n unicode = str\n\nascii_uni = _bytes('a').decode('utf8')\n\nklingon = _bytes(\"\\\\uF8D2\").decode(\"unicode_escape\") # not valid for XML names\n\ninvalid_tag = _bytes(\"test\").decode('utf8') + klingon\n\nuni = _bytes('\\\\xc3\\\\u0680\\\\u3120').decode(\"unicode_escape\") # some non-ASCII characters\n\nuxml = _bytes(\"<test><title>test \\\\xc3\\\\xa1\\\\u3120</title><h1>page \\\\xc3\\\\xa1\\\\u3120 title</h1></test>\"\n ).decode(\"unicode_escape\")\n\n\n## def test_parse_fileobject_unicode(self):\n## # parse unicode from unamed file object (not support by ElementTree)\n## f = SillyFileLike(uxml)\n## root = etree.parse(f).getroot()\n## self.assertEqual(unicode(etree.tostring(root, 'UTF-8'), 'UTF-8'),\n## uxml)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UnicodeTestCase(HelperTestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.UnicodeTestCase", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def test_unicode_xml(self):\n tree = etree.XML('<p>%s</p>' % uni)\n self.assertEqual(uni, tree.text)", "metadata": "root.UnicodeTestCase.test_unicode_xml", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_wide_unicode_xml(self):\n if sys.maxunicode < 1114111:\n return # skip test\n tree = etree.XML(_bytes('<p>\\\\U00026007</p>').decode('unicode_escape'))\n self.assertEqual(1, len(tree.text))\n self.assertEqual(_bytes('\\\\U00026007').decode('unicode_escape'),\n tree.text)", "metadata": "root.UnicodeTestCase.test_wide_unicode_xml", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_unicode_xml_broken(self):\n uxml = ('<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n '<p>%s</p>' % uni)\n self.assertRaises(ValueError, etree.XML, uxml)", "metadata": "root.UnicodeTestCase.test_unicode_xml_broken", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_unicode_tag(self):\n el = etree.Element(uni)\n self.assertEqual(uni, el.tag)", "metadata": "root.UnicodeTestCase.test_unicode_tag", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_unicode_tag_invalid(self):\n # sadly, Klingon is not well-formed\n self.assertRaises(ValueError, etree.Element, invalid_tag)", "metadata": "root.UnicodeTestCase.test_unicode_tag_invalid", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_unicode_nstag(self):\n tag = \"{http://abc/}%s\" % uni\n el = etree.Element(tag)\n self.assertEqual(tag, el.tag)", "metadata": "root.UnicodeTestCase.test_unicode_nstag", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_unicode_ns_invalid(self):\n # namespace URIs must conform to RFC 3986\n tag = \"{http://%s/}abc\" % uni\n self.assertRaises(ValueError, etree.Element, tag)", "metadata": "root.UnicodeTestCase.test_unicode_ns_invalid", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_unicode_nstag_invalid(self):\n # sadly, Klingon is not well-formed\n tag = \"{http://abc/}%s\" % invalid_tag\n self.assertRaises(ValueError, etree.Element, tag)", "metadata": "root.UnicodeTestCase.test_unicode_nstag_invalid", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_unicode_qname(self):\n qname = etree.QName(uni, uni)\n tag = \"{%s}%s\" % (uni, uni)\n self.assertEqual(qname.text, tag)\n self.assertEqual(unicode(qname), tag)", "metadata": "root.UnicodeTestCase.test_unicode_qname", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 67 }, { "content": " def test_unicode_qname_invalid(self):\n self.assertRaises(ValueError, etree.QName, invalid_tag)", "metadata": "root.UnicodeTestCase.test_unicode_qname_invalid", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_unicode_attr(self):\n el = etree.Element('foo', {'bar': uni})\n self.assertEqual(uni, el.attrib['bar'])", "metadata": "root.UnicodeTestCase.test_unicode_attr", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_unicode_comment(self):\n el = etree.Comment(uni)\n self.assertEqual(uni, el.text)", "metadata": "root.UnicodeTestCase.test_unicode_comment", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_unicode_parse_stringio(self):\n el = etree.parse(StringIO('<p>%s</p>' % uni)).getroot()\n self.assertEqual(uni, el.text)", "metadata": "root.UnicodeTestCase.test_unicode_parse_stringio", "header": "['class', 'UnicodeTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": "def test_suite():\n suite = unittest.TestSuite()\n suite.addTests([unittest.makeSuite(UnicodeTestCase)])\n return suite", "metadata": "root.test_suite", "header": "['module', '___EOS___']", "index": 95 } ]
[ { "span": "import unittest, doctest, sys, os.path", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 38 }, { "span": "from common_imports import StringIO, etree, SillyFileLike, HelperTestCase", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 73 }, { "span": "from common_imports import _str, _bytes", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", ",_", "doctest_", ",_", "sys_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "this", "\\u", "dir_", "not_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "this", "\\u", "dir_", ")_", "#", " ", "need", "ed", " ", "for", " ", "Py", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "common", "\\u", "imports_", "import_", "String", "IO_", ",_", "etree_", ",_", "Sil", "ly", "File", "Like_", ",_", "Help", "er", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common", "\\u", "imports_", "import_", "\\u", "str_", ",_", "\\u", "bytes_", "\\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 ", " _", "unicode_", "\\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 ", " _", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ascii", "\\u", "uni_", "=_", "\\u", "bytes_", "(_", "'", "a", "'_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kli", "ngo", "n_", "=_", "\\u", "bytes_", "(_", "\"\\\\\\\\", "u", "F8", "D2", "\"_", ")_", "._", "decode_", "(_", "\"", "unicode", "\\u", "escape", "\"_", ")_", "#", " ", "not", " ", "valid", " ", "for", " ", "XML", " ", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invalid", "\\u", "tag_", "=_", "\\u", "bytes_", "(_", "\"", "test", "\"_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "+_", "kli", "ngo", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uni_", "=_", "\\u", "bytes_", "(_", "'\\\\\\\\", "xc", "3", "\\\\\\\\", "u0", "680", "\\\\\\\\", "u", "312", "0", "'_", ")_", "._", "decode_", "(_", "\"", "unicode", "\\u", "escape", "\"_", ")_", "#", " ", "some", " ", "non", "-", "ASCII", " ", "characters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ux", "ml_", "=_", "\\u", "bytes_", "(_", "\"<", "test", "><", "title", ">", "test", " ", "\\\\\\\\", "xc", "3", "\\\\\\\\", "xa", "1", "\\\\\\\\", "u", "312", "0", "</", "title", "><", "h1", ">", "page", " ", "\\\\\\\\", "xc", "3", "\\\\\\\\", "xa", "1", "\\\\\\\\", "u", "312", "0", " ", "title", "</", "h1", "><", "/", "test", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "decode_", "(_", "\"", "unicode", "\\u", "escape", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "def", " ", "test\\u", "parse", "\\u", "fileo", "bject", "\\u", "unicode", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "#", " ", "parse", " ", "unicode", " ", "from", " ", "una", "med", " ", "file", " ", "object", " ", "(", "not", " ", "support", " ", "by", " ", "Element", "Tree", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "f", " ", "=", " ", "Sil", "ly", "File", "Lik", "e", "(", "ux", "ml", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "root", " ", "=", " ", "etree", ".", "parse", "(", "f", ").", "getr", "oot", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "unicode", "(", "etree", ".", "tost", "ring", "(", "root", ",", " ", "'", "UT", "F", "-", "8", "')", ",", " ", "'", "UT", "F", "-", "8", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "ux", "ml", ")_", "\\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_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "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_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "unicode", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "etree_", "._", "XML_", "(_", "'<", "p", ">", "%", "s", "</", "p", ">'_", "%_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uni_", ",_", "tree_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wide", "\\u", "unicode", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "max", "unicode_", "<_", "111", "411", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "skip", " ", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tree_", "=_", "etree_", "._", "XML_", "(_", "\\u", "bytes_", "(_", "'<", "p", ">\\\\", "\\\\", "U", "0002", "600", "7", "</", "p", ">'_", ")_", "._", "decode_", "(_", "'", "unicode", "\\u", "escape", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "tree_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u", "bytes_", "(_", "'\\\\\\\\", "U", "0002", "600", "7", "'_", ")_", "._", "decode_", "(_", "'", "unicode", "\\u", "escape", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tree_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "xml", "\\u", "broken", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ux", "ml_", "=_", "(_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "p", ">", "%", "s", "</", "p", ">'_", "%_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "XML_", ",_", "ux", "ml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "tag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el_", "=_", "etree_", "._", "Element_", "(_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uni_", ",_", "el_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "tag", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sad", "ly", ",", " ", "Kl", "ing", "on", " ", "is", " ", "not", " ", "well", "-", "formed", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "Element_", ",_", "invalid", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "nsta", "g_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "\"{", "http", "://", "abc", "/", "}%", "s", "\"_", "%_", "uni_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el_", "=_", "etree_", "._", "Element_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tag_", ",_", "el_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "ns", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "namespace", " ", "URI", "s", " ", "must", " ", "conform", " ", "to", " ", "RF", "C", " ", "398", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "\"{", "http", "://", "%", "s", "/", "}", "abc", "\"_", "%_", "uni_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "Element_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "nsta", "g", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sad", "ly", ",", " ", "Kl", "ing", "on", " ", "is", " ", "not", " ", "well", "-", "formed", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "\"{", "http", "://", "abc", "/", "}%", "s", "\"_", "%_", "invalid", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "Element_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "qname_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qname_", "=_", "etree_", "._", "QN", "ame_", "(_", "uni_", ",_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "\"{", "%", "s", "}%", "s", "\"_", "%_", "(_", "uni_", ",_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "qname_", "._", "text_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "unicode_", "(_", "qname_", ")_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "qna", "me", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "QN", "ame_", ",_", "invalid", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "attr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el_", "=_", "etree_", "._", "Element_", "(_", "'", "foo", "'_", ",_", "{_", "'", "bar", "'_", ":_", "uni_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uni_", ",_", "el_", "._", "attrib_", "[_", "'", "bar", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "comment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el_", "=_", "etree_", "._", "Comment_", "(_", "uni_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uni_", ",_", "el_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unicode", "\\u", "parse", "\\u", "string", "io_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el_", "=_", "etree_", "._", "parse_", "(_", "String", "IO_", "(_", "'<", "p", ">", "%", "s", "</", "p", ">'_", "%_", "uni_", ")_", ")_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uni_", ",_", "el_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Tests_", "(_", "[_", "unittest_", "._", "make", "Suite_", "(_", "Unic", "ode", "Test", "Case_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "suite_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
neuropoly/spinalcordtoolbox/dev/vertebral_labeling/batch_labeling.py
[ { "content": "def labeling_vertebrae_T1(label,input_anat,input_centerline,input_surface,output_centerline_vertebra,output_surface_vertebra,surface_do):\n\n # convert to nii\n #print '\\nCopy input data...'\n #sct.run('cp ' + input_anat + ' tmp.anat' + ext_anat)\n #sct.run('fslchfiletype NIFTI tmp.anat')\n #sct.run('cp ' + input_centerline + ' tmp.centerline' + ext_centerline)\n #sct.run('fslchfiletype NIFTI tmp.centerline')\n\n #==================================================\n # Reorientation of the data if needed\n #==================================================\n command = 'fslhd ' + input_anat\n \n result = commands.getoutput(command)\n orientation = result[result.find('qform_xorient')+15] + result[result.find('qform_yorient')+15] + result[result.find('qform_zorient')+15]\n\n if orientation!='ASR':\n \n print '\\nReorient input volume to AP SI RL orientation...'\n sct.run(sct.fsloutput + 'fslswapdim tmp.anat AP SI RL tmp.anat_orient')\n \n sct.run(sct.fsloutput + 'fslswapdim tmp.centerline AP SI RL tmp.centerline_orient')\n\n \n #load_images\n anat_file = nibabel.load('tmp.anat_orient.nii')\n anat = anat_file.get_data()\n hdr = anat_file.get_header()\n dims = hdr['dim']\n scales = hdr['pixdim']\n #if surface_do==1:\n #surface_file = nibabel.load(input_surface_reorient)\n #surface = surface_file.get_data()\n \n centerline_file = nibabel.load('tmp.centerline_orient.nii')\n centerline = centerline_file.get_data()\n \n else:\n # loading images\n anat_file = nibabel.load(input_anat)\n anat = anat_file.get_data()\n hdr = anat_file.get_header()\n dims = hdr['dim']\n scales = hdr['pixdim']\n \n #if surface_do==1:\n #surface_file = nibabel.load(input_surface)\n #surface = surface_file.get_data()\n\n centerline_file = nibabel.load(input_centerline)\n centerline = centerline_file.get_data() \n\n #==================================================\n # Calculation of the profile intensity\n #==================================================\n\n shift_AP = label.shift_AP*scales[1]\n size_AP = label.size_AP*scales[1]\n size_RL = label.size_RL*scales[3]\n \n np.uint16(anat) \n\n X,Y,Z = np.where(centerline>0)\n #centerline = [anat[X[i]][Y[i]][Z[i]] for i in range(len(X))]\n\n j = np.argsort(Y)\n y = Y[j]\n x = X[j]\n z = Z[j]\n\n #eliminating double in y\n index=0\n for i in range(len(y)-1):\n if y[i]==y[i+1]:\n if index==0:\n index_double = i\n else:\n index_double = np.resize(index_double,index+1)\n index_double[index] = i\n index = index + 1\n\n mask = np.ones(len(y), dtype=bool)\n mask[index_double] = False\n\n y = y[mask]\n x = x[mask]\n z = z[mask]\n\n #shift the centerline to the spine of shift_AP\n x1 = np.round(x-shift_AP/scales[1])\n\n #build intensity profile along the centerline\n I = np.zeros((len(y),1))\n \n for index in range(len(y)):\n lim_plus = index + 5\n lim_minus = index - 5\n\n if lim_minus<0:\n lim_minus = 0\n if lim_plus>=len(x1):\n lim_plus = len(x1) - 1\n\n # normal vector of the orthogonal plane to the centerline i.e tangent vector to the centerline\n Vx = x1[lim_plus] - x1[lim_minus]\n Vz = z[lim_plus] - z[lim_minus]\n Vy = y[lim_plus] - y[lim_minus]\n\n d = Vx*x1[index] + Vy*y[index] + Vz*z[index]\n\n for i_slice_RL in range(2*np.int(round(size_RL/scales[3]))):\n for i_slice_AP in range(2*np.int(round(size_AP/scales[1]))):\n result = (d - Vx*(x1[index] + i_slice_AP - size_AP - 1) - Vz*z[index])/Vy\n \n if result > anat.shape[1]:\n result = anat.shape[1]\n I[index] = I[index] + anat[np.int(round(x1[index]+i_slice_AP - size_AP - 1)),np.int(round(result)),np.int(round(z[index] + i_slice_RL - size_RL - 1))]\n\n # Detrending Intensity\n start_centerline_y = y[0]\n X = np.where(I==0)\n mask2 = np.ones((len(y),1), dtype=bool)\n mask2[X,0] = False\n #I = I[mask2]\n\n if label.verbose==1:\n pl.plot(I)\n pl.xlabel('direction superior-inferior')\n pl.ylabel('intensity')\n pl.title('Intensity profile along the shifted spinal cord centerline')\n pl.show()\n \n #from scipy.interpolate import UnivariateSpline\n #fit_detrend = UnivariateSpline(np.arange(len(I[:,0])),I[:,0])\n #P_detrend = fit_detrend(np.arange(len(I[:,0])))\n \n #popt, pcov = scipy.optimize.curve_fit(func,np.arange(len(I[:,0])),I[:,0],p0=None)\n #P_fit = func(np.arange(len(I[:,0])), popt[0], popt[1], popt[2], popt[3], popt[4], popt[5])\n \n #popt = np.polyfit(np.arange(len(I[:,0])),I[:,0],9)\n #P_fit = np.poly1d(popt)\n\n #a = np.arange(len(I[:,0]))\n #b = np.zeros(len(I[:,0]))\n #print a ,I[:,0]\n #nurbs = NURBS(3,len(a)+100,[[a[n],I[n,0],b[n]] for n in range(len(I[:,0]))])\n #P = nurbs.getCourbe3D()\n #I_detrend = np.zeros((len(I[:,0]),1))\n #I_detrend[:,0] = I[:,0] - P[0]\n #I_detrend[:,0] = I[:,0] - P_fit(np.arange(len(I[:,0])))\n\n #I_detrend = scipy.signal.detrend(I,axis=0)\n #if len(I)*scales[1]<(300/scales[1]):\n #I_detrend = j_detrend_new_v2(I.T,5,'cos',1)\n #else:\n #I_detrend = j_detrend_new_v2(I.T,20,'cos',1)\n\n# index_maxima = 0\n# count = 0\n# for i in range(len(I[:,0])):\n# if i==0:\n# if I[i,0]>I[i+1,0]:\n# index_maxima = i\n# count = count + 1\n# elif i==(len(I[:,0])-1):\n# if I[i,0]<I[i-1,0]:\n# index_maxima = np.resize(index_maxima,count+1)\n# index_maxima[len(index_maxima)-1] = i\n# else:\n# if I[i,0]>I[i+1,0]:\n# if I[i,0]>I[i-1,0]:\n# index_maxima = np.resize(index_maxima,count+1)\n# index_maxima[len(index_maxima)-1] = i\n# count = count + 1\n#\n# mean_maxima = np.mean(I[index_maxima,0])\n# threshold = np.amin(I[index_maxima,0]) + (np.amax(I[index_maxima,0]) - np.amin(I[index_maxima,0]))/2\n# indices = np.array(np.where(I[index_maxima,0]>threshold))\n#\n# weights = np.ones(len(I[:,0]))*float(1/float(len(I[:,0])-(len(indices.T))))\n# weights[index_maxima] = 0\n# #weights[index_maxima+1] = 0\n# #weights[index_maxima-1] = 0\n#\n# tck = scipy.interpolate.splrep(np.arange(len(I[:,0])),I[:,0],w = weights ,xb=None, xe=None, k=3, task=0, s=60000, t=None, full_output=0, per=0, quiet=1)\n# P_fit = scipy.interpolate.splev(np.arange(len(I[:,0])),tck,der=0,ext=0)\n\n \n# frequency = scipy.fftpack.fftfreq(len(I[:,0]), d=1)\n# Fc = 20\n# Fs = 2*np.amax(frequency)\n# h = scipy.signal.firwin(numtaps=N, cutoff=np.amax(frequency)/10, window='hann',pass_zero=True, nyq=Fs/2)\n# P_fit=scipy.signal.lfilter(h, 1.0, I[:,0])\n\n frequency = scipy.fftpack.fftfreq(len(I[:,0]), d=1)\n z = np.abs(scipy.fftpack.fft(I[:,0], n=None, axis=-1, overwrite_x=False))\n# print z.shape,frequency.shape\n# pl.plot(frequency,z)\n# pl.show()\n\n \n# N, Wn = scipy.signal.buttord(wp = np.amax(frequency)/10, ws = (np.amax(frequency)/10)+ 0.2, gpass = 0.1, gstop = 50, analog=False)\n# print N, Wn\n# b, a = scipy.signal.cheby2(N, 20, Wn, btype='low', analog=False, output='ba')\n Wn = np.amax(frequency)/10\n N = 5 #Order of the filter\n# b, a = scipy.signal.butter(N, Wn, btype='low', analog=False, output='ba')\n b, a = scipy.signal.iirfilter(N, Wn, rp=None, rs=None, btype='low', analog=False, ftype='bessel', output='ba')\n I_fit = scipy.signal.filtfilt(b, a, I[:,0], axis=-1, padtype='constant', padlen=None)\n \n pl.plot(I[:,0])\n pl.plot(I_fit)\n pl.show()\n\n I_detrend = np.zeros((len(I[:,0]),1))\n I_detrend[:,0] = I[:,0] - I_fit\n \n I_detrend = I_detrend/(np.amax(I_detrend))\n if label.verbose==1:\n pl.plot(I_detrend[:,0])\n pl.xlabel('direction superior-inferior')\n pl.ylabel('intensity')\n pl.title('Intensity profile along the shifted spinal cord centerline after detrending and basic normalization')\n pl.show()\n\n info_1 = input('Is the more rostral vertebrae the C1 or C2 one? if yes, enter 1 otherwise 0:')\n if info_1==0:\n level_start = input('enter the level of the more rostral vertebra - choice of the more rostral vertebral level of the field of view:')\n else:\n level_start = 2\n\n mean_distance_dict = scipy.io.loadmat('/home/django/kraju/code/spinalcordtoolbox_dev/src/vertebral_labeling/mean_distance.mat')\n mean_distance = (mean_distance_dict.values()[2]).T\n C1C2_distance = mean_distance[0:2]\n mean_distance = mean_distance[level_start-1:len(mean_distance)-1]\n\n space = np.linspace(-5/scales[2], 5/scales[2], round(11/scales[2]), endpoint=True)\n pattern = (np.sinc((space*scales[2])/15))**(20)\n xmax_pattern = np.argmax(pattern)\n\n #==================================================\n # step 1 : Find the First Peak\n #==================================================\n\n #correlation between the pattern and intensity profile\n #corr_all = scipy.signal.correlate(pattern,I_detrend[:,0])\n #corr_all = matplotlib.pyplot.xcorr(pattern,I_detrend[:,0])\n\n pattern1 = np.concatenate((pattern,np.zeros(len(I_detrend[:,0])-len(pattern))))\n corr_all = scipy.signal.correlate(I_detrend[:,0],pattern1)\n loc_corr = np.arange(-np.round((len(corr_all)/2)),np.round(len(corr_all)/2)+2)\n index_fp = 0\n count = 0\n for i in range(len(corr_all)):\n if corr_all[i]>0.1:\n if i==0:\n if corr_all[i]<corr_all[i+1]:\n index_fp = i\n count = count + 1\n elif i==(len(corr_all)-1):\n if corr_all[i]<corr_all[i-1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n else:\n if corr_all[i]<corr_all[i+1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1\n elif corr_all[i]<corr_all[i-1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1\n else:\n if i==0:\n index_fp = i\n count = count + 1\n else:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1 \n\n\n mask_fp = np.ones(len(corr_all), dtype=bool)\n mask_fp[index_fp] = False\n value = corr_all[mask_fp]\n loc_corr = loc_corr[mask_fp] \n\n loc_corr = loc_corr - I_detrend.shape[0]\n loc_first_peak = xmax_pattern - loc_corr[np.amax(np.where(value>1))]\n Mcorr1 = value[np.amax(np.where(value>1))]\n\n #building the pattern that has to be added at each iteration in step 2\n\n if xmax_pattern<loc_first_peak:\n template_truncated = np.concatenate((np.zeros((loc_first_peak-xmax_pattern)),pattern))\n \n else:\n template_truncated = pattern[(xmax_pattern-loc_first_peak-1):]\n xend = np.amax(np.where(template_truncated>0.02))\n pixend = xend - loc_first_peak\n\n if label.verbose==1:\n pl.plot(template_truncated)\n pl.plot(I_detrend)\n pl.title('Detection of First Peak')\n pl.xlabel('direction anterior-posterior (mm)')\n pl.ylabel('intensity')\n pl.show()\n\n loc_peak_I = np.arange(len(I_detrend[:,0]))\n count = 0\n index_p = 0\n for i in range(len(I_detrend[:,0])):\n if I_detrend[i]>0.15:\n if i==0:\n if I_detrend[i,0]<I_detrend[i+1,0]:\n index_p = i\n count = count + 1\n elif i==(len(I_detrend[:,0])-1):\n if I_detrend[i,0]<I_detrend[i-1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i \n else:\n if I_detrend[i,0]<I_detrend[i+1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n elif I_detrend[i,0]<I_detrend[i-1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n else:\n if i==0:\n index_p = i\n count = count + 1\n else:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n\n mask_p = np.ones(len(I_detrend[:,0]), dtype=bool)\n mask_p[index_p] = False\n value_I = I_detrend[mask_p]\n loc_peak_I = loc_peak_I[mask_p]\n \n count = 0\n for i in range(len(loc_peak_I)-1):\n if i==0:\n if loc_peak_I[i+1]-loc_peak_I[i]<round(10/scales[1]):\n index = i\n count = count + 1\n else:\n if (loc_peak_I[i+1]-loc_peak_I[i])<round(10/scales[1]):\n index = np.resize(index,count+1)\n index[len(index)-1] = i\n count = count + 1\n elif (loc_peak_I[i]-loc_peak_I[i-1])<round(10/scales[1]):\n index = np.resize(index,count+1)\n index[len(index)-1] = i\n count = count + 1\n\n mask_I = np.ones(len(value_I), dtype=bool)\n mask_I[index] = False\n value_I = value_I[mask_I]\n loc_peak_I = loc_peak_I[mask_I]\n\n from scipy.interpolate import UnivariateSpline\n fit = UnivariateSpline(loc_peak_I,value_I)\n P = fit(np.arange(len(I_detrend)))\n\n for i in range(len(I_detrend)):\n if P[i]>0.1:\n I_detrend[i,0] = I_detrend[i,0]/P[i]\n\n if label.verbose==1:\n pl.xlim(0,len(I_detrend)-1)\n pl.plot(loc_peak_I,value_I)\n pl.plot(I_detrend)\n pl.plot(P,color='y')\n pl.title('Setting values of peaks at one by fitting a smoothing spline')\n pl.xlabel('direction superior-inferior (mm)')\n pl.ylabel('normalized intensity')\n pl.show(block=False)\n\n #===================================================================================\n # step 2 : Cross correlation between the adjusted template and the intensity profile\n # local moving of template's peak from the first peak already found\n #===================================================================================\n\n mean_distance_new = mean_distance\n mean_ratio = np.zeros(len(mean_distance))\n L = np.round(1.2*max(mean_distance)) - np.round(0.8*min(mean_distance))\n corr_peak = np.zeros((L,len(mean_distance)))\n\n for i_peak in range(len(mean_distance)):\n scale_min = np.round(0.80*mean_distance_new[i_peak]) - xmax_pattern - pixend\n if scale_min<0:\n scale_min = 0\n\n scale_max = np.round(1.2*mean_distance_new[i_peak]) - xmax_pattern - pixend\n scale_peak = np.arange(scale_min,scale_max+1)\n\n for i_scale in range(len(scale_peak)):\n template_resize_peak = np.concatenate([template_truncated,np.zeros(scale_peak[i_scale]),pattern])\n if len(I_detrend[:,0])>len(template_resize_peak):\n template_resize_peak1 = np.concatenate((template_resize_peak,np.zeros(len(I_detrend[:,0])-len(template_resize_peak))))\n corr_template = scipy.signal.correlate(I_detrend[:,0],template_resize_peak)\n\n if len(I_detrend[:,0])>len(template_resize_peak):\n val = np.dot(I_detrend[:,0],template_resize_peak1.T)\n else:\n I_detrend_2 = np.concatenate((I_detrend[:,0],np.zeros(len(template_resize_peak)-len(I_detrend[:,0]))))\n val = np.dot(I_detrend_2,template_resize_peak.T)\n corr_peak[i_scale,i_peak] = val\n\n if label.verbose==1:\n pl.xlim(0,len(I_detrend[:,0]))\n pl.plot(I_detrend[:,0])\n pl.plot(template_resize_peak)\n pl.show(block=False)\n \n pl.plot(corr_peak[:,i_peak],marker='+',linestyle='None',color='r')\n pl.title('correlation value against the displacement of the peak (px)')\n pl.show(block=False)\n\n max_peak = np.amax(corr_peak[:,i_peak])\n index_scale_peak = np.where(corr_peak[:,i_peak]==max_peak)\n good_scale_peak = scale_peak[index_scale_peak][0]\n Mcorr = Mcorr1\n Mcorr = np.resize(Mcorr,i_peak+2)\n Mcorr[i_peak+1] = np.amax(corr_peak[:,0:(i_peak+1)])\n flag = 0\n\n if i_peak>0:\n if (Mcorr[i_peak+1]-Mcorr[i_peak])<0.4*np.mean(Mcorr[1:i_peak+2]-Mcorr[0:i_peak+1]):\n test = i_peak\n template_resize_peak = np.concatenate((template_truncated,np.zeros(round(mean_distance[i_peak])-xmax_pattern-pixend),pattern))\n good_scale_peak = np.round(mean_distance[i_peak]) - xmax_pattern - pixend\n flag = 1\n if i_peak==0:\n if (Mcorr[i_peak+1] - Mcorr[i_peak])<0.4*Mcorr[0]:\n template_resize_peak = np.concatenate((template_truncated,np.zeros(round(mean_distance[i_peak])-xmax_pattern-pixend),pattern))\n good_scale_peak = round(mean_distance[i_peak]) - xmax_pattern - pixend\n flag = 1\n if flag==0:\n template_resize_peak=np.concatenate((template_truncated,np.zeros(good_scale_peak),pattern))\n\n mean_distance_new[i_peak] = good_scale_peak + xmax_pattern + pixend\n mean_ratio[i_peak] = np.mean(mean_distance_new[:,0:i_peak]/mean_distance[:,0:i_peak])\n\n template_truncated = template_resize_peak\n\n if label.verbose==1:\n pl.plot(I_detrend[:,0])\n pl.plot(template_truncated)\n pl.xlim(0,(len(I_detrend[:,0])-1))\n pl.show()\n\n minpeakvalue = 0.5\n loc_disk = np.arange(len(template_truncated))\n count = 0\n index_disk = 0\n for i in range(len(template_truncated)):\n if template_truncated[i]>=minpeakvalue:\n if i==0:\n if template_truncated[i]<template_truncated[i+1]:\n index_disk = i\n count = count + 1\n elif i==(len(template_truncated)-1):\n if template_truncated[i]<template_truncated[i-1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n else:\n if template_truncated[i]<template_truncated[i+1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n elif template_truncated[i]<template_truncated[i-1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n else:\n if i==0:\n index_disk = i\n count = count + 1\n else:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n \n mask_disk = np.ones(len(template_truncated), dtype=bool)\n mask_disk[index_disk] = False\n loc_disk = loc_disk[mask_disk]\n X1 = np.where(loc_disk > I_detrend.shape[0])\n mask_disk1 = np.ones(len(loc_disk), dtype=bool)\n mask_disk1[X1] = False\n loc_disk = loc_disk[mask_disk1]\n loc_disk = loc_disk + start_centerline_y - 1\n \n\n #=====================================================================\n # Step 3: Building of the labeled centerline and surface\n #=====================================================================\n\n for i in range(len(loc_disk)):\n\n Index = np.array(np.where(y==loc_disk[i])).T\n lim_plus = Index + 5\n lim_minus = Index - 5\n\n if lim_minus<1:\n lim_minus=1\n if lim_plus>len(x):\n lim_plus=len(x)\n\n Vx = x[lim_plus] - x[lim_minus]\n Vz = z[lim_plus] - z[lim_minus]\n Vy = y[lim_plus] - y[lim_minus]\n\n d = Vx*x1[Index] + Vy*y[Index] + Vz*z[Index]\n\n intersection = np.ones(len(x))\n for j in range(len(x)):\n intersection[j] = np.abs((Vx*x[j]+Vy*y[j]+Vz*z[j]-d))\n\n min_intersection = np.amin(intersection)\n index_intersection = np.where(min_intersection==np.amin(intersection))\n loc_disk[i] = y[index_intersection]\n\n center_disk = centerline\n for i in range(len(loc_disk)-1):\n tmp = center_disk[:,loc_disk[i]:loc_disk[i+1],:]\n tmp[np.where(tmp==1)] = i + level_start\n center_disk[:,loc_disk[i]:loc_disk[i+1],:] = tmp\n\n center_disk[np.where(center_disk==1)] = 0\n\n if level_start==2:\n center_disk[x[0],round(loc_disk[0] - C1C2_distance[1]):loc_disk[0],z[0]] = 2\n center_disk[x[0],round(loc_disk[0] - C1C2_distance[0] - C1C2_distance[1]):round(loc_disk[0] - C1C2_distance[1] - 1),z[0]] = 1\n\n if orientation!='ASR':\n a = orientation[0]\n b = orientation[1]\n c = orinetation[2]\n\n if a=='A': a='AP'\n if a=='P': a='PA'\n if a=='S': a='SI'\n if a=='I': a='IS'\n if a=='R': a='RL'\n if a=='L': a='LR'\n\n if b=='A': b='AP'\n if b=='P': b='PA'\n if b=='S': b='SI'\n if b=='I': b='IS'\n if b=='R': b='RL'\n if b=='L': b='LR'\n\n if c=='A': c='AP'\n if c=='P': c='PA'\n if c=='S': c='SI'\n if c=='I': c='IS'\n if c=='R': c='RL'\n if c=='L': c='LR'\n\n command = fsloutput + ' fslcpgeom ' + label.input_path + label.input_anat + '_reorient ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n\n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + label.input_path + label.input_anat + '_reorient ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)\n\n flag = 0\n if flag==1:\n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' -x y z ', output_centerline_vertebra\n result = commands.getoutput(command)\n\n command = fsloutput + ' fslorient -swaporient ' + output_centerline_vertebra\n result = commands.getoutput(command)\n\n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_centerline_vertebra\n result = commands.getoutput(command)\n\n if surface_do==1:\n command = fsloutput + 'fslswapdim ' + output_surface_vertebra + ' -x y z ' + output_surface_vertebra\n result = commands.getoutput(command)\n\n command = fsloutput + ' fslorient -swaporient ' + output_surface_vertebra\n result = commands.getoutput(command)\n\n command = fsloutput + ' fslswapdim ' + output_surface_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_surface_vertebra\n result = commands.getoutput(command)\n else:\n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_centerline_vertebra\n result = commands.getoutput(command)\n\n if surface_do==1:\n command = fsloutput + ' fslswapdim ' + output_surface_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_surface_vertebra\n result = commands.getoutput(command)\n\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n\n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)\n else:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n\n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)", "metadata": "root.labeling_vertebrae_T1", "header": "['module', '___EOS___']", "index": 143 }, { "content": "def labeling_vertebrae_T2(label):\n \n if orientation!='ASR':\n \n input_anat_reorient = label.input_path + label.input_anat + '_reorient.nii'\n command = 'cp ' + input_anat + ' ' + input_anat_reorient\n result = commands.getoutput(command)\n \n if label.segmentation_do==1:\n input_centerline_reorient = label.output_path + label.segmentation_centerline + '_reorient.nii'\n else:\n input_centerline_reorient = label.input_path + label.input_centerline + '_reorient.nii'\n command = 'cp ' + input_centerline + ' ' + input_centerline_reorient\n result = commands.getoutput(command)\n \n if surface_do==1:\n if label.segmentation_do==1:\n input_surface_reorinet = label.output_path + label.segmentation_surface + '_reorient.nii'\n else:\n input_surface_reorinet = label.input_path + label.input_surface + '_reorient.nii'\n command = 'cp ' + input_surface + ' ' + input_surface_reorient\n \n \n #Forcing Radiological Orientation\n \n \n #reorient data to get PSL orientation\n command = fsloutput + ' fslswapdim ' + label.input_path + label.input_anat + '_reorient' + ' AP SI RL ' + label.input_path + label.input_anat + '_reorient'\n result = commands.getoutput(command)\n \n if label.segmentation_do==1:\n command = fsloutput + ' fslswapdim ' + label.output_path + label.segmentation_centerline + '_reorient' + ' AP SI RL ' + label.output_path + label.segmentation_centerline + '_reorient'\n else:\n command = fsloutput + ' fslswapdim ' + label.input_path + label.input_centerline + '_reorient' + ' AP SI RL ' + label.input_path + label.input_centerline + '_reorient'\n result = commands.getoutput(command)\n \n if surface_do==1:\n if label.segmentation_do==1:\n command = fsloutput + ' fslswapdim ' + label.output_path + label.segmentation_surface + '_reorient' + ' AP SI RL ' + label.output_path + label.segmentation_surface + '_reorient'\n else:\n command = fsloutput + ' fslswapdim ' + label.input_path + label.input_surface + '_reorient' + ' AP SI RL ' + label.input_path + label.input_surface + '_reorient'\n result = commands.getoutput(command)\n \n #load_images\n anat_file = nibabel.load(input_anat_reorient)\n anat = anat_file.get_data()\n hdr = anat_file.get_header()\n dims = hdr['dim']\n scales = hdr['pixdim']\n \n #if surface_do==1:\n #surface_file = nibabel.load(input_surface_reorient)\n #surface = surface_file.get_data()\n \n centerline_file = nibabel.load(input_centerline_reorient)\n centerline = centerline_file.get_data()\n\n else:\n # loading images\n anat_file = nibabel.load(input_anat)\n anat = anat_file.get_data()\n hdr = anat_file.get_header()\n dims = hdr['dim']\n scales = hdr['pixdim']\n \n #if surface_do==1:\n #surface_file = nibabel.load(input_surface)\n #surface = surface_file.get_data()\n \n centerline_file = nibabel.load(input_centerline)\n centerline = centerline_file.get_data()\n\n \n \n #==================================================\n # Calculation of the profile intensity\n #==================================================\n \n shift_AP = label.shift_AP*scales[1]\n size_AP = label.size_AP*scales[1]\n size_RL = label.size_RL*scales[3]\n \n np.uint16(anat)\n\n X,Y,Z = np.where(centerline>0)\n\n j = np.argsort(Y)\n y = Y[j]\n x = X[j]\n z = Z[j]\n\n #eliminating double in y\n index=0\n for i in range(len(y)-1):\n if y[i]==y[i+1]:\n if index==0:\n index_double = i\n else:\n index_double = np.resize(index_double,index+1)\n index_double[index] = i\n index = index + 1\n\n mask = np.ones(len(y), dtype=bool)\n mask[index_double] = False\n\n y = y[mask]\n x = x[mask]\n z = z[mask]\n\n #shift the centerline to the spine of shift_AP\n x1 = np.round(x-shift_AP/scales[1])\n\n #build intensity profile along the centerline\n I = np.zeros((len(y),1))\n\n for index in range(len(y)):\n lim_plus = index + 5\n lim_minus = index - 5\n \n if lim_minus<0:\n lim_minus = 0\n if lim_plus>=len(x1):\n lim_plus = len(x1) - 1\n\n # normal vector of the orthogonal plane to the centerline i.e tangent vector to the centerline\n Vx = x1[lim_plus] - x1[lim_minus]\n Vz = z[lim_plus] - z[lim_minus]\n Vy = y[lim_plus] - y[lim_minus]\n\n d = Vx*x1[index] + Vy*y[index] + Vz*z[index]\n\n for i_slice_RL in range(2*np.int(round(size_RL/scales[3]))):\n for i_slice_AP in range(2*np.int(round(size_AP/scales[1]))):\n result = (d - Vx*(x1[index] + i_slice_AP - size_AP - 1) - Vz*z[index])/Vy\n \n if result > anat.shape[1]:\n result = anat.shape[1]\n I[index] = I[index] + anat[np.int(round(x1[index]+i_slice_AP - size_AP - 1)),np.int(round(result)),np.int(round(z[index] + i_slice_RL - size_RL - 1))]\n\n # Detrending Intensity\n start_centerline_y = y[0]\n X = np.where(I==0)\n mask2 = np.ones((len(y),1), dtype=bool)\n mask2[X,0] = False\n #I = I[mask2]\n \n if label.verbose==1:\n pl.plot(I)\n pl.xlabel('direction superior-inferior')\n pl.ylabel('intensity')\n pl.title('Intensity profile along the shifted spinal cord centerline')\n pl.show(block=False)\n \n I_detrend = scipy.signal.detrend(I,axis=0)\n #if len(I)*scales[1]<(300/scales[1]):\n #I_detrend = j_detrend_new_v2(I.T,5,'cos',1)\n #else:\n #I_detrend = j_detrend_new_v2(I.T,10,'cos',1)\n #I_detrend = detrend_function(I)\n\n I_detrend = I_detrend/abs((np.amin(I_detrend)))\n if label.verbose==1:\n pl.plot(I_detrend)\n pl.xlabel('direction superior-inferior')\n pl.ylabel('intensity')\n pl.title('Intensity profile along the shifted spinal cord centerline after detrending and basic normalization')\n pl.show(block=False)\n \n info_1 = input('Is the more rostral vertebrae the C1 or C2 one? if yes, enter 1 otherwise 0:')\n if info_1==0:\n level_start = input('enter the level of the more rostral vertebra - choice of the more rostral vertebral level of the field of view:')\n else:\n level_start = 2\n \n mean_distance_dict = scipy.io.loadmat('/home/django/kraju/code/spinalcordtoolbox_dev/src/vertebral_labeling/mean_distance.mat')\n mean_distance = (mean_distance_dict.values()[2]).T\n C1C2_distance = mean_distance[0:2]\n mean_distance = mean_distance[level_start+1:len(mean_distance)-1]\n \n space = np.linspace(-5/scales[2], 5/scales[2], round(11/scales[2]), endpoint=True)\n pattern = (np.sinc((space*scales[2])/15))**(20)\n xmax_pattern = np.argmin(pattern)\n pixend = len(pattern) - xmax_pattern\n\n #==================================================\n # step 1 : find the first peak\n #==================================================\n\n #correlation between the pattern and intensity profile\n #corr_all = scipy.signal.correlate(pattern,I_detrend[:,0])\n #corr_all = matplotlib.pyplot.xcorr(pattern,I_detrend[:,0])\n\n pattern1 = np.concatenate((pattern,np.zeros(len(I_detrend[:,0])-len(pattern))))\n corr_all = scipy.signal.correlate(I_detrend[:,0],pattern1)\n loc_corr = np.arange(-np.round((len(corr_all)/2)),np.round(len(corr_all)/2)+2)\n index_fp = 0\n count = 0\n for i in range(len(corr_all)):\n if corr_all[i]>0.1:\n if i==0:\n if corr_all[i]<corr_all[i+1]:\n index_fp = i\n count = count + 1\n elif i==(len(corr_all)-1):\n if corr_all[i]<corr_all[i-1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n else:\n if corr_all[i]<corr_all[i+1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1\n elif corr_all[i]<corr_all[i-1]:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1\n else:\n if i==0:\n index_fp = i\n count = count + 1\n else:\n index_fp = np.resize(index_fp,count+1)\n index_fp[len(index_fp)-1] = i\n count = count + 1\n\n\n mask_fp = np.ones(len(corr_all), dtype=bool)\n mask_fp[index_fp] = False\n value = corr_all[mask_fp]\n loc_corr = loc_corr[mask_fp]\n\n loc_corr = loc_corr - I_detrend.shape[0]\n\n loc_first_peak = xmax_pattern - loc_corr[np.amax(np.where(value>0.6))]\n Mcorr1 = value[np.amax(np.where(value>0.6))]\n\n #building the pattern that has to be added at each iteration in step 2\n if loc_first_peak>=0:\n template_truncated = pattern[(loc_first_peak+1):]\n else:\n template_truncated = np.concatenate((np.zeros(abs(loc_first_peak)),pattern))\n\n xend = len(template_truncated)\n\n if label.verbose==1:\n pl.plot(template_truncated)\n pl.plot(I_detrend)\n pl.title('Detection of First Peak')\n pl.xlabel('direction anterior-posterior (mm)')\n pl.ylabel('intensity')\n pl.show(block=False)\n\n # smoothing the intensity curve----\n I_detrend[:,0] = scipy.ndimage.filters.gaussian_filter1d(I_detrend[:,0],10)\n\n loc_peak_I = np.arange(len(I_detrend[:,0]))\n count = 0\n index_p = 0\n for i in range(len(I_detrend[:,0])):\n if I_detrend[i]>0.05:\n if i==0:\n if I_detrend[i,0]<I_detrend[i+1,0]:\n index_p = i\n count = count + 1\n elif i==(len(I_detrend[:,0])-1):\n if I_detrend[i,0]<I_detrend[i-1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n else:\n if I_detrend[i,0]<I_detrend[i+1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n elif I_detrend[i,0]<I_detrend[i-1,0]:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n else:\n if i==0:\n index_p = i\n count = count + 1\n else:\n index_p = np.resize(index_p,count+1)\n index_p[len(index_p)-1] = i\n count = count+1\n\n mask_p = np.ones(len(I_detrend[:,0]), dtype=bool)\n mask_p[index_p] = False\n value_I = I_detrend[mask_p]\n loc_peak_I = loc_peak_I[mask_p]\n\n count = 0\n for i in range(len(loc_peak_I)-1):\n if i==0:\n if loc_peak_I[i+1]-loc_peak_I[i]<round(10/scales[1]):\n index = i\n count = count + 1\n else:\n if (loc_peak_I[i+1]-loc_peak_I[i])<round(10/scales[1]):\n index = np.resize(index,count+1)\n index[len(index)-1] = i\n count = count + 1\n elif (loc_peak_I[i]-loc_peak_I[i-1])<round(10/scales[1]):\n index = np.resize(index,count+1)\n index[len(index)-1] = i\n count = count + 1\n\n mask_I = np.ones(len(value_I), dtype=bool)\n mask_I[index] = False\n value_I = -value_I[mask_I]\n loc_peak_I = loc_peak_I[mask_I]\n\n from scipy.interpolate import UnivariateSpline\n fit = UnivariateSpline(loc_peak_I,value_I)\n P = fit(np.arange(len(I_detrend)))\n\n if label.verbose==1:\n pl.xlim(0,len(I_detrend)-1)\n pl.plot(loc_peak_I,value_I)\n pl.plot(I_detrend)\n pl.plot(P)\n pl.title('Setting values of peaks at one by fitting a smoothing spline')\n pl.xlabel('direction superior-inferior (mm)')\n pl.ylabel('normalized intensity')\n pl.show(block=False)\n\n for i in range(len(I_detrend)):\n if P[i]>0.1:\n I_detrend[i,0] = I_detrend[i,0]/abs(P[i])\n\n #===================================================================================\n # step 2 : Cross correlation between the adjusted template and the intensity profile\n # local moving of template's peak from the first peak already found\n #===================================================================================\n\n mean_distance_new = mean_distance\n mean_ratio = np.zeros(len(mean_distance))\n L = np.round(1.2*max(mean_distance)) - np.round(0.8*min(mean_distance))\n corr_peak = np.nan(np.zeros((L,len(mean_distance))))\n\n for i_peak in range(len(mean_distance)):\n scale_min = np.round(0.80*mean_distance_new[i_peak]) - xmax_pattern - pixend\n if scale_min<0:\n scale_min = 0\n \n scale_max = np.round(1.2*mean_distance_new[i_peak]) - xmax_pattern - pixend\n scale_peak = np.arange(scale_min,scale_max+1)\n \n for i_scale in range(len(scale_peak)):\n template_resize_peak = np.concatenate([template_truncated,np.zeros(scale_peak[i_scale]),pattern])\n if len(I_detrend[:,0])>len(template_resize_peak):\n template_resize_peak1 = np.concatenate((template_resize_peak,np.zeros(len(I_detrend[:,0])-len(template_resize_peak))))\n corr_template = scipy.signal.correlate(I_detrend[:,0],template_resize_peak)\n \n if len(I_detrend[:,0])>len(template_resize_peak):\n val = np.dot(I_detrend[:,0],template_resize_peak1.T)\n else:\n I_detrend_2 = np.concatenate((I_detrend[:,0],np.zeros(len(template_resize_peak)-len(I_detrend[:,0]))))\n val = np.dot(I_detrend_2,template_resize_peak.T)\n corr_peak[i_scale,i_peak] = val\n \n if label.verbose==1:\n pl.xlim(0,len(I_detrend[:,0]))\n pl.plot(I_detrend[:,0])\n pl.plot(template_resize_peak)\n pl.show(block=False)\n \n pl.plot(corr_peak[:,i_peak],marker='+',linestyle='None',color='r')\n pl.title('correlation value against the displacement of the peak (px)')\n pl.show(block=False)\n \n max_peak = np.amax(corr_peak[:,i_peak])\n index_scale_peak = np.where(corr_peak[:,i_peak]==max_peak)\n good_scale_peak = scale_peak[index_scale_peak][0]\n Mcorr = Mcorr1\n Mcorr = np.resize(Mcorr,i_peak+2)\n Mcorr[i_peak+1] = np.amax(corr_peak[:,0:(i_peak+1)])\n flag = 0\n \n if i_peak>0:\n if (Mcorr[i_peak+1]-Mcorr[i_peak])<0.4*np.mean(Mcorr[1:i_peak+2]-Mcorr[0:i_peak+1]):\n test = i_peak\n template_resize_peak = np.concatenate((template_truncated,np.zeros(round(mean_distance[i_peak])-xmax_pattern-pixend),pattern))\n good_scale_peak = np.round(mean_distance[i_peak]) - xmax_pattern - pixend\n flag = 1\n if i_peak==0:\n if (Mcorr[i_peak+1] - Mcorr[i_peak])<0.4*Mcorr[0]:\n template_resize_peak = np.concatenate((template_truncated,np.zeros(round(mean_distance[i_peak])-xmax_pattern-pixend),pattern))\n good_scale_peak = round(mean_distance[i_peak]) - xmax_pattern - pixend\n flag = 1\n if flag==0:\n template_resize_peak=np.concatenate((template_truncated,np.zeros(good_scale_peak),pattern))\n \n mean_distance_new[i_peak] = good_scale_peak + xmax_pattern + pixend\n mean_ratio[i_peak] = np.mean(mean_distance_new[:,0:i_peak]/mean_distance[:,0:i_peak])\n \n template_truncated = template_resize_peak\n \n if label.verbose==1:\n pl.plot(I_detrend[:,0])\n pl.plot(template_truncated)\n pl.xlim(0,(len(I_detrend[:,0])-1))\n pl.show(block=False)\n\n minpeakvalue = 0.5\n loc_disk = np.arange(len(template_truncated))\n count = 0\n index_disk = 0\n for i in range(len(template_truncated)):\n if template_truncated[i]>=minpeakvalue:\n if i==0:\n if template_truncated[i]<template_truncated[i+1]:\n index_disk = i\n count = count + 1\n elif i==(len(template_truncated)-1):\n if template_truncated[i]<template_truncated[i-1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n else:\n if template_truncated[i]<template_truncated[i+1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n elif template_truncated[i]<template_truncated[i-1]:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n else:\n if i==0:\n index_disk = i\n count = count + 1\n else:\n index_disk = np.resize(index_disk,count+1)\n index_disk[len(index_disk)-1] = i\n count = count+1\n\n mask_disk = np.ones(len(template_truncated), dtype=bool)\n mask_disk[index_disk] = False\n loc_disk = loc_disk[mask_disk]\n X1 = np.where(loc_disk > I_detrend.shape[0])\n mask_disk1 = np.ones(len(loc_disk), dtype=bool)\n mask_disk1[X1] = False\n loc_disk = loc_disk[mask_disk1]\n loc_disk = loc_disk + start_centerline_y - 1\n\n #=====================================================================\n # Step 3: Building of the labeled centerline and surface\n #=====================================================================\n\n for i in range(len(loc_disk)):\n \n Index = np.array(np.where(y==loc_disk[i])).T\n lim_plus = Index + 5\n lim_minus = Index - 5\n \n if lim_minus<1:\n lim_minus=1\n if lim_plus>len(x):\n lim_plus=len(x)\n \n Vx = x[lim_plus] - x[lim_minus]\n Vz = z[lim_plus] - z[lim_minus]\n Vy = y[lim_plus] - y[lim_minus]\n \n d = Vx*x1[Index] + Vy*y[Index] + Vz*z[Index]\n \n intersection = np.ones(len(x))\n for j in range(len(x)):\n intersection[j] = np.abs((Vx*x[j]+Vy*y[j]+Vz*z[j]-d))\n \n min_intersection = np.amin(intersection)\n index_intersection = np.where(min_intersection==np.amin(intersection))\n loc_disk[i] = y[index_intersection]\n\n center_disk = np.array(centerline)\n for i in range(len(loc_disk)-1):\n tmp = center_disk[loc_disk[i]:loc_disk[i+1]]\n tmp[np.where(tmp==1)] = i + level_start\n center_disk[loc_disk[i]:loc_disk[i+1]] = tmp\n\n center_disk[np.where(center_disk==1)] = 0\n\n if level_start==2:\n center_disk[x[0],round(loc_disk[0] - C1C2_distance[1]):loc_disk[0],z[0]] = 2\n center_disk[x[0],round(loc_disk[0] - C1C2_distance[0] - C1C2_distance[1]):round(loc_disk[0] - C1C2_distance[1] - 1),z[0]] = 1\n\n if orientation!='ASR':\n a = orientation[0]\n b = orientation[1]\n c = orinetation[2]\n \n if a=='A': a='AP'\n if a=='P': a='PA'\n if a=='S': a='SI'\n if a=='I': a='IS'\n if a=='R': a='RL'\n if a=='L': a='LR'\n \n if b=='A': b='AP'\n if b=='P': b='PA'\n if b=='S': b='SI'\n if b=='I': b='IS'\n if b=='R': b='RL'\n if b=='L': b='LR'\n \n if c=='A': c='AP'\n if c=='P': c='PA'\n if c=='S': c='SI'\n if c=='I': c='IS'\n if c=='R': c='RL'\n if c=='L': c='LR'\n \n command = fsloutput + ' fslcpgeom ' + label.input_path + label.input_anat + '_reorient ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n \n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + label.input_path + label.input_anat + '_reorient ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)\n \n flag = 0\n if flag==1:\n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' -x y z ', output_centerline_vertebra\n result = commands.getoutput(command)\n \n command = fsloutput + ' fslorient -swaporient ' + output_centerline_vertebra\n result = commands.getoutput(command)\n \n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_centerline_vertebra\n result = commands.getoutput(command)\n \n if surface_do==1:\n command = fsloutput + 'fslswapdim ' + output_surface_vertebra + ' -x y z ' + output_surface_vertebra\n result = commands.getoutput(command)\n \n command = fsloutput + ' fslorient -swaporient ' + output_surface_vertebra\n result = commands.getoutput(command)\n \n command = fsloutput + ' fslswapdim ' + output_surface_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_surface_vertebra\n result = commands.getoutput(command)\n else:\n command = fsloutput + ' fslswapdim ' + output_centerline_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_centerline_vertebra\n result = commands.getoutput(command)\n \n if surface_do==1:\n command = fsloutput + ' fslswapdim ' + output_surface_vertebra + ' ' + a + ' ' + b + ' ' + c + ' ' + output_surface_vertebra\n result = commands.getoutput(command)\n \n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n \n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)\n else:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_centerline_vertebra + ' -d'\n result = commands.getoutput(command)\n \n if surface_do==1:\n command = fsloutput + ' fslcpgeom ' + input_anat + ' ' + output_surface_vertebra + ' -d'\n result = commands.getoutput(command)", "metadata": "root.labeling_vertebrae_T2", "header": "['module', '___EOS___']", "index": 764 }, { "content": "def j_detrend_new_v2(data,deg,func_type,robust):\n\n mask = 0\n size = data.shape\n if len(size)==2:\n size = np.resize(size,len(size)+2)\n size[2] = 1\n size[3] = 1\n \n if size[3]==1:\n data2d = data.T\n else:\n data2d = (np.reshape(data,(size[0]*size[1]*size[2],size[3]))).T\n\n if mask!=1:\n mask1d = np.reshape(mask,((size[0]*size[1]*size[2]),1))\n else:\n mask1d = np.ones(((size[0]*size[1]*size[2]),1))\n\n index_mask = np.where(mask1d!=0) \n nb_samples = data2d.shape[0]\n nb_vectors = len(index_mask)\n \n if func_type=='linear':\n D = (np.arange(-1,(1+2/(nb_samples-1)),2/(nb_samples-1))).T\n else:\n N = nb_samples\n K = deg\n d = 0\n n = np.arange(0,N)\n C = np.zeros((N,K))\n\n C[:,0] = np.ones(N)/math.sqrt(N)\n for k in range(1,K):\n C[:,k] = math.sqrt(2/N)*(np.cos(np.pi*(2*n+1)*(k-1)/(2*N)))\n \n D = C*(math.sqrt(nb_samples))\n\n data2d_d = np.zeros((size[0]*size[1]*size[2],size[3]))\n for i_vect in range(0,nb_vectors):\n data1d = data2d[index_mask[i_vect],:]\n \n if robust==1:\n l = 1\n else:\n l = np.dot(np.dot(np.linalg.pinv(np.dot(D.T,D)),D.T),data1d)\n Dl = np.dot(D,l)\n res_l = data1d - Dl \n data1d_d = data1d - Dl\n data2d_d[index_mask[i_vect],:] = data1d_d\n\n #display progress...\n\n #data2d_d = data2d_d.T\n #data_d = np.reshape(data2d_d,(size[0],size[1],size[2],size[3]))\n\n data_d = data2d_d\n return data_d", "metadata": "root.j_detrend_new_v2", "header": "['module', '___EOS___']", "index": 1331 } ]
[ { "span": "dims ", "start_line": 172, "start_column": 8, "end_line": 172, "end_column": 12 }, { "span": "dims ", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 12 }, { "span": "corr_template ", "start_line": 550, "start_column": 12, "end_line": 550, "end_column": 25 }, { "span": "test ", "start_line": 579, "start_column": 16, "end_line": 579, "end_column": 20 }, { "span": "result ", "start_line": 751, "start_column": 12, "end_line": 751, "end_column": 18 }, { "span": "result ", "start_line": 758, "start_column": 12, "end_line": 758, "end_column": 18 }, { "span": "input_surface_reorinet ", "start_line": 781, "start_column": 16, "end_line": 781, "end_column": 38 }, { "span": "input_surface_reorinet ", "start_line": 783, "start_column": 16, "end_line": 783, "end_column": 38 }, { "span": "dims ", "start_line": 811, "start_column": 8, "end_line": 811, "end_column": 12 }, { "span": "dims ", "start_line": 826, "start_column": 8, "end_line": 826, "end_column": 12 }, { "span": "xend ", "start_line": 1006, "start_column": 4, "end_line": 1006, "end_column": 8 }, { "span": "corr_template ", "start_line": 1116, "start_column": 12, "end_line": 1116, "end_column": 25 }, { "span": "test ", "start_line": 1145, "start_column": 16, "end_line": 1145, "end_column": 20 }, { "span": "result ", "start_line": 1316, "start_column": 12, "end_line": 1316, "end_column": 18 }, { "span": "result ", "start_line": 1323, "start_column": 12, "end_line": 1323, "end_column": 18 }, { "span": "d ", "start_line": 1359, "start_column": 8, "end_line": 1359, "end_column": 9 }, { "span": "res_l ", "start_line": 1378, "start_column": 8, "end_line": 1378, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "labeling", "\\u", "vert", "ebra", "e\\u", "T1_", "(_", "label_", ",_", "input", "\\u", "anat", "_", ",_", "input", "\\u", "center", "line_", ",_", "input", "\\u", "surface_", ",_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", ",_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", ",_", "surf", "ace", "\\u", "do_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "to", " ", "ni", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'\\\\", "n", "Copy", " ", "input", " ", "data", "...'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sct", ".", "run", "('", "cp", " ", "'", " ", "+", " ", "input", "\\u", "anat", " ", "+", " ", "'", " ", "tmp", ".", "anat", "'", " ", "+", " ", "ext", "\\u", "anat", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sct", ".", "run", "('", "fs", "lch", "filet", "ype", " ", "NI", "FT", "I", " ", "tmp", ".", "anat", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sct", ".", "run", "('", "cp", " ", "'", " ", "+", " ", "input", "\\u", "center", "line", " ", "+", " ", "'", " ", "tmp", ".", "center", "line", "'", " ", "+", " ", "ext", "\\u", "center", "line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sct", ".", "run", "('", "fs", "lch", "filet", "ype", " ", "NI", "FT", "I", " ", "tmp", ".", "center", "line", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Re", "orientation", " ", "of", " ", "the", " ", "data", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'", "fs", "lh", "d", " ", "'_", "+_", "input", "\\u", "anat", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orientation_", "=_", "result_", "[_", "result_", "._", "find_", "(_", "'", "qf", "orm", "\\u", "xor", "ient", "'_", ")_", "+_", "15_", "]_", "+_", "result_", "[_", "result_", "._", "find_", "(_", "'", "qf", "orm", "\\u", "yor", "ient", "'_", ")_", "+_", "15_", "]_", "+_", "result_", "[_", "result_", "._", "find_", "(_", "'", "qf", "orm", "\\u", "zor", "ient", "'_", ")_", "+_", "15_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "orientation_", "!=_", "'", "AS", "R", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "Re", "orient", " ", "input", " ", "volume", " ", "to", " ", "AP", " ", "SI", " ", "RL", " ", "orientation", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "sct", "_", "._", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "tmp", ".", "anat", " ", "AP", " ", "SI", " ", "RL", " ", "tmp", ".", "anat", "\\u", "orient", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "sct", "_", "._", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "tmp", ".", "center", "line", " ", "AP", " ", "SI", " ", "RL", " ", "tmp", ".", "center", "line", "\\u", "orient", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "load", "\\u", "images_", "\\u\\u\\uNL\\u\\u\\u_", "anat", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "'", "tmp", ".", "anat", "\\u", "orient", ".", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anat", "_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dims_", "=_", "hdr_", "[_", "'", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scales_", "=_", "hdr_", "[_", "'", "pix", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "surf", "ace", "\\u", "do", "==", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", "\\u", "file", " ", "=", " ", "nib", "abel", ".", "load", "(", "input", "\\u", "surf", "ace", "\\u", "reo", "rien", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", " ", "=", " ", "surf", "ace", "\\u", "file", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "center", "line", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "'", "tmp", ".", "center", "line", "\\u", "orient", ".", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "line_", "=_", "center", "line", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\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_", "#", " ", "load", "ing", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anat", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "anat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anat", "_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dims_", "=_", "hdr_", "[_", "'", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scales_", "=_", "hdr_", "[_", "'", "pix", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "surf", "ace", "\\u", "do", "==", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", "\\u", "file", " ", "=", " ", "nib", "abel", ".", "load", "(", "input", "\\u", "surf", "ace", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", " ", "=", " ", "surf", "ace", "\\u", "file", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "center", "line", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "center", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "line_", "=_", "center", "line", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "ion", " ", "of", " ", "the", " ", "profile", " ", "intensity_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shift", "\\u", "AP_", "=_", "label_", "._", "shift", "\\u", "AP_", "*_", "scales_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "AP_", "=_", "label_", "._", "size", "\\u", "AP_", "*_", "scales_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "RL", "_", "=_", "label_", "._", "size", "\\u", "RL", "_", "*_", "scales_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "uint16_", "(_", "anat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", ",_", "Z_", "=_", "np_", "._", "where_", "(_", "center", "line_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "center", "line", " ", "=", " ", "[", "anat", "[", "X", "[", "i", "]]", "[", "Y", "[", "i", "]]", "[", "Z", "[", "i", "]]", " ", "for", " ", "i", " ", "in", " ", "range", "(", "len", "(", "X", "))", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j_", "=_", "np_", "._", "argsort_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Y_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "X_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "Z_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eliminat", "ing", " ", "double", " ", "in", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "y_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "y_", "[_", "i_", "]_", "==_", "y_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "double_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "double_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "double_", ",_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "double_", "[_", "index_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "=_", "index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "y_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "[_", "index", "\\u", "double_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "y_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "x_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "z_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shift", " ", "the", " ", "center", "line", " ", "to", " ", "the", " ", "spine", " ", "of", " ", "shift", "\\u", "AP_", "\\u\\u\\uNL\\u\\u\\u_", "x1_", "=_", "np_", "._", "round_", "(_", "x_", "-_", "shift", "\\u", "AP_", "/_", "scales_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "build", " ", "intensity", " ", "profile", " ", "along", " ", "the", " ", "center", "line_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "y_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", "in_", "range_", "(_", "len_", "(_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "index_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "minus_", "=_", "index_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lim", "\\u", "minus_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "minus_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lim", "\\u", "plus_", ">=_", "len_", "(_", "x1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "len_", "(_", "x1_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normal", " ", "vector", " ", "of", " ", "the", " ", "orthogonal", " ", "plane", " ", "to", " ", "the", " ", "center", "line", " ", "i", ".", "e", " ", "tangent", " ", "vector", " ", "to", " ", "the", " ", "center", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Vx", "_", "=_", "x1_", "[_", "lim", "\\u", "plus_", "]_", "-_", "x1_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vz", "_", "=_", "z_", "[_", "lim", "\\u", "plus_", "]_", "-_", "z_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vy", "_", "=_", "y_", "[_", "lim", "\\u", "plus_", "]_", "-_", "y_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Vx", "_", "*_", "x1_", "[_", "index_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "index_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "slice", "\\u", "RL", "_", "in_", "range_", "(_", "2_", "*_", "np_", "._", "int_", "(_", "round_", "(_", "size", "\\u", "RL", "_", "/_", "scales_", "[_", "3_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "\\u", "slice", "\\u", "AP_", "in_", "range_", "(_", "2_", "*_", "np_", "._", "int_", "(_", "round_", "(_", "size", "\\u", "AP_", "/_", "scales_", "[_", "1_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "(_", "d_", "-_", "Vx", "_", "*_", "(_", "x1_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "AP_", "-_", "size", "\\u", "AP_", "-_", "1_", ")_", "-_", "Vz", "_", "*_", "z_", "[_", "index_", "]_", ")_", "/_", "Vy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", ">_", "anat", "_", "._", "shape_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "anat", "_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "I_", "[_", "index_", "]_", "=_", "I_", "[_", "index_", "]_", "+_", "anat", "_", "[_", "np_", "._", "int_", "(_", "round_", "(_", "x1_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "AP_", "-_", "size", "\\u", "AP_", "-_", "1_", ")_", ")_", ",_", "np_", "._", "int_", "(_", "round_", "(_", "result_", ")_", ")_", ",_", "np_", "._", "int_", "(_", "round_", "(_", "z_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "RL", "_", "-_", "size", "\\u", "RL", "_", "-_", "1_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "rend", "ing", " ", "Inten", "sity", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "center", "line", "\\u", "y_", "=_", "y_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "where_", "(_", "I_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "2_", "=_", "np_", "._", "ones_", "(_", "(_", "len_", "(_", "y_", ")_", ",_", "1_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "2_", "[_", "X_", ",_", "0_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "I", " ", "=", " ", "I", "[", "mask", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Inten", "sity", " ", "profile", " ", "along", " ", "the", " ", "shifted", " ", "spin", "al", " ", "cord", " ", "center", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "interpolat", "e", " ", "import", " ", "Uni", "varia", "te", "Spline", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fit", "\\u", "detr", "end", " ", "=", " ", "Uni", "varia", "te", "Spline", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", "I", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "P", "\\u", "detr", "end", " ", "=", " ", "fit", "\\u", "detr", "end", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "popt", ",", " ", "pco", "v", " ", "=", " ", "sci", "py", ".", "optimize", ".", "curve", "\\u", "fit", "(", "func", ",", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", "I", "[:,", "0", "],", "p0", "=", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "P", "\\u", "fit", " ", "=", " ", "func", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", " ", "popt", "[", "0", "],", " ", "popt", "[", "1", "],", " ", "popt", "[", "2", "],", " ", "popt", "[", "3", "],", " ", "popt", "[", "4", "],", " ", "popt", "[", "5", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "popt", " ", "=", " ", "np", ".", "polyf", "it", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", "I", "[:,", "0", "],", "9", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "P", "\\u", "fit", " ", "=", " ", "np", ".", "poly", "1d", "(", "popt", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "a", " ", "=", " ", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "b", " ", "=", " ", "np", ".", "zero", "s", "(", "len", "(", "I", "[:,", "0", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "a", " ", ",", "I", "[:,", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "nur", "bs", " ", "=", " ", "NU", "RB", "S", "(", "3", ",", "len", "(", "a", ")+", "100", ",", "[[", "a", "[", "n", "],", "I", "[", "n", ",", "0", "],", "b", "[", "n", "]]", " ", "for", " ", "n", " ", "in", " ", "range", "(", "len", "(", "I", "[:,", "0", "]))", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "P", " ", "=", " ", "nur", "bs", ".", "get", "Cour", "be", "3", "D", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "np", ".", "zero", "s", "((", "len", "(", "I", "[:,", "0", "])", ",", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", "[:,", "0", "]", " ", "=", " ", "I", "[:,", "0", "]", " ", "-", " ", "P", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", "[:,", "0", "]", " ", "=", " ", "I", "[:,", "0", "]", " ", "-", " ", "P", "\\u", "fit", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "sci", "py", ".", "signal", ".", "detr", "end", "(", "I", ",", "axis", "=", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "len", "(", "I", ")*", "scale", "s", "[", "1", "]<", "(", "300", "/", "scale", "s", "[", "1", "])", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "j", "\\u", "detr", "end", "\\u", "new", "\\u", "v2", "(", "I", ".", "T", ",", "5", ",'", "cos", "',", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "j", "\\u", "detr", "end", "\\u", "new", "\\u", "v2", "(", "I", ".", "T", ",", "20", ",'", "cos", "',", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "index", "\\u", "maxim", "a", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "count", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "range", "(", "len", "(", "I", "[:,", "0", "]))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "i", "==", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "I", "[", "i", ",", "0", "]>", "I", "[", "i", "+", "1", ",", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "index", "\\u", "maxim", "a", " ", "=", " ", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "count", " ", "=", " ", "count", " ", "+", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "eli", "f", " ", "i", "==", "(", "len", "(", "I", "[:,", "0", "])", "-1", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "I", "[", "i", ",", "0", "]<", "I", "[", "i", "-1", ",", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "index", "\\u", "maxim", "a", " ", "=", " ", "np", ".", "resiz", "e", "(", "index", "\\u", "maxim", "a", ",", "count", "+", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "index", "\\u", "maxim", "a", "[", "len", "(", "index", "\\u", "maxim", "a", ")-", "1", "]", " ", "=", " ", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "I", "[", "i", ",", "0", "]>", "I", "[", "i", "+", "1", ",", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "I", "[", "i", ",", "0", "]>", "I", "[", "i", "-1", ",", "0", "]:", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "index", "\\u", "maxim", "a", " ", "=", " ", "np", ".", "resiz", "e", "(", "index", "\\u", "maxim", "a", ",", "count", "+", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "index", "\\u", "maxim", "a", "[", "len", "(", "index", "\\u", "maxim", "a", ")-", "1", "]", " ", "=", " ", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "count", " ", "=", " ", "count", " ", "+", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "mean", "\\u", "maxim", "a", " ", "=", " ", "np", ".", "mean", "(", "I", "[", "index", "\\u", "maxim", "a", ",", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "threshol", "d", " ", "=", " ", "np", ".", "amin", "(", "I", "[", "index", "\\u", "maxim", "a", ",", "0", "])", " ", "+", " ", "(", "np", ".", "ama", "x", "(", "I", "[", "index", "\\u", "maxim", "a", ",", "0", "])", " ", "-", " ", "np", ".", "amin", "(", "I", "[", "index", "\\u", "maxim", "a", ",", "0", "]))", "/", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "indice", "s", " ", "=", " ", "np", ".", "array", "(", "np", ".", "where", "(", "I", "[", "index", "\\u", "maxim", "a", ",", "0", "]>", "threshol", "d", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "weight", "s", " ", "=", " ", "np", ".", "ones", "(", "len", "(", "I", "[:,", "0", "]))", "*", "float", "(", "1", "/", "float", "(", "len", "(", "I", "[:,", "0", "])", "-(", "len", "(", "indice", "s", ".", "T", "))))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "weight", "s", "[", "index", "\\u", "maxim", "a", "]", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "weight", "s", "[", "index", "\\u", "maxim", "a", "+", "1", "]", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "weight", "s", "[", "index", "\\u", "maxim", "a", "-1", "]", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tc", "k", " ", " ", "=", " ", "sci", "py", ".", "interpolat", "e", ".", "spl", "rep", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", "I", "[:,", "0", "],", "w", " ", "=", " ", "weight", "s", " ", ",", "xb", "=", "Non", "e", ",", " ", "xe", "=", "Non", "e", ",", " ", "k", "=", "3", ",", " ", "task", "=", "0", ",", " ", "s", "=", "60000", ",", " ", "t", "=", "Non", "e", ",", " ", "full", "\\u", "output", "=", "0", ",", " ", "per", "=", "0", ",", " ", "quie", "t", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "P", "\\u", "fit", " ", "=", " ", "sci", "py", ".", "interpolat", "e", ".", "spl", "ev", "(", "np", ".", "aran", "ge", "(", "len", "(", "I", "[:,", "0", "]))", ",", "tc", "k", ",", "der", "=", "0", ",", "ext", "=", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "freque", "nc", "y", " ", "=", " ", "sci", "py", ".", "fft", "pack", ".", "fft", "freq", "(", "len", "(", "I", "[:,", "0", "])", ",", " ", "d", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Fc", " ", "=", " ", "20_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Fs", " ", "=", " ", "2", "*", "np", ".", "ama", "x", "(", "freque", "nc", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", " ", "=", " ", "sci", "py", ".", "signal", ".", "fir", "win", "(", "numt", "aps", "=", "N", ",", " ", "cuto", "ff", "=", "np", ".", "ama", "x", "(", "freque", "nc", "y", ")/", "10", ",", " ", "window", "='", "hann", "',", "pass", "\\u", "zero", "=", "Tru", "e", ",", " ", "ny", "q", "=", "Fs", "/", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "P", "\\u", "fit", "=", "sci", "py", ".", "signal", ".", "lfil", "ter", "(", "h", ",", " ", "1.0", ",", " ", "I", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frequency_", "=_", "scipy_", "._", "fft", "pack_", "._", "fft", "freq_", "(_", "len_", "(_", "I_", "[_", ":_", ",_", "0_", "]_", ")_", ",_", "d_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "np_", "._", "abs_", "(_", "scipy_", "._", "fft", "pack_", "._", "fft_", "(_", "I_", "[_", ":_", ",_", "0_", "]_", ",_", "n_", "=_", "None_", ",_", "axis_", "=_", "-_", "1_", ",_", "overwrit", "e\\u", "x_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "z", ".", "shape", ",", "freque", "nc", "y", ".", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pl", ".", "plot", "(", "freque", "nc", "y", ",", "z", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pl", ".", "show", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "N", ",", " ", "Wn", " ", "=", " ", "sci", "py", ".", "signal", ".", "butt", "ord", "(", "wp", " ", "=", " ", "np", ".", "ama", "x", "(", "freque", "nc", "y", ")/", "10", ",", " ", "ws", " ", "=", " ", "(", "np", ".", "ama", "x", "(", "freque", "nc", "y", ")/", "10", ")+", " ", "0.", "2", ",", " ", "gpa", "ss", " ", "=", " ", "0.", "1", ",", " ", "gst", "op", " ", "=", " ", "50", ",", " ", "analog", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "N", ",", " ", "Wn", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "b", ",", " ", "a", " ", "=", " ", "sci", "py", ".", "signal", ".", "cheb", "y2", "(", "N", ",", " ", "20", ",", " ", "Wn", ",", " ", "bt", "ype", "='", "low", "',", " ", "analog", "=", "Fal", "se", ",", " ", "output", "='", "ba", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "Wn", "_", "=_", "np_", "._", "amax_", "(_", "frequency_", ")_", "/_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", "=_", "5_", "#", "Order", " ", "of", " ", "the", " ", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "b", ",", " ", "a", " ", "=", " ", "sci", "py", ".", "signal", ".", "butte", "r", "(", "N", ",", " ", "Wn", ",", " ", "bt", "ype", "='", "low", "',", " ", "analog", "=", "Fal", "se", ",", " ", "output", "='", "ba", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "b_", ",_", "a_", "=_", "scipy_", "._", "signal_", "._", "ii", "rfil", "ter_", "(_", "N_", ",_", "Wn", "_", ",_", "rp_", "=_", "None_", ",_", "rs_", "=_", "None_", ",_", "bt", "ype_", "=_", "'", "low", "'_", ",_", "analog", "_", "=_", "False_", ",_", "ftype_", "=_", "'", "bes", "sel", "'_", ",_", "output_", "=_", "'", "ba", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "I", "\\u", "fit_", "=_", "scipy_", "._", "signal_", "._", "filt", "filt_", "(_", "b_", ",_", "a_", ",_", "I_", "[_", ":_", ",_", "0_", "]_", ",_", "axis_", "=_", "-_", "1_", ",_", "pad", "type_", "=_", "'", "constant", "'_", ",_", "pad", "len_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "fit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "I", "\\u", "detr", "end_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "I_", "[_", ":_", ",_", "0_", "]_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", "=_", "I_", "[_", ":_", ",_", "0_", "]_", "-_", "I", "\\u", "fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "I", "\\u", "detr", "end_", "=_", "I", "\\u", "detr", "end_", "/_", "(_", "np_", "._", "amax_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Inten", "sity", " ", "profile", " ", "along", " ", "the", " ", "shifted", " ", "spin", "al", " ", "cord", " ", "center", "line", " ", "after", " ", "detr", "ending", " ", "and", " ", "basic", " ", "normaliza", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "1_", "=_", "input_", "(_", "'", "Is", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", "e", " ", "the", " ", "C1", " ", "or", " ", "C2", " ", "one", "?", " ", "if", " ", "ye", "s", ",", " ", "enter", " ", "1", " ", "other", "wis", "e", " ", "0", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info", "\\u", "1_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "start_", "=_", "input_", "(_", "'", "enter", " ", "the", " ", "level", " ", "of", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", " ", "-", " ", "choice", " ", "of", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", "l", " ", "level", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "start_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "distance", "\\u", "dict_", "=_", "scipy_", "._", "io_", "._", "loadm", "at_", "(_", "'/", "home", "/", "django", "/", "kra", "ju", "/", "code", "/", "spin", "alc", "ord", "toolb", "ox", "\\u", "dev", "/", "src", "/", "vert", "ebra", "l\\u", "labeling", "/", "mean", "\\u", "distance", ".", "mat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "distance_", "=_", "(_", "mean", "\\u", "distance", "\\u", "dict_", "._", "values_", "(_", ")_", "[_", "2_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C1", "C2", "\\u", "distance_", "=_", "mean", "\\u", "distance_", "[_", "0_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "distance_", "=_", "mean", "\\u", "distance_", "[_", "level", "\\u", "start_", "-_", "1_", ":_", "len_", "(_", "mean", "\\u", "distance_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "=_", "np_", "._", "linspace_", "(_", "-_", "5_", "/_", "scales_", "[_", "2_", "]_", ",_", "5_", "/_", "scales_", "[_", "2_", "]_", ",_", "round_", "(_", "11_", "/_", "scales_", "[_", "2_", "]_", ")_", ",_", "endpoint_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "(_", "np_", "._", "sinc", "_", "(_", "(_", "space_", "*_", "scales_", "[_", "2_", "]_", ")_", "/_", "15_", ")_", ")_", "**_", "(_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xma", "x", "\\u", "pattern_", "=_", "np_", "._", "argmax_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "step", " ", "1", " ", ":", " ", "Fin", "d", " ", "the", " ", "Fi", "rst", " ", "Peak", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "correlation", " ", "bet", "ween", " ", "the", " ", "pattern", " ", "and", " ", "intensity", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "#", "corr", "\\u", "all", " ", "=", " ", "sci", "py", ".", "signal", ".", "correlate", "(", "pattern", ",", "I", "\\u", "detr", "end", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "corr", "\\u", "all", " ", "=", " ", "mat", "plotlib", ".", "pypl", "ot", ".", "xco", "rr", "(", "pattern", ",", "I", "\\u", "detr", "end", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pattern", "1_", "=_", "np_", "._", "concatenate_", "(_", "(_", "pattern_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "len_", "(_", "pattern_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corr", "\\u", "all_", "=_", "scipy_", "._", "signal_", "._", "correlate", "_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "pattern", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "np_", "._", "arange_", "(_", "-_", "np_", "._", "round_", "(_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "/_", "2_", ")_", ")_", ",_", "np_", "._", "round_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "/_", "2_", ")_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", ">_", "0.1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "fp_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "fp_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "fp_", "[_", "index", "\\u", "fp_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "corr", "\\u", "all_", "[_", "mask", "\\u", "fp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "loc", "\\u", "corr_", "[_", "mask", "\\u", "fp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "loc", "\\u", "corr_", "-_", "I", "\\u", "detr", "end_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "first", "\\u", "peak_", "=_", "xma", "x", "\\u", "pattern_", "-_", "loc", "\\u", "corr_", "[_", "np_", "._", "amax_", "(_", "np_", "._", "where_", "(_", "value_", ">_", "1_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "1_", "=_", "value_", "[_", "np_", "._", "amax_", "(_", "np_", "._", "where_", "(_", "value_", ">_", "1_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "buildi", "ng", " ", "the", " ", "pattern", " ", "tha", "t", " ", "has", " ", "to", " ", "be", " ", "adde", "d", " ", "at", " ", "each", " ", "iterati", "on", " ", "in", " ", "step", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xma", "x", "\\u", "pattern_", "<_", "loc", "\\u", "first", "\\u", "peak_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "truncat", "ed_", "=_", "np_", "._", "concatenate_", "(_", "(_", "np_", "._", "zeros_", "(_", "(_", "loc", "\\u", "first", "\\u", "peak_", "-_", "xma", "x", "\\u", "pattern_", ")_", ")_", ",_", "pattern_", ")_", ")_", "\\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 ", " _", "template", "\\u", "truncat", "ed_", "=_", "pattern_", "[_", "(_", "xma", "x", "\\u", "pattern_", "-_", "loc", "\\u", "first", "\\u", "peak_", "-_", "1_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xen", "d_", "=_", "np_", "._", "amax_", "(_", "np_", "._", "where_", "(_", "template", "\\u", "truncat", "ed_", ">_", "0.02_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pix", "end_", "=_", "xen", "d_", "-_", "loc", "\\u", "first", "\\u", "peak_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "template", "\\u", "truncat", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Detect", "ion", " ", "of", " ", "Fi", "rst", " ", "Peak", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "ante", "rior", "-", "posterior", " ", "(", "mm", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "np_", "._", "arange_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", "]_", ">_", "0.15_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "+_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "-_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "+_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "-_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "p_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "p_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "p_", "[_", "index", "\\u", "p_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "I_", "=_", "I", "\\u", "detr", "end_", "[_", "mask", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "loc", "\\u", "peak", "\\u", "I_", "[_", "mask", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "peak", "\\u", "I_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "+_", "1_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\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_", "(_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "+_", "1_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", ")_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "np_", "._", "resize_", "(_", "index_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "[_", "len_", "(_", "index_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "-_", "1_", "]_", ")_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "np_", "._", "resize_", "(_", "index_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "[_", "len_", "(_", "index_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "I_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "value", "\\u", "I_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "I_", "[_", "index_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "I_", "=_", "value", "\\u", "I_", "[_", "mask", "\\u", "I_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "loc", "\\u", "peak", "\\u", "I_", "[_", "mask", "\\u", "I_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "interpolate_", "import_", "Uni", "varia", "te", "Spline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit_", "=_", "Uni", "varia", "te", "Spline", "_", "(_", "loc", "\\u", "peak", "\\u", "I_", ",_", "value", "\\u", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "fit_", "(_", "np_", "._", "arange_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "P_", "[_", "i_", "]_", ">_", "0.1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "=_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "/_", "P_", "[_", "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_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "xlim_", "(_", "0_", ",_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "loc", "\\u", "peak", "\\u", "I_", ",_", "value", "\\u", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "P_", ",_", "color_", "=_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Sett", "ing", " ", "values", " ", "of", " ", "peaks", " ", "at", " ", "one", " ", "by", " ", "fitting", " ", "a", " ", "smoothing", " ", "spline", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", " ", "(", "mm", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "normali", "zed", " ", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "step", " ", "2", " ", ":", " ", "Cross", " ", "correlation", " ", "bet", "ween", " ", "the", " ", "adjusted", " ", "template", " ", "and", " ", "the", " ", "intensity", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "local", " ", "movin", "g", " ", "of", " ", "template", "'", "s", " ", "peak", " ", "from", " ", "the", " ", "first", " ", "peak", " ", "alr", "ead", "y", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "distance", "\\u", "new_", "=_", "mean", "\\u", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "ratio_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "np_", "._", "round_", "(_", "1.2_", "*_", "max_", "(_", "mean", "\\u", "distance_", ")_", ")_", "-_", "np_", "._", "round_", "(_", "0.8_", "*_", "min_", "(_", "mean", "\\u", "distance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corr", "\\u", "peak_", "=_", "np_", "._", "zeros_", "(_", "(_", "L_", ",_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "peak_", "in_", "range_", "(_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale", "\\u", "min_", "=_", "np_", "._", "round_", "(_", "0.80", "_", "*_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scale", "\\u", "min_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale", "\\u", "min_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale", "\\u", "max_", "=_", "np_", "._", "round_", "(_", "1.2_", "*_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale", "\\u", "peak_", "=_", "np_", "._", "arange_", "(_", "scale", "\\u", "min_", ",_", "scale", "\\u", "max_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "scale_", "in_", "range_", "(_", "len_", "(_", "scale", "\\u", "peak_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "[_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "scale", "\\u", "peak_", "[_", "i", "\\u", "scale_", "]_", ")_", ",_", "pattern_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ">_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak", "1_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "corr", "\\u", "template_", "=_", "scipy_", "._", "signal_", "._", "correlate", "_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ">_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "np_", "._", "dot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "template", "\\u", "resiz", "e\\u", "peak", "1_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I", "\\u", "detr", "end", "\\u", "2_", "=_", "np_", "._", "concatenate_", "(_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "-_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "np_", "._", "dot_", "(_", "I", "\\u", "detr", "end", "\\u", "2_", ",_", "template", "\\u", "resiz", "e\\u", "peak_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "corr", "\\u", "peak_", "[_", "i", "\\u", "scale_", ",_", "i", "\\u", "peak_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "xlim_", "(_", "0_", ",_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pl_", "._", "plot_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", ",_", "marker_", "=_", "'+'_", ",_", "linestyle_", "=_", "'", "Non", "e", "'_", ",_", "color_", "=_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "correlation", " ", "value", " ", "against", " ", "the", " ", "displacement", " ", "of", " ", "the", " ", "peak", " ", "(", "px", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "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_", "max", "\\u", "peak_", "=_", "np_", "._", "amax_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "scale", "\\u", "peak_", "=_", "np_", "._", "where_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", "==_", "max", "\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "scale", "\\u", "peak_", "[_", "index", "\\u", "scale", "\\u", "peak_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "=_", "Mc", "orr", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "=_", "np_", "._", "resize_", "(_", "Mc", "orr", "_", ",_", "i", "\\u", "peak_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "=_", "np_", "._", "amax_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "0_", ":_", "(_", "i", "\\u", "peak_", "+_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i", "\\u", "peak_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "-_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "]_", ")_", "<_", "0.4_", "*_", "np_", "._", "mean_", "(_", "Mc", "orr", "_", "[_", "1_", ":_", "i", "\\u", "peak_", "+_", "2_", "]_", "-_", "Mc", "orr", "_", "[_", "0_", ":_", "i", "\\u", "peak_", "+_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "=_", "i", "\\u", "peak_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "np_", "._", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "peak_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "-_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "]_", ")_", "<_", "0.4_", "*_", "Mc", "orr", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flag_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "good", "\\u", "scale", "\\u", "peak_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", "=_", "good", "\\u", "scale", "\\u", "peak_", "+_", "xma", "x", "\\u", "pattern_", "+_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "ratio_", "[_", "i", "\\u", "peak_", "]_", "=_", "np_", "._", "mean_", "(_", "mean", "\\u", "distance", "\\u", "new_", "[_", ":_", ",_", "0_", ":_", "i", "\\u", "peak_", "]_", "/_", "mean", "\\u", "distance_", "[_", ":_", ",_", "0_", ":_", "i", "\\u", "peak_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "truncat", "ed_", "=_", "template", "\\u", "resiz", "e\\u", "peak_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "template", "\\u", "truncat", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlim_", "(_", "0_", ",_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "minp", "eak", "value_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "np_", "._", "arange_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", ">=_", "minp", "eak", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "disk_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "disk_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk_", "[_", "index", "\\u", "disk_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "[_", "mask", "\\u", "disk_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X1_", "=_", "np_", "._", "where_", "(_", "loc", "\\u", "disk_", ">_", "I", "\\u", "detr", "end_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk", "1_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk", "1_", "[_", "X1_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "[_", "mask", "\\u", "disk", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "+_", "start", "\\u", "center", "line", "\\u", "y_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "3", ":", " ", "Building", " ", "of", " ", "the", " ", "label", "ed", " ", "center", "line", " ", "and", " ", "surface_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Index_", "=_", "np_", "._", "array_", "(_", "np_", "._", "where_", "(_", "y_", "==_", "loc", "\\u", "disk_", "[_", "i_", "]_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "plus_", "=_", "Index_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "minus_", "=_", "Index_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lim", "\\u", "minus_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "minus_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lim", "\\u", "plus_", ">_", "len_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "len_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Vx", "_", "=_", "x_", "[_", "lim", "\\u", "plus_", "]_", "-_", "x_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vz", "_", "=_", "z_", "[_", "lim", "\\u", "plus_", "]_", "-_", "z_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vy", "_", "=_", "y_", "[_", "lim", "\\u", "plus_", "]_", "-_", "y_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Vx", "_", "*_", "x1_", "[_", "Index_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "Index_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "Index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "intersection_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "x_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intersection_", "[_", "j_", "]_", "=_", "np_", "._", "abs_", "(_", "(_", "Vx", "_", "*_", "x_", "[_", "j_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "j_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "j_", "]_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u", "intersection_", "=_", "np_", "._", "amin_", "(_", "intersection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "intersection_", "=_", "np_", "._", "where_", "(_", "min", "\\u", "intersection_", "==_", "np_", "._", "amin_", "(_", "intersection_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "[_", "i_", "]_", "=_", "y_", "[_", "index", "\\u", "intersection_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center", "\\u", "disk_", "=_", "center", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "center", "\\u", "disk_", "[_", ":_", ",_", "loc", "\\u", "disk_", "[_", "i_", "]_", ":_", "loc", "\\u", "disk_", "[_", "i_", "+_", "1_", "]_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "[_", "np_", "._", "where_", "(_", "tmp_", "==_", "1_", ")_", "]_", "=_", "i_", "+_", "level", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "disk_", "[_", ":_", ",_", "loc", "\\u", "disk_", "[_", "i_", "]_", ":_", "loc", "\\u", "disk_", "[_", "i_", "+_", "1_", "]_", ",_", ":_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center", "\\u", "disk_", "[_", "np_", "._", "where_", "(_", "center", "\\u", "disk_", "==_", "1_", ")_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "level", "\\u", "start_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "center", "\\u", "disk_", "[_", "x_", "[_", "0_", "]_", ",_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", ")_", ":_", "loc", "\\u", "disk_", "[_", "0_", "]_", ",_", "z_", "[_", "0_", "]_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "disk_", "[_", "x_", "[_", "0_", "]_", ",_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", ")_", ":_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", "-_", "1_", ")_", ",_", "z_", "[_", "0_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "orientation_", "!=_", "'", "AS", "R", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "orientation_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "orientation_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "orin", "eta", "tion_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "a_", "==_", "'", "A", "'_", ":_", "a_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "P", "'_", ":_", "a_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "S", "'_", ":_", "a_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "I", "'_", ":_", "a_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "R", "'_", ":_", "a_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "L", "'_", ":_", "a_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b_", "==_", "'", "A", "'_", ":_", "b_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "P", "'_", ":_", "b_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "S", "'_", ":_", "b_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "I", "'_", ":_", "b_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "R", "'_", ":_", "b_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "L", "'_", ":_", "b_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "c_", "==_", "'", "A", "'_", ":_", "c_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "P", "'_", ":_", "c_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "S", "'_", ":_", "c_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "I", "'_", ":_", "c_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "R", "'_", ":_", "c_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "L", "'_", ":_", "c_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flag_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flag_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "x", " ", "y", " ", "z", " ", "'_", ",_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lor", "ient", " ", "-", "swap", "orient", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "x", " ", "y", " ", "z", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lor", "ient", " ", "-", "swap", "orient", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\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 ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\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 ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "labeling", "\\u", "vert", "ebra", "e\\u", "T2_", "(_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "orientation_", "!=_", "'", "AS", "R", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "anat", "\\u", "reo", "rien", "t_", "=_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", ".", "ni", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "'", "cp", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "input", "\\u", "anat", "\\u", "reo", "rien", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "segmentation", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "center", "line", "\\u", "reo", "rien", "t_", "=_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", ".", "ni", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "center", "line", "\\u", "reo", "rien", "t_", "=_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", ".", "ni", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "'", "cp", " ", "'_", "+_", "input", "\\u", "center", "line_", "+_", "'", " ", "'_", "+_", "input", "\\u", "center", "line", "\\u", "reo", "rien", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "label_", "._", "segmentation", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "surf", "ace", "\\u", "reo", "rin", "et_", "=_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", ".", "ni", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "surf", "ace", "\\u", "reo", "rin", "et_", "=_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", ".", "ni", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "'", "cp", " ", "'_", "+_", "input", "\\u", "surface_", "+_", "'", " ", "'_", "+_", "input", "\\u", "surf", "ace", "\\u", "reo", "rien", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "For", "cing", " ", "Radio", "logical", " ", "Orientation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "reo", "rien", "t", " ", "data", " ", "to", " ", "get", " ", "PS", "L", " ", "orientation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", "'_", "+_", "'", " ", "AP", " ", "SI", " ", "RL", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "segmentation", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", "'_", "+_", "'", " ", "AP", " ", "SI", " ", "RL", " ", "'_", "+_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", "'_", "+_", "'", " ", "AP", " ", "SI", " ", "RL", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "center", "line_", "+_", "'\\u", "reo", "rien", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "label_", "._", "segmentation", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", "'_", "+_", "'", " ", "AP", " ", "SI", " ", "RL", " ", "'_", "+_", "label_", "._", "output", "\\u", "path_", "+_", "label_", "._", "segmentation", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", "'_", "+_", "'", " ", "AP", " ", "SI", " ", "RL", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "surface_", "+_", "'\\u", "reo", "rien", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "load", "\\u", "images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "anat", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "anat", "\\u", "reo", "rien", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anat", "_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dims_", "=_", "hdr_", "[_", "'", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scales_", "=_", "hdr_", "[_", "'", "pix", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "surf", "ace", "\\u", "do", "==", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", "\\u", "file", " ", "=", " ", "nib", "abel", ".", "load", "(", "input", "\\u", "surf", "ace", "\\u", "reo", "rien", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", " ", "=", " ", "surf", "ace", "\\u", "file", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "center", "line", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "center", "line", "\\u", "reo", "rien", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "line_", "=_", "center", "line", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\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_", "#", " ", "load", "ing", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anat", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "anat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anat", "_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "anat", "\\u", "file_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dims_", "=_", "hdr_", "[_", "'", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scales_", "=_", "hdr_", "[_", "'", "pix", "dim", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "surf", "ace", "\\u", "do", "==", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", "\\u", "file", " ", "=", " ", "nib", "abel", ".", "load", "(", "input", "\\u", "surf", "ace", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "surf", "ace", " ", "=", " ", "surf", "ace", "\\u", "file", ".", "get", "\\u", "data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "center", "line", "\\u", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "input", "\\u", "center", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "line_", "=_", "center", "line", "\\u", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\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_", "#", " ", "Calculat", "ion", " ", "of", " ", "the", " ", "profile", " ", "intensity_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shift", "\\u", "AP_", "=_", "label_", "._", "shift", "\\u", "AP_", "*_", "scales_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "AP_", "=_", "label_", "._", "size", "\\u", "AP_", "*_", "scales_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "\\u", "RL", "_", "=_", "label_", "._", "size", "\\u", "RL", "_", "*_", "scales_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "uint16_", "(_", "anat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", ",_", "Z_", "=_", "np_", "._", "where_", "(_", "center", "line_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "j_", "=_", "np_", "._", "argsort_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Y_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "X_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "Z_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eliminat", "ing", " ", "double", " ", "in", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "y_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "y_", "[_", "i_", "]_", "==_", "y_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "double_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "double_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "double_", ",_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "double_", "[_", "index_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "=_", "index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "y_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "[_", "index", "\\u", "double_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "y_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "x_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "z_", "[_", "mask_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shift", " ", "the", " ", "center", "line", " ", "to", " ", "the", " ", "spine", " ", "of", " ", "shift", "\\u", "AP_", "\\u\\u\\uNL\\u\\u\\u_", "x1_", "=_", "np_", "._", "round_", "(_", "x_", "-_", "shift", "\\u", "AP_", "/_", "scales_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "build", " ", "intensity", " ", "profile", " ", "along", " ", "the", " ", "center", "line_", "\\u\\u\\uNL\\u\\u\\u_", "I_", "=_", "np_", "._", "zeros_", "(_", "(_", "len_", "(_", "y_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", "in_", "range_", "(_", "len_", "(_", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "index_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "minus_", "=_", "index_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lim", "\\u", "minus_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "minus_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lim", "\\u", "plus_", ">=_", "len_", "(_", "x1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "len_", "(_", "x1_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normal", " ", "vector", " ", "of", " ", "the", " ", "orthogonal", " ", "plane", " ", "to", " ", "the", " ", "center", "line", " ", "i", ".", "e", " ", "tangent", " ", "vector", " ", "to", " ", "the", " ", "center", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Vx", "_", "=_", "x1_", "[_", "lim", "\\u", "plus_", "]_", "-_", "x1_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vz", "_", "=_", "z_", "[_", "lim", "\\u", "plus_", "]_", "-_", "z_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vy", "_", "=_", "y_", "[_", "lim", "\\u", "plus_", "]_", "-_", "y_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Vx", "_", "*_", "x1_", "[_", "index_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "index_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "slice", "\\u", "RL", "_", "in_", "range_", "(_", "2_", "*_", "np_", "._", "int_", "(_", "round_", "(_", "size", "\\u", "RL", "_", "/_", "scales_", "[_", "3_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "\\u", "slice", "\\u", "AP_", "in_", "range_", "(_", "2_", "*_", "np_", "._", "int_", "(_", "round_", "(_", "size", "\\u", "AP_", "/_", "scales_", "[_", "1_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "(_", "d_", "-_", "Vx", "_", "*_", "(_", "x1_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "AP_", "-_", "size", "\\u", "AP_", "-_", "1_", ")_", "-_", "Vz", "_", "*_", "z_", "[_", "index_", "]_", ")_", "/_", "Vy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", ">_", "anat", "_", "._", "shape_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "anat", "_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "I_", "[_", "index_", "]_", "=_", "I_", "[_", "index_", "]_", "+_", "anat", "_", "[_", "np_", "._", "int_", "(_", "round_", "(_", "x1_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "AP_", "-_", "size", "\\u", "AP_", "-_", "1_", ")_", ")_", ",_", "np_", "._", "int_", "(_", "round_", "(_", "result_", ")_", ")_", ",_", "np_", "._", "int_", "(_", "round_", "(_", "z_", "[_", "index_", "]_", "+_", "i", "\\u", "slice", "\\u", "RL", "_", "-_", "size", "\\u", "RL", "_", "-_", "1_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "rend", "ing", " ", "Inten", "sity", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "center", "line", "\\u", "y_", "=_", "y_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "where_", "(_", "I_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "2_", "=_", "np_", "._", "ones_", "(_", "(_", "len_", "(_", "y_", ")_", ",_", "1_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "2_", "[_", "X_", ",_", "0_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "I", " ", "=", " ", "I", "[", "mask", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Inten", "sity", " ", "profile", " ", "along", " ", "the", " ", "shifted", " ", "spin", "al", " ", "cord", " ", "center", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "I", "\\u", "detr", "end_", "=_", "scipy_", "._", "signal_", "._", "detr", "end_", "(_", "I_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "len", "(", "I", ")*", "scale", "s", "[", "1", "]<", "(", "300", "/", "scale", "s", "[", "1", "])", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "j", "\\u", "detr", "end", "\\u", "new", "\\u", "v2", "(", "I", ".", "T", ",", "5", ",'", "cos", "',", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "j", "\\u", "detr", "end", "\\u", "new", "\\u", "v2", "(", "I", ".", "T", ",", "10", ",'", "cos", "',", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", "\\u", "detr", "end", " ", "=", " ", "detr", "end", "\\u", "function", "(", "I", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "I", "\\u", "detr", "end_", "=_", "I", "\\u", "detr", "end_", "/_", "abs_", "(_", "(_", "np_", "._", "amin_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Inten", "sity", " ", "profile", " ", "along", " ", "the", " ", "shifted", " ", "spin", "al", " ", "cord", " ", "center", "line", " ", "after", " ", "detr", "ending", " ", "and", " ", "basic", " ", "normaliza", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "1_", "=_", "input_", "(_", "'", "Is", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", "e", " ", "the", " ", "C1", " ", "or", " ", "C2", " ", "one", "?", " ", "if", " ", "ye", "s", ",", " ", "enter", " ", "1", " ", "other", "wis", "e", " ", "0", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info", "\\u", "1_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "start_", "=_", "input_", "(_", "'", "enter", " ", "the", " ", "level", " ", "of", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", " ", "-", " ", "choice", " ", "of", " ", "the", " ", "more", " ", "ros", "tra", "l", " ", "vert", "ebra", "l", " ", "level", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "start_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "distance", "\\u", "dict_", "=_", "scipy_", "._", "io_", "._", "loadm", "at_", "(_", "'/", "home", "/", "django", "/", "kra", "ju", "/", "code", "/", "spin", "alc", "ord", "toolb", "ox", "\\u", "dev", "/", "src", "/", "vert", "ebra", "l\\u", "labeling", "/", "mean", "\\u", "distance", ".", "mat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "distance_", "=_", "(_", "mean", "\\u", "distance", "\\u", "dict_", "._", "values_", "(_", ")_", "[_", "2_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C1", "C2", "\\u", "distance_", "=_", "mean", "\\u", "distance_", "[_", "0_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "distance_", "=_", "mean", "\\u", "distance_", "[_", "level", "\\u", "start_", "+_", "1_", ":_", "len_", "(_", "mean", "\\u", "distance_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "=_", "np_", "._", "linspace_", "(_", "-_", "5_", "/_", "scales_", "[_", "2_", "]_", ",_", "5_", "/_", "scales_", "[_", "2_", "]_", ",_", "round_", "(_", "11_", "/_", "scales_", "[_", "2_", "]_", ")_", ",_", "endpoint_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "(_", "np_", "._", "sinc", "_", "(_", "(_", "space_", "*_", "scales_", "[_", "2_", "]_", ")_", "/_", "15_", ")_", ")_", "**_", "(_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xma", "x", "\\u", "pattern_", "=_", "np_", "._", "argmin_", "(_", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pix", "end_", "=_", "len_", "(_", "pattern_", ")_", "-_", "xma", "x", "\\u", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "step", " ", "1", " ", ":", " ", "find", " ", "the", " ", "first", " ", "peak_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "correlation", " ", "bet", "ween", " ", "the", " ", "pattern", " ", "and", " ", "intensity", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "#", "corr", "\\u", "all", " ", "=", " ", "sci", "py", ".", "signal", ".", "correlate", "(", "pattern", ",", "I", "\\u", "detr", "end", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "corr", "\\u", "all", " ", "=", " ", "mat", "plotlib", ".", "pypl", "ot", ".", "xco", "rr", "(", "pattern", ",", "I", "\\u", "detr", "end", "[:,", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pattern", "1_", "=_", "np_", "._", "concatenate_", "(_", "(_", "pattern_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "len_", "(_", "pattern_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corr", "\\u", "all_", "=_", "scipy_", "._", "signal_", "._", "correlate", "_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "pattern", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "np_", "._", "arange_", "(_", "-_", "np_", "._", "round_", "(_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "/_", "2_", ")_", ")_", ",_", "np_", "._", "round_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "/_", "2_", ")_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", ">_", "0.1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "corr", "\\u", "all_", "[_", "i_", "]_", "<_", "corr", "\\u", "all_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "fp_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "fp_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "fp_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "fp_", "[_", "len_", "(_", "index", "\\u", "fp_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "fp_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "corr", "\\u", "all_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "fp_", "[_", "index", "\\u", "fp_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "corr", "\\u", "all_", "[_", "mask", "\\u", "fp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "loc", "\\u", "corr_", "[_", "mask", "\\u", "fp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loc", "\\u", "corr_", "=_", "loc", "\\u", "corr_", "-_", "I", "\\u", "detr", "end_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loc", "\\u", "first", "\\u", "peak_", "=_", "xma", "x", "\\u", "pattern_", "-_", "loc", "\\u", "corr_", "[_", "np_", "._", "amax_", "(_", "np_", "._", "where_", "(_", "value_", ">_", "0.6_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "1_", "=_", "value_", "[_", "np_", "._", "amax_", "(_", "np_", "._", "where_", "(_", "value_", ">_", "0.6_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "buildi", "ng", " ", "the", " ", "pattern", " ", "tha", "t", " ", "has", " ", "to", " ", "be", " ", "adde", "d", " ", "at", " ", "each", " ", "iterati", "on", " ", "in", " ", "step", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "loc", "\\u", "first", "\\u", "peak_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "truncat", "ed_", "=_", "pattern_", "[_", "(_", "loc", "\\u", "first", "\\u", "peak_", "+_", "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 ", " _", "template", "\\u", "truncat", "ed_", "=_", "np_", "._", "concatenate_", "(_", "(_", "np_", "._", "zeros_", "(_", "abs_", "(_", "loc", "\\u", "first", "\\u", "peak_", ")_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xen", "d_", "=_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "template", "\\u", "truncat", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Detect", "ion", " ", "of", " ", "Fi", "rst", " ", "Peak", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "ante", "rior", "-", "posterior", " ", "(", "mm", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "smoothing", " ", "the", " ", "intensity", " ", "curve", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", "=_", "scipy_", "._", "ndimage_", "._", "filters_", "._", "gauss", "ian", "\\u", "filter", "1d_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "np_", "._", "arange_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", "]_", ">_", "0.05_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "+_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "-_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "+_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "<_", "I", "\\u", "detr", "end_", "[_", "i_", "-_", "1_", ",_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "p_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "p_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "p_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "p_", "[_", "len_", "(_", "index", "\\u", "p_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "p_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "p_", "[_", "index", "\\u", "p_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "I_", "=_", "I", "\\u", "detr", "end_", "[_", "mask", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "loc", "\\u", "peak", "\\u", "I_", "[_", "mask", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "peak", "\\u", "I_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "+_", "1_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\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_", "(_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "+_", "1_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", ")_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "np_", "._", "resize_", "(_", "index_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "[_", "len_", "(_", "index_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "]_", "-_", "loc", "\\u", "peak", "\\u", "I_", "[_", "i_", "-_", "1_", "]_", ")_", "<_", "round_", "(_", "10_", "/_", "scales_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "np_", "._", "resize_", "(_", "index_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "[_", "len_", "(_", "index_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "I_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "value", "\\u", "I_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "I_", "[_", "index_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "I_", "=_", "-_", "value", "\\u", "I_", "[_", "mask", "\\u", "I_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "peak", "\\u", "I_", "=_", "loc", "\\u", "peak", "\\u", "I_", "[_", "mask", "\\u", "I_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "interpolate_", "import_", "Uni", "varia", "te", "Spline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit_", "=_", "Uni", "varia", "te", "Spline", "_", "(_", "loc", "\\u", "peak", "\\u", "I_", ",_", "value", "\\u", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "fit_", "(_", "np_", "._", "arange_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "xlim_", "(_", "0_", ",_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "loc", "\\u", "peak", "\\u", "I_", ",_", "value", "\\u", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "Sett", "ing", " ", "values", " ", "of", " ", "peaks", " ", "at", " ", "one", " ", "by", " ", "fitting", " ", "a", " ", "smoothing", " ", "spline", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlabel_", "(_", "'", "direction", " ", "super", "ior", "-", "infer", "ior", " ", "(", "mm", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "ylabel_", "(_", "'", "normali", "zed", " ", "intensity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "P_", "[_", "i_", "]_", ">_", "0.1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "=_", "I", "\\u", "detr", "end_", "[_", "i_", ",_", "0_", "]_", "/_", "abs_", "(_", "P_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "step", " ", "2", " ", ":", " ", "Cross", " ", "correlation", " ", "bet", "ween", " ", "the", " ", "adjusted", " ", "template", " ", "and", " ", "the", " ", "intensity", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "local", " ", "movin", "g", " ", "of", " ", "template", "'", "s", " ", "peak", " ", "from", " ", "the", " ", "first", " ", "peak", " ", "alr", "ead", "y", " ", "found_", "\\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_", "mean", "\\u", "distance", "\\u", "new_", "=_", "mean", "\\u", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "ratio_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "np_", "._", "round_", "(_", "1.2_", "*_", "max_", "(_", "mean", "\\u", "distance_", ")_", ")_", "-_", "np_", "._", "round_", "(_", "0.8_", "*_", "min_", "(_", "mean", "\\u", "distance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corr", "\\u", "peak_", "=_", "np_", "._", "nan_", "(_", "np_", "._", "zeros_", "(_", "(_", "L_", ",_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "peak_", "in_", "range_", "(_", "len_", "(_", "mean", "\\u", "distance_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale", "\\u", "min_", "=_", "np_", "._", "round_", "(_", "0.80", "_", "*_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scale", "\\u", "min_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale", "\\u", "min_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale", "\\u", "max_", "=_", "np_", "._", "round_", "(_", "1.2_", "*_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale", "\\u", "peak_", "=_", "np_", "._", "arange_", "(_", "scale", "\\u", "min_", ",_", "scale", "\\u", "max_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "\\u", "scale_", "in_", "range_", "(_", "len_", "(_", "scale", "\\u", "peak_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "[_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "scale", "\\u", "peak_", "[_", "i", "\\u", "scale_", "]_", ")_", ",_", "pattern_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ">_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak", "1_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "corr", "\\u", "template_", "=_", "scipy_", "._", "signal_", "._", "correlate", "_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ">_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "np_", "._", "dot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "template", "\\u", "resiz", "e\\u", "peak", "1_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "I", "\\u", "detr", "end", "\\u", "2_", "=_", "np_", "._", "concatenate_", "(_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "-_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "np_", "._", "dot_", "(_", "I", "\\u", "detr", "end", "\\u", "2_", ",_", "template", "\\u", "resiz", "e\\u", "peak_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "corr", "\\u", "peak_", "[_", "i", "\\u", "scale_", ",_", "i", "\\u", "peak_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "xlim_", "(_", "0_", ",_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "template", "\\u", "resiz", "e\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pl_", "._", "plot_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", ",_", "marker_", "=_", "'+'_", ",_", "linestyle_", "=_", "'", "Non", "e", "'_", ",_", "color_", "=_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "title_", "(_", "'", "correlation", " ", "value", " ", "against", " ", "the", " ", "displacement", " ", "of", " ", "the", " ", "peak", " ", "(", "px", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "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_", "max", "\\u", "peak_", "=_", "np_", "._", "amax_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "scale", "\\u", "peak_", "=_", "np_", "._", "where_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "i", "\\u", "peak_", "]_", "==_", "max", "\\u", "peak_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "scale", "\\u", "peak_", "[_", "index", "\\u", "scale", "\\u", "peak_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "=_", "Mc", "orr", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "=_", "np_", "._", "resize_", "(_", "Mc", "orr", "_", ",_", "i", "\\u", "peak_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "=_", "np_", "._", "amax_", "(_", "corr", "\\u", "peak_", "[_", ":_", ",_", "0_", ":_", "(_", "i", "\\u", "peak_", "+_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i", "\\u", "peak_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "-_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "]_", ")_", "<_", "0.4_", "*_", "np_", "._", "mean_", "(_", "Mc", "orr", "_", "[_", "1_", ":_", "i", "\\u", "peak_", "+_", "2_", "]_", "-_", "Mc", "orr", "_", "[_", "0_", ":_", "i", "\\u", "peak_", "+_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "=_", "i", "\\u", "peak_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "np_", "._", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "peak_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "+_", "1_", "]_", "-_", "Mc", "orr", "_", "[_", "i", "\\u", "peak_", "]_", ")_", "<_", "0.4_", "*_", "Mc", "orr", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "scale", "\\u", "peak_", "=_", "round_", "(_", "mean", "\\u", "distance_", "[_", "i", "\\u", "peak_", "]_", ")_", "-_", "xma", "x", "\\u", "pattern_", "-_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flag_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flag_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "resiz", "e\\u", "peak_", "=_", "np_", "._", "concatenate_", "(_", "(_", "template", "\\u", "truncat", "ed_", ",_", "np_", "._", "zeros_", "(_", "good", "\\u", "scale", "\\u", "peak_", ")_", ",_", "pattern_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean", "\\u", "distance", "\\u", "new_", "[_", "i", "\\u", "peak_", "]_", "=_", "good", "\\u", "scale", "\\u", "peak_", "+_", "xma", "x", "\\u", "pattern_", "+_", "pix", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "ratio_", "[_", "i", "\\u", "peak_", "]_", "=_", "np_", "._", "mean_", "(_", "mean", "\\u", "distance", "\\u", "new_", "[_", ":_", ",_", "0_", ":_", "i", "\\u", "peak_", "]_", "/_", "mean", "\\u", "distance_", "[_", ":_", ",_", "0_", ":_", "i", "\\u", "peak_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "truncat", "ed_", "=_", "template", "\\u", "resiz", "e\\u", "peak_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label_", "._", "verbose_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pl_", "._", "plot_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "plot_", "(_", "template", "\\u", "truncat", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "xlim_", "(_", "0_", ",_", "(_", "len_", "(_", "I", "\\u", "detr", "end_", "[_", ":_", ",_", "0_", "]_", ")_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pl_", "._", "show_", "(_", "block_", "=_", "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_", "minp", "eak", "value_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "np_", "._", "arange_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", ">=_", "minp", "eak", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\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_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "template", "\\u", "truncat", "ed_", "[_", "i_", "]_", "<_", "template", "\\u", "truncat", "ed_", "[_", "i_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "disk_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "disk_", "=_", "np_", "._", "resize_", "(_", "index", "\\u", "disk_", ",_", "count_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "disk_", "[_", "len_", "(_", "index", "\\u", "disk_", ")_", "-_", "1_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "\\u", "disk_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "template", "\\u", "truncat", "ed_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk_", "[_", "index", "\\u", "disk_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "[_", "mask", "\\u", "disk_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X1_", "=_", "np_", "._", "where_", "(_", "loc", "\\u", "disk_", ">_", "I", "\\u", "detr", "end_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk", "1_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", ",_", "dtype_", "=_", "bool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "disk", "1_", "[_", "X1_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "[_", "mask", "\\u", "disk", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "=_", "loc", "\\u", "disk_", "+_", "start", "\\u", "center", "line", "\\u", "y_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "3", ":", " ", "Building", " ", "of", " ", "the", " ", "label", "ed", " ", "center", "line", " ", "and", " ", "surface_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Index_", "=_", "np_", "._", "array_", "(_", "np_", "._", "where_", "(_", "y_", "==_", "loc", "\\u", "disk_", "[_", "i_", "]_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "plus_", "=_", "Index_", "+_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "\\u", "minus_", "=_", "Index_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lim", "\\u", "minus_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "minus_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lim", "\\u", "plus_", ">_", "len_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lim", "\\u", "plus_", "=_", "len_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Vx", "_", "=_", "x_", "[_", "lim", "\\u", "plus_", "]_", "-_", "x_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vz", "_", "=_", "z_", "[_", "lim", "\\u", "plus_", "]_", "-_", "z_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Vy", "_", "=_", "y_", "[_", "lim", "\\u", "plus_", "]_", "-_", "y_", "[_", "lim", "\\u", "minus_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Vx", "_", "*_", "x1_", "[_", "Index_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "Index_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "Index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "intersection_", "=_", "np_", "._", "ones_", "(_", "len_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "x_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intersection_", "[_", "j_", "]_", "=_", "np_", "._", "abs_", "(_", "(_", "Vx", "_", "*_", "x_", "[_", "j_", "]_", "+_", "Vy", "_", "*_", "y_", "[_", "j_", "]_", "+_", "Vz", "_", "*_", "z_", "[_", "j_", "]_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u", "intersection_", "=_", "np_", "._", "amin_", "(_", "intersection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "intersection_", "=_", "np_", "._", "where_", "(_", "min", "\\u", "intersection_", "==_", "np_", "._", "amin_", "(_", "intersection_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "disk_", "[_", "i_", "]_", "=_", "y_", "[_", "index", "\\u", "intersection_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center", "\\u", "disk_", "=_", "np_", "._", "array_", "(_", "center", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "loc", "\\u", "disk_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "center", "\\u", "disk_", "[_", "loc", "\\u", "disk_", "[_", "i_", "]_", ":_", "loc", "\\u", "disk_", "[_", "i_", "+_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "[_", "np_", "._", "where_", "(_", "tmp_", "==_", "1_", ")_", "]_", "=_", "i_", "+_", "level", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "disk_", "[_", "loc", "\\u", "disk_", "[_", "i_", "]_", ":_", "loc", "\\u", "disk_", "[_", "i_", "+_", "1_", "]_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center", "\\u", "disk_", "[_", "np_", "._", "where_", "(_", "center", "\\u", "disk_", "==_", "1_", ")_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "level", "\\u", "start_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "center", "\\u", "disk_", "[_", "x_", "[_", "0_", "]_", ",_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", ")_", ":_", "loc", "\\u", "disk_", "[_", "0_", "]_", ",_", "z_", "[_", "0_", "]_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "disk_", "[_", "x_", "[_", "0_", "]_", ",_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", ")_", ":_", "round_", "(_", "loc", "\\u", "disk_", "[_", "0_", "]_", "-_", "C1", "C2", "\\u", "distance_", "[_", "1_", "]_", "-_", "1_", ")_", ",_", "z_", "[_", "0_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "orientation_", "!=_", "'", "AS", "R", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "orientation_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "orientation_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "orin", "eta", "tion_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "a_", "==_", "'", "A", "'_", ":_", "a_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "P", "'_", ":_", "a_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "S", "'_", ":_", "a_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "I", "'_", ":_", "a_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "R", "'_", ":_", "a_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "'", "L", "'_", ":_", "a_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b_", "==_", "'", "A", "'_", ":_", "b_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "P", "'_", ":_", "b_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "S", "'_", ":_", "b_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "I", "'_", ":_", "b_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "R", "'_", ":_", "b_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "==_", "'", "L", "'_", ":_", "b_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "c_", "==_", "'", "A", "'_", ":_", "c_", "=_", "'", "AP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "P", "'_", ":_", "c_", "=_", "'", "PA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "S", "'_", ":_", "c_", "=_", "'", "SI", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "I", "'_", ":_", "c_", "=_", "'", "IS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "R", "'_", ":_", "c_", "=_", "'", "RL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "'", "L", "'_", ":_", "c_", "=_", "'", "LR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "label_", "._", "input", "\\u", "path_", "+_", "label_", "._", "input", "\\u", "anat", "_", "+_", "'\\u", "reo", "rien", "t", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flag_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flag_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "x", " ", "y", " ", "z", " ", "'_", ",_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lor", "ient", " ", "-", "swap", "orient", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "x", " ", "y", " ", "z", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lor", "ient", " ", "-", "swap", "orient", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\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 ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "ls", "wap", "dim", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "'_", "+_", "a_", "+_", "'", " ", "'_", "+_", "b_", "+_", "'", " ", "'_", "+_", "c_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\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 ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "center", "line", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "surf", "ace", "\\u", "do_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", " ", "fs", "lc", "pge", "om", " ", "'_", "+_", "input", "\\u", "anat", "_", "+_", "'", " ", "'_", "+_", "output", "\\u", "surf", "ace", "\\u", "vert", "ebra", "_", "+_", "'", " ", "-", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "commands_", "._", "getoutput_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "j", "\\u", "detr", "end", "\\u", "new", "\\u", "v2_", "(_", "data_", ",_", "deg_", ",_", "func", "\\u", "type_", ",_", "robust", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "data_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "size_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "np_", "._", "resize_", "(_", "size_", ",_", "len_", "(_", "size_", ")_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "[_", "2_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "[_", "3_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "size_", "[_", "3_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "2d_", "=_", "data_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "2d_", "=_", "(_", "np_", "._", "reshape_", "(_", "data_", ",_", "(_", "size_", "[_", "0_", "]_", "*_", "size_", "[_", "1_", "]_", "*_", "size_", "[_", "2_", "]_", ",_", "size_", "[_", "3_", "]_", ")_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mask_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask", "1d_", "=_", "np_", "._", "reshape_", "(_", "mask_", ",_", "(_", "(_", "size_", "[_", "0_", "]_", "*_", "size_", "[_", "1_", "]_", "*_", "size_", "[_", "2_", "]_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask", "1d_", "=_", "np_", "._", "ones_", "(_", "(_", "(_", "size_", "[_", "0_", "]_", "*_", "size_", "[_", "1_", "]_", "*_", "size_", "[_", "2_", "]_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index", "\\u", "mask_", "=_", "np_", "._", "where_", "(_", "mask", "1d_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "samples_", "=_", "data", "2d_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "vectors_", "=_", "len_", "(_", "index", "\\u", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "func", "\\u", "type_", "==_", "'", "linear", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "(_", "np_", "._", "arange_", "(_", "-_", "1_", ",_", "(_", "1_", "+_", "2_", "/_", "(_", "nb", "\\u", "samples_", "-_", "1_", ")_", ")_", ",_", "2_", "/_", "(_", "nb", "\\u", "samples_", "-_", "1_", ")_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "nb", "\\u", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "deg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "np_", "._", "arange_", "(_", "0_", ",_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "zeros_", "(_", "(_", "N_", ",_", "K_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "[_", ":_", ",_", "0_", "]_", "=_", "np_", "._", "ones_", "(_", "N_", ")_", "/_", "math_", "._", "sqrt_", "(_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "1_", ",_", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "[_", ":_", ",_", "k_", "]_", "=_", "math_", "._", "sqrt_", "(_", "2_", "/_", "N_", ")_", "*_", "(_", "np_", "._", "cos_", "(_", "np_", "._", "pi_", "*_", "(_", "2_", "*_", "n_", "+_", "1_", ")_", "*_", "(_", "k_", "-_", "1_", ")_", "/_", "(_", "2_", "*_", "N_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "D_", "=_", "C_", "*_", "(_", "math_", "._", "sqrt_", "(_", "nb", "\\u", "samples_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "2d", "\\u", "d_", "=_", "np_", "._", "zeros_", "(_", "(_", "size_", "[_", "0_", "]_", "*_", "size_", "[_", "1_", "]_", "*_", "size_", "[_", "2_", "]_", ",_", "size_", "[_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "\\u", "vect_", "in_", "range_", "(_", "0_", ",_", "nb", "\\u", "vectors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "1d_", "=_", "data", "2d_", "[_", "index", "\\u", "mask_", "[_", "i", "\\u", "vect_", "]_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "robust", "_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "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 ", " _", "l_", "=_", "np_", "._", "dot_", "(_", "np_", "._", "dot_", "(_", "np_", "._", "linalg_", "._", "pin", "v_", "(_", "np_", "._", "dot_", "(_", "D_", "._", "T_", ",_", "D_", ")_", ")_", ",_", "D_", "._", "T_", ")_", ",_", "data", "1d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Dl", "_", "=_", "np_", "._", "dot_", "(_", "D_", ",_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "l_", "=_", "data", "1d_", "-_", "Dl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "1d", "\\u", "d_", "=_", "data", "1d_", "-_", "Dl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "2d", "\\u", "d_", "[_", "index", "\\u", "mask_", "[_", "i", "\\u", "vect_", "]_", ",_", ":_", "]_", "=_", "data", "1d", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "display", " ", "progress", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", "2d", "\\u", "d", " ", "=", " ", "data", "2d", "\\u", "d", ".", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data\\u", "d", " ", "=", " ", "np", ".", "reshape", "(", "data", "2d", "\\u", "d", ",(", "size", "[", "0", "],", "size", "[", "1", "],", "size", "[", "2", "],", "size", "[", "3", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "d_", "=_", "data", "2d", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data\\u", "d_", "\\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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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, 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 ]
Unused import
uwescience/raco/raco/myrial/type_tests.py
[ { "content": "\"\"\"Various tests of type safety.\"\"\"\nimport unittest\n\nfrom raco.fakedb import FakeDatabase\nfrom raco.scheme import Scheme\nfrom raco.myrial.myrial_test import MyrialTestCase\nfrom raco.expression import TypeSafetyViolation\nfrom collections import Counter\nfrom raco import types\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TypeTests(MyrialTestCase):\n schema = Scheme(\n [(\"clong\", types.LONG_TYPE),\n (\"cint\", types.INT_TYPE),\n (\"cstring\", types.STRING_TYPE),\n (\"cfloat\", types.DOUBLE_TYPE),\n (\"cbool\", types.BOOLEAN_TYPE),\n (\"cdate\", types.DATETIME_TYPE)])\n\n\n\n\n\n\n\n\n\n\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.TypeTests", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def setUp(self):\n super(TypeTests, self).setUp()\n self.db.ingest(\"public:adhoc:mytable\", Counter(), TypeTests.schema)", "metadata": "root.TypeTests.setUp", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_noop(self):\n query = \"\"\"\n X = SCAN(public:adhoc:mytable);\n STORE(X, OUTPUT);\n \"\"\"\n\n self.check_scheme(query, TypeTests.schema)", "metadata": "root.TypeTests.test_noop", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_invalid_eq1(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT clong=cstring];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_eq1", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def test_invalid_eq2(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat=cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_eq2", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_invalid_ge(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat>=cstring];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_ge", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_invalid_lt(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat<cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_lt", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_invalid_and(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat AND cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_and", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_invalid_or_both_bad(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat OR cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_or_both_bad", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def test_invalid_or_right_bad(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cbool OR cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_or_right_bad", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_invalid_or_left_bad(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat OR cbool];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_or_left_bad", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def test_invalid_not(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT not cdate];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_not", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def test_invalid_plus(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cdate + cint];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_plus", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 104 }, { "content": " def test_invalid_times(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cdate * cstring];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_times", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test_invalid_divide(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cdate / clong];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_divide", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 120 }, { "content": " def test_divide(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat / cfloat AS y];\n STORE(X, OUTPUT);\n \"\"\"\n schema = Scheme([('y', types.DOUBLE_TYPE)])\n self.check_scheme(query, schema)", "metadata": "root.TypeTests.test_divide", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 128 }, { "content": " def test_idivide(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cfloat // cint AS y];\n STORE(X, OUTPUT);\n \"\"\"\n schema = Scheme([('y', types.LONG_TYPE)])\n self.check_scheme(query, schema)", "metadata": "root.TypeTests.test_idivide", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_mod(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT clong % cint AS y];\n STORE(X, OUTPUT);\n \"\"\"\n schema = Scheme([('y', types.LONG_TYPE)])\n self.check_scheme(query, schema)", "metadata": "root.TypeTests.test_mod", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 144 }, { "content": " def test_invalid_mod(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT cdate % cint];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_mod", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_neg(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT -cstring];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_neg", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_invalid_case1(self):\n query = \"\"\"\n t = SCAN(public:adhoc:mytable);\n rich = [FROM t EMIT\n CASE WHEN clong <= 5000 THEN \"poor\"\n WHEN clong <= 25000 THEN 5.5\n ELSE \"rich\" END];\n STORE(rich, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_case1", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_invalid_case2(self):\n query = \"\"\"\n t = SCAN(public:adhoc:mytable);\n rich = [FROM t EMIT\n CASE WHEN clong <= 5000 THEN \"poor\"\n WHEN clong <= 25000 THEN \"middle class\"\n ELSE 1922 END];\n STORE(rich, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_case2", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_invalid_cos(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS Y\n WHERE cos(cbool) > 1.0 EMIT *];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_cos", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test_invalid_floor(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS Y\n WHERE floor(cbool) > 1.0 EMIT *];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_floor", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 201 }, { "content": " def test_invalid_ceil(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS Y\n WHERE ceil(clong) == \"Hello world\" EMIT *];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_ceil", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_invalid_tan(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS Y\n WHERE tan(cstring) > 1.0 EMIT *];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_tan", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def test_invalid_pow(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT POW(cfloat, cstring)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_pow", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 228 }, { "content": " def test_invalid_substr(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT SUBSTR(0, 3, cfloat)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_substr", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 236 }, { "content": " def test_invalid_len(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT LEN(cfloat)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_len", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 244 }, { "content": " def test_invalid_greater(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT GREATER(cbool, 3)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_greater", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_invalid_lesser(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT LESSER(3.0, cdate)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_lesser", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test_invalid_sum_compare(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT SUM(clong) > \"foo\"];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_sum_compare", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 268 }, { "content": " def test_invalid_max_compare(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT MAX(cstring) == 7];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_max_compare", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 276 }, { "content": " def test_invalid_avg(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT AVG(cbool)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_avg", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 284 }, { "content": " def test_invalid_stdev(self):\n query = \"\"\"\n X = [FROM SCAN(public:adhoc:mytable) AS X EMIT STDEV(cdate)];\n STORE(X, OUTPUT);\n \"\"\"\n with self.assertRaises(TypeSafetyViolation):\n self.check_scheme(query, None)", "metadata": "root.TypeTests.test_invalid_stdev", "header": "['class', 'TypeTests', '(', 'MyrialTestCase', ')', ':', '___EOS___']", "index": 292 } ]
[ { "span": "import unittest", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from raco.fakedb import FakeDatabase", "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_", "\"\"\"", "Vari", "ous", " ", "tests", " ", "of", " ", "type", " ", "safety", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rac", "o_", "._", "faked", "b_", "import_", "Fake", "Database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rac", "o_", "._", "scheme_", "import_", "Scheme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rac", "o_", "._", "myr", "ial_", "._", "myr", "ial", "\\u", "test_", "import_", "My", "rial", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rac", "o_", "._", "expression_", "import_", "Type", "Safe", "ty", "Violation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rac", "o_", "import_", "types_", "\\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_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema_", "=_", "Scheme_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "\"", "clo", "ng", "\"_", ",_", "types_", "._", "LONG", "\\u", "TYPE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "cin", "t", "\"_", ",_", "types_", "._", "INT", "\\u", "TYPE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "cstr", "ing", "\"_", ",_", "types_", "._", "STRING", "\\u", "TYPE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "cf", "loa", "t", "\"_", ",_", "types_", "._", "DOUBLE", "\\u", "TYPE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "cbo", "ol", "\"_", ",_", "types_", "._", "BOOLEAN", "\\u", "TYPE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "cda", "te", "\"_", ",_", "types_", "._", "DATETIME", "\\u", "TYPE_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\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INE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Type", "Tests_", "(_", "My", "rial", "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 ", " _", "super_", "(_", "Type", "Tests_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "ingest", "_", "(_", "\"", "public", ":", "adh", "oc", ":", "myt", "able", "\"_", ",_", "Counter_", "(_", ")_", ",_", "Type", "Tests_", "._", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "noop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ");", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "Type", "Tests_", "._", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "eq", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "clo", "ng", "=", "cstr", "ing", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "eq", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", "=", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "ge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", ">=", "cstr", "ing", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "lt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", "<", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "and_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", " ", "AND", " ", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "or", "\\u", "bot", "h", "\\u", "bad_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", " ", "OR", " ", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "or", "\\u", "right", "\\u", "bad_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cbo", "ol", " ", "OR", " ", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "or", "\\u", "left", "\\u", "bad_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", " ", "OR", " ", "cbo", "ol", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "not_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "not", " ", "cda", "te", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "plus_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cda", "te", " ", "+", " ", "cin", "t", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "times_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cda", "te", " ", "*", " ", "cstr", "ing", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "divide_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cda", "te", " ", "/", " ", "clo", "ng", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "divide_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", " ", "/", " ", "cf", "loa", "t", " ", "AS", " ", "y", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "Scheme_", "(_", "[_", "(_", "'", "y", "'_", ",_", "types_", "._", "DOUBLE", "\\u", "TYPE_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "idi", "vide", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cf", "loa", "t", " ", "//", " ", "cin", "t", " ", "AS", " ", "y", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "Scheme_", "(_", "[_", "(_", "'", "y", "'_", ",_", "types_", "._", "LONG", "\\u", "TYPE_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mod_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "clo", "ng", " ", "%", " ", "cin", "t", " ", "AS", " ", "y", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "Scheme_", "(_", "[_", "(_", "'", "y", "'_", ",_", "types_", "._", "LONG", "\\u", "TYPE_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "mod_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "cda", "te", " ", "%", " ", "cin", "t", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "neg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "-", "cstr", "ing", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "case", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "t", " ", "=", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ");", "\\", "10", ";", " ", " ", " ", " ", "rich", " ", "=", " ", "[", "FROM", " ", "t", " ", "EMI", "T", "\\", "10", ";", " ", " ", " ", " ", "CASE", " ", "WHE", "N", " ", "clo", "ng", " ", "<=", " ", "5000", " ", "THE", "N", " ", "\"", "poo", "r", "\"", "\\", "10", ";", " ", " ", " ", "WHE", "N", " ", "clo", "ng", " ", "<=", " ", "25000", " ", "THE", "N", " ", "5.5", "\\", "10", ";", " ", " ", " ", "ELS", "E", " ", "\"", "rich", "\"", " ", "END", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "rich", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "case", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "t", " ", "=", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ");", "\\", "10", ";", " ", " ", " ", " ", "rich", " ", "=", " ", "[", "FROM", " ", "t", " ", "EMI", "T", "\\", "10", ";", " ", " ", " ", " ", "CASE", " ", "WHE", "N", " ", "clo", "ng", " ", "<=", " ", "5000", " ", "THE", "N", " ", "\"", "poo", "r", "\"", "\\", "10", ";", " ", " ", " ", "WHE", "N", " ", "clo", "ng", " ", "<=", " ", "25000", " ", "THE", "N", " ", "\"", "middle", " ", "class", "\"", "\\", "10", ";", " ", " ", " ", "ELS", "E", " ", "192", "2", " ", "END", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "rich", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "cos_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "Y", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "cos", "(", "cbo", "ol", ")", " ", ">", " ", "1.0", " ", "EMI", "T", " ", "*]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "floor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "Y", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "floor", "(", "cbo", "ol", ")", " ", ">", " ", "1.0", " ", "EMI", "T", " ", "*]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "ceil_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "Y", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "ceil", "(", "clo", "ng", ")", " ", "==", " ", "\"", "Hell", "o", " ", "world", "\"", " ", "EMI", "T", " ", "*]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "tan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "Y", "\\", "10", ";", " ", " ", " ", " ", " ", "WHE", "RE", " ", "tan", "(", "cstr", "ing", ")", " ", ">", " ", "1.0", " ", "EMI", "T", " ", "*]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "pow_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "PO", "W", "(", "cf", "loa", "t", ",", " ", "cstr", "ing", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "substr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "SUBST", "R", "(", "0", ",", " ", "3", ",", " ", "cf", "loa", "t", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "len_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "LEN", "(", "cf", "loa", "t", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "greater_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "GRE", "ATE", "R", "(", "cbo", "ol", ",", " ", "3", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "less", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "LESS", "ER", "(", "3.0", ",", " ", "cda", "te", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "sum", "\\u", "compare_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "SUM", "(", "clo", "ng", ")", " ", ">", " ", "\"", "foo", "\"]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "max", "\\u", "compare_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "MAX", "(", "cstr", "ing", ")", " ", "==", " ", "7", "];", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "avg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "AVG", "(", "cbo", "ol", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "scheme_", "(_", "query_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Tests_", "(_", "My", "rial", "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", "invalid", "\\u", "stdev_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "[", "FROM", " ", "SCAN", "(", "public", ":", "adh", "oc", ":", "myt", "able", ")", " ", "AS", " ", "X", " ", "EMI", "T", " ", "STD", "EV", "(", "cda", "te", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "STORE", "(", "X", ",", " ", "OUTPU", "T", ");", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Safe", "ty", "Violation", "_", ")_", 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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 ]
Unnecessary pass
kayhayen/Nuitka/tests/benchmarks/constructs/CallCompiledMethodNoArgs.py
[ { "content": "def calledRepeatedly():\n inst = C()\n\n # This is supposed to make a call to a non-compiled function, which is\n # being optimized separately.\n# construct_begin\n inst.compiled_method()\n inst.compiled_method()\n inst.compiled_method()\n\n# construct_alternative\n pass", "metadata": "root.calledRepeatedly", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "pass", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "ed", "Repeat", "edl", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "=_", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "make", " ", "a", " ", "call", " ", "to", " ", "a", " ", "non", "-", "compile", "d", " ", "function", ",", " ", "whi", "ch", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bei", "ng", " ", "optimize", "d", " ", "separately", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", "\\u", "begin_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "compile", "d\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "compile", "d\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "compile", "d\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", "\\u", "alternative", "_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Unused import
ecdavis/pants/pants/stream.py
[ { "content": "###############################################################################\n#\n# Copyright 2011-2012 Pants Developers (see AUTHORS.txt)\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\"\"\"\nStreaming (TCP) connection implementation.\n\nStreams are one of the two main types of channels in Pants - the other\nbeing :mod:`servers <pants.server>`. Streams represent connections\nbetween two endpoints. They may be used for both client and server\napplications.\n\nStreams\n=======\nTo write a Pants application you will first need to subclass\n:class:`~pants.stream.Stream`. Your :class:`~pants.stream.Stream`\nsubclass will contain the majority of your networking code in the form\nof event handlers. Event handlers are methods beginning with ``on_`` and\ncan be safely overridden by your subclass.\n\nConnecting\n----------\nBefore a :class:`~pants.stream.Stream` instance can be used, it must\nfirst be connected to a remote host. If you are writing a server\napplication, all new :class:`~pants.stream.Stream` instance created by\nyour :class:`~pants.server.Server` will be connected. Once they are\ncreated by the :class:`~pants.server.Server`,\n:meth:`~pants.stream.Stream.on_connect` will be called and your\n:class:`~pants.engine.Engine` will begin dispatching events to your\n:class:`~pants.stream.Stream` instance.\n\nIf you are writing a client application, you must first instantiate your\n:class:`~pants.stream.Stream` subclass and then use the\n:meth:`~pants.stream.Stream.connect` method to connect the channel to a\nremote host. Once the connection has been successfully established, the\n:meth:`~pants.stream.Stream.on_connect` event handler will be called and\nyour :class:`~pants.stream.Stream` instance will start receiving events.\nBear in mind that the connection will not be established until the\n:class:`~pants.engine.Engine` is running. As such, a common pattern when\nwriting client applications with Pants is to call\n:meth:`~pants.stream.Stream.connect`, start the engine and then put all\nother initialization code in :meth:`~pants.stream.Stream.on_connect`.\n\nWriting Data\n------------\nOnce your :class:`~pants.stream.Stream` instance is connected to a\nremote host, you can begin to write data to the channel. Use\n:meth:`~pants.stream.Stream.write` to write string data to the channel,\n:meth:`~pants.stream.Stream.write_file` to efficiently write data from\nan open file and :meth:`~pants.stream.Stream.write_packed` to write\npacked binary data. As you call these methods, Pants internally buffers\nyour outgoing data. Once the buffer is completely empty,\n:meth:`~pants.stream.Stream.on_write` will be called. Be aware that if\nyou continuously write data to your :class:`~pants.stream.Stream` that\n:meth:`~pants.stream.Stream.on_write` may not be called very frequently.\nIf you wish to bypass the internal buffering and attempt to write your\ndata immediately you can use the ``flush`` options present in the three\nwrite methods or call the :meth:`~pants.stream.Stream.flush` method\nyourself. This can help to improve your application's responsiveness but\ncalling it excessively can reduce overall performance. Generally\nspeaking, it is useful when you know with certainty that you have\nfinished writing one discrete chunk of data (i.e. an HTTP response).\n\nReading Data\n------------\nA connected :class:`~pants.stream.Stream` instance will automatically\nreceive all incoming data from the remote host. By default, all incoming\ndata is immediately passed to the :meth:`~pants.stream.Stream.on_read`\nevent handler for your code to process. The\n:attr:`~pants.stream.Stream.read_delimiter` attribute can be used to\ncontrol this behaviour by causing Pants to buffer incoming data\ninternally, only forwarding it to :meth:`~pants.stream.Stream.on_read`\nwhen a particular condition is met. If the condition is never met, the\ninternal buffer will eventually exceed the allowed\n:attr:`~pants.stream.Stream.buffer_size` and the\n:meth:`~pants.stream.Stream.on_overflow_error` handler method will be\ncalled. :attr:`~pants.stream.Stream.read_delimiter` is extremely\npowerful when used effectively.\n\nClosing\n-------\nTo close a :class:`~pants.stream.Stream` instance, simply call the\n:meth:`~pants.stream.Stream.close` method. Once a stream has been closed\nit should not be reused.\n\nHandling Errors\n---------------\nDespite best efforts, errors will occasionally occur in asynchronous\ncode. Pants handles these errors by passing the resulting exception\nobject to one of a number of error handler methods. They are:\n:meth:`~pants.stream.Stream.on_connect_error`,\n:meth:`~pants.stream.Stream.on_overflow_error` and\n:meth:`~pants.stream.Stream.on_error`. Additionally, \n:meth:`~pants.stream.Stream.on_ssl_handshake_error` and\n:meth:`~pants.stream.Stream.on_ssl_error` exist to handle SSL-specific\nerrors.\n\nSSL\n===\nPants streams have SSL support. If you are writing a server application,\nuse :meth:`Server.startSSL <pants.server.Server.startSSL>` to enable SSL\non your server. Each :class:`~pants.stream.Stream` created by your\nserver from that point forward will be SSL-enabled. If you are writing a\nclient application, call\n:meth:`Stream.startSSL <pants.stream.Stream.startSSL>` before calling\n:meth:`~pants.stream.Stream.connect`. Alternatively, you can pass a\ndictionary of SSL options to the :class:`~pants.stream.Stream`\nconstructor which will then enable SSL on the instance. When SSL is\nenabled on a :class:`~pants.stream.Stream`, an SSL handshake occurs\nbetween the local and remote ends of the connection. Once the SSL\nhandshake is complete, :meth:`~pants.stream.Stream.on_ssl_handshake`\nwill be called. If it fails,\n:meth:`~pants.stream.Stream.on_ssl_handshake_error` will be called.\n\nIf you are writing an SSL-enabled application you should read the\nentirety of Python's :mod:`ssl` documentation. Pants does not override\nany of Python's SSL defaults unless clearly stated in this documentation.\n\"\"\"\n\n###############################################################################\n# Imports\n###############################################################################\n\nimport errno\nimport functools\nimport os\nimport re\nimport socket\nimport ssl\nimport struct\n\nfrom pants._channel import _Channel, HAS_IPV6, sock_type\nfrom pants.engine import Engine\n\n\ntry:\n from netstruct import NetStruct as _NetStruct\nexcept ImportError:\n # Create the fake class because isinstance expects a class.\n\n\n###############################################################################\n# Constants\n###############################################################################\n\nRegexType = type(re.compile(\"\"))\nStruct = struct.Struct\n\n\n###############################################################################\n# Logging\n###############################################################################\n\nimport logging\nlog = logging.getLogger(\"pants\")\n\n\n###############################################################################\n# Stream Class\n###############################################################################\n\n\n\n###############################################################################\n# Exceptions\n###############################################################################\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " class _NetStruct(object):", "metadata": "root._NetStruct", "header": "['module', '___EOS___']", "index": 152 }, { "content": " def __init__(self, *a, **kw):\n raise NotImplementedError", "metadata": "root._NetStruct.__init__", "header": "['class', '_NetStruct', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": "class Stream(_Channel):\n \"\"\"\n The stream-oriented connection channel.\n\n A :class:`~pants.stream.Stream` instance represents either a local\n connection to a remote server or a remote connection to a local\n server over a streaming, connection-oriented protocol such as TCP.\n\n ================= ================================================\n Keyword Argument Description\n ================= ================================================\n engine *Optional.* The engine to which the channel\n should be added. Defaults to the global engine.\n socket *Optional.* A pre-existing socket to wrap. This\n can be a regular :py:obj:`~socket.socket` or an\n :py:obj:`~ssl.SSLSocket`. If a socket is not\n provided, a new socket will be created for the\n channel when required.\n ssl_options *Optional.* If provided,\n :meth:`~pants.stream.Stream.startSSL` will be\n called with these options once the stream is\n ready. By default, SSL will not be enabled.\n ================= ================================================\n \"\"\"\n SEND_STRING = 0\n SEND_FILE = 1\n SEND_SSL_HANDSHAKE = 2\n\n\n ##### Properties ##########################################################\n\n\n\n\n\n\n\n\n\n # Setting these at the class level makes them easy to override on a\n # per-class basis.\n regex_search = True\n _buffer_size = 2 ** 16 # 64kb\n\n\n\n ##### Control Methods #####################################################\n\n\n\n\n ##### I/O Methods #########################################################\n\n\n\n\n\n ##### Public Event Handlers ###############################################\n\n\n ##### Public Error Handlers ###############################################\n\n\n\n ##### Internal Methods ####################################################\n\n\n ##### Internal Event Handler Methods ######################################\n\n\n\n\n\n ##### Internal Processing Methods #########################################\n\n\n\n\n\n\n ##### SSL Implementation ##################################################\n\n\n\n", "metadata": "root.Stream", "header": "['module', '___EOS___']", "index": 177 }, { "content": " def __init__(self, **kwargs):\n sock = kwargs.get(\"socket\", None)\n if sock and sock_type(sock) != socket.SOCK_STREAM:\n raise TypeError(\"Cannot create a %s with a socket type other than SOCK_STREAM.\"\n % self.__class__.__name__)\n\n _Channel.__init__(self, **kwargs)\n\n # Socket\n self._remote_address = None\n self._local_address = None\n\n # I/O attributes\n self._read_delimiter = None\n self._recv_buffer = \"\"\n self._recv_buffer_size_limit = self._buffer_size\n self._send_buffer = []\n\n # Channel state\n self.connected = False\n self.connecting = False\n self._closing = False\n\n # SSL state\n self.ssl_enabled = False\n self._ssl_enabling = False\n self._ssl_socket_wrapped = False\n self._ssl_handshake_done = False\n self._ssl_call_on_connect = False\n if isinstance(kwargs.get(\"socket\", None), ssl.SSLSocket):\n self._ssl_socket_wrapped = True\n self.startSSL()\n elif kwargs.get(\"ssl_options\", None) is not None:\n self.startSSL(kwargs[\"ssl_options\"])", "metadata": "root.Stream.__init__", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 205 }, { "content": " @property\n def remote_address(self):\n \"\"\"\n The remote address to which the channel is connected.\n\n By default, this will be the value of ``socket.getpeername`` or\n None. It is possible for user code to override the default\n behaviour and set the value of the property manually. In order\n to return the property to its default behaviour, user code then\n has to delete the value. Example::\n\n # default behaviour\n channel.remote_address = custom_value\n # channel.remote_address will return custom_value now\n del channel.remote_address\n # default behaviour\n \"\"\"\n if self._remote_address is not None:\n return self._remote_address\n elif self._socket:\n try:\n return self._socket.getpeername()\n except socket.error:\n return None\n else:\n return None", "metadata": "root.Stream.remote_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 242 }, { "content": " @remote_address.setter\n def remote_address(self, val):\n self._remote_address = val", "metadata": "root.Stream.remote_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 269 }, { "content": " @remote_address.deleter\n def remote_address(self):\n self._remote_address = None", "metadata": "root.Stream.remote_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 273 }, { "content": " @property\n def local_address(self):\n \"\"\"\n The address of the channel on the local machine.\n\n By default, this will be the value of ``socket.getsockname`` or\n None. It is possible for user code to override the default\n behaviour and set the value of the property manually. In order\n to return the property to its default behaviour, user code then\n has to delete the value. Example::\n\n # default behaviour\n channel.local_address = custom_value\n # channel.local_address will return custom_value now\n del channel.local_address\n # default behaviour\n \"\"\"\n if self._local_address is not None:\n return self._local_address\n elif self._socket:\n try:\n return self._socket.getsockname()\n except socket.error:\n return None\n else:\n return None", "metadata": "root.Stream.local_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 277 }, { "content": " @local_address.setter\n def local_address(self, val):\n self._local_address = val", "metadata": "root.Stream.local_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 304 }, { "content": " @local_address.deleter\n def local_address(self):\n self._local_address = None", "metadata": "root.Stream.local_address", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 308 }, { "content": " @property\n def read_delimiter(self):\n \"\"\"\n The magical read delimiter which determines how incoming data is\n buffered by the stream.\n\n As data is read from the socket, it is buffered internally by\n the stream before being passed to the :meth:`on_read` callback. The\n value of the read delimiter determines when the data is passed to the\n callback. Valid values are ``None``, a byte string, an integer/long,\n a compiled regular expression, an instance of :class:`struct.Struct`,\n or an instance of :class:`netstruct.NetStruct`.\n\n When the read delimiter is ``None``, data will be passed to\n :meth:`on_read` immediately after it is read from the socket. This is\n the default behaviour.\n\n When the read delimiter is a byte string, data will be buffered\n internally until that string is encountered in the incoming\n data. All data up to but excluding the read delimiter is then\n passed to :meth:`on_read`. The segment matching the read delimiter\n itself is discarded from the buffer.\n\n When the read delimiter is an integer or a long, it is treated\n as the number of bytes to read before passing the data to\n :meth:`on_read`.\n\n When the read delimiter is a :class:`struct.Struct` instance, the\n Struct's ``size`` is fully buffered and the data is unpacked using the\n Struct before its sent to :meth:`on_read`. Unlike other types of read\n delimiters, this can result in more than one argument being passed to\n :meth:`on_read`, as in the following example::\n\n import struct\n from pants import Stream\n\n class Example(Stream):\n def on_connect(self):\n self.read_delimiter = struct.Struct(\"!LLH\")\n\n def on_read(self, packet_type, length, id):\n pass\n\n When the read delimiter is an instance of :class:`netstruct.NetStruct`,\n the NetStruct's :attr:`~netstruct.NetStruct.minimum_size` is buffered\n and unpacked with the NetStruct, and additional data is buffered as\n necessary until the NetStruct can be completely unpacked. Once ready,\n the data will be passed to :meth:`on_read`. Using Struct and NetStruct\n are *very* similar.\n\n When the read delimiter is a compiled regular expression\n (:class:`re.RegexObject`), there are two possible behaviors that you\n may switch between by setting the value of :attr:`regex_search`. If\n :attr:`regex_search` is True, as is the default, the delimiter's\n :meth:`~re.RegexObject.search` method is used and, if a match is found,\n the string before that match is passed to :meth:`on_read`. The segment\n that was matched by the regular expression will be discarded.\n\n If :attr:`regex_search` is False, the delimiter's\n :meth:`~re.RegexObject.match` method is used instead and, if a match\n is found, the match object itself will be passed to :meth:`on_read`,\n giving you access to the capture groups. Again, the segment that was\n matched by the regular expression will be discarded from the buffer.\n\n Attempting to set the read delimiter to any other value will\n raise a :exc:`TypeError`.\n\n The effective use of the read delimiter can greatly simplify the\n implementation of certain protocols.\n \"\"\"\n return self._read_delimiter", "metadata": "root.Stream.read_delimiter", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 312 }, { "content": " @read_delimiter.setter\n def read_delimiter(self, value):\n if value is None or isinstance(value, basestring) or \\\n isinstance(value, RegexType):\n self._read_delimiter = value\n self._recv_buffer_size_limit = self._buffer_size\n\n elif isinstance(value, (int, long)):\n self._read_delimiter = value\n self._recv_buffer_size_limit = max(self._buffer_size, value)\n\n elif isinstance(value, Struct):\n self._read_delimiter = value\n self._recv_buffer_size_limit = max(self._buffer_size, value.size)\n\n elif isinstance(value, _NetStruct):\n self._read_delimiter = value\n self._recv_buffer_size_limit = max(self._buffer_size,\n value.minimum_size)\n\n else:\n raise TypeError(\"Attempted to set read_delimiter to a value with an invalid type.\")\n\n # Reset NetStruct state when we change the read delimiter.\n self._netstruct_iter = None\n self._netstruct_needed = None", "metadata": "root.Stream.read_delimiter", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 384 }, { "content": " @property\n def buffer_size(self):\n \"\"\"\n The maximum size, in bytes, of the internal buffer used for\n incoming data.\n\n When buffering data it is important to ensure that inordinate\n amounts of memory are not used. Setting the buffer size to a\n sensible value can prevent coding errors or malicious use from\n causing your application to consume increasingly large amounts\n of memory. By default, a maximum of 64kb of data will be stored.\n\n The buffer size is mainly relevant when using a string value for\n the :attr:`~pants.stream.Stream.read_delimiter`. Because you\n cannot guarantee that the string will appear, having an upper\n limit on the size of the data is appropriate.\n\n If the read delimiter is set to a number larger than the buffer\n size, the buffer size will be increased to accommodate the read\n delimiter.\n\n When the internal buffer's size exceeds the maximum allowed, the\n :meth:`~pants.stream.Stream.on_overflow_error` callback will be\n invoked.\n\n Attempting to set the buffer size to anything other than an\n integer or long will raise a :exc:`TypeError`.\n \"\"\"\n return self._buffer_size", "metadata": "root.Stream.buffer_size", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 416 }, { "content": " @buffer_size.setter\n def buffer_size(self, value):\n if not isinstance(value, (long, int)):\n raise TypeError(\"buffer_size must be an int or a long\")\n self._buffer_size = value\n if isinstance(self._read_delimiter, (int, long)):\n self._recv_buffer_size_limit = max(value, self._read_delimiter)\n elif isinstance(self._read_delimiter, Struct):\n self._recv_buffer_size_limit = max(value,\n self._read_delimiter.size)\n elif isinstance(self._read_delimiter, _NetStruct):\n self._recv_buffer_size_limit = max(value,\n self._read_delimiter.minimum_size)\n else:\n self._recv_buffer_size_limit = value", "metadata": "root.Stream.buffer_size", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 446 }, { "content": " def startSSL(self, ssl_options={}):\n \"\"\"\n Enable SSL on the channel and perform a handshake at the next\n opportunity.\n\n SSL is only enabled on a channel once all currently pending data\n has been written. If a problem occurs at this stage,\n :meth:`~pants.stream.Stream.on_ssl_error` is called. Once SSL\n has been enabled, the SSL handshake begins - this typically\n takes some time and may fail, in which case\n :meth:`~pants.stream.Stream.on_ssl_handshake_error` will be\n called. When the handshake is successfully completed,\n :meth:`~pants.stream.Stream.on_ssl_handshake` is called and the\n channel is secure.\n\n Typically, this method is called before\n :meth:`~pants.stream.Stream.connect`. In this case,\n :meth:`~pants.stream.Stream.on_ssl_handshake` will be called\n before :meth:`~pants.stream.Stream.on_connect`. If\n :meth:`~pants.stream.Stream.startSSL` is called after\n :meth:`~pants.stream.Stream.connect`, the reverse is true.\n\n It is possible, although unusual, to start SSL on a channel that\n is already connected and active. In this case, as noted above,\n SSL will only be enabled and the handshake performed after all\n currently pending data has been written.\n\n The SSL options argument will be passed through to\n :func:`ssl.wrap_socket` as keyword arguments - see the\n :mod:`ssl` documentation for further information. You will\n typically want to provide the ``keyfile``, ``certfile`` and\n ``ca_certs`` options. The ``do_handshake_on_connect`` option\n **must** be ``False``, or a :exc:`ValueError` will be raised.\n\n Attempting to enable SSL on a closed channel or a channel that\n already has SSL enabled on it will raise a :exc:`RuntimeError`.\n\n Returns the channel.\n\n ============ ===================================================\n Arguments Description\n ============ ===================================================\n ssl_options *Optional.* Keyword arguments to pass to\n :func:`ssl.wrap_socket`.\n ============ ===================================================\n \"\"\"\n if self.ssl_enabled or self._ssl_enabling:\n raise RuntimeError(\"startSSL() called on SSL-enabled %r\" % self)\n\n if self._closed or self._closing:\n raise RuntimeError(\"startSSL() called on closed %r\" % self)\n\n if ssl_options.setdefault(\"do_handshake_on_connect\", False) is not False:\n raise ValueError(\"SSL option 'do_handshake_on_connect' must be False.\")\n\n self._ssl_enabling = True\n self._send_buffer.append((Stream.SEND_SSL_HANDSHAKE, ssl_options))\n\n if self.connected:\n self._process_send_buffer()\n\n return self", "metadata": "root.Stream.startSSL", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 464 }, { "content": " def connect(self, address):\n \"\"\"\n Connect the channel to a remote socket.\n\n The given ``address`` is resolved and used by the channel to\n connect to the remote server. If an error occurs at any stage in\n this process, :meth:`~pants.stream.Stream.on_connect_error` is\n called. When a connection is successfully established,\n :meth:`~pants.stream.Stream.on_connect` is called.\n\n Addresses can be represented in a number of different ways. A\n single string is treated as a UNIX address. A single integer is\n treated as a port and converted to a 2-tuple of the form\n ``('', port)``. A 2-tuple is treated as an IPv4 address and a\n 4-tuple is treated as an IPv6 address. See the :mod:`socket`\n documentation for further information on socket addresses.\n\n If no socket exists on the channel, one will be created with a\n socket family appropriate for the given address.\n\n An error will occur during the connection if the given address\n is not of a valid format or of an inappropriate format for the\n socket (e.g. if an IP address is given to a UNIX socket).\n\n Calling :meth:`connect()` on a closed channel or a channel that\n is already connected will raise a :exc:`RuntimeError`.\n\n Returns the channel.\n\n =============== ===============================================\n Arguments Description\n =============== ===============================================\n address The remote address to connect to.\n =============== ===============================================\n \"\"\"\n if self.connected or self.connecting:\n raise RuntimeError(\"connect() called on active %r.\" % self)\n\n if self._closed or self._closing:\n raise RuntimeError(\"connect() called on closed %r.\" % self)\n\n self.connecting = True\n\n address, family, resolved = self._format_address(address)\n\n if resolved:\n self._do_connect(address, family)\n else:\n try:\n result = socket.getaddrinfo(address[0], address[1], family)\n except socket.error as err:\n self.close(flush=False)\n e = StreamConnectError(err.errno, err.strerror)\n self._safely_call(self.on_connect_error, e)\n return self\n\n # We only care about the first result.\n result = result[0]\n self._do_connect(result[-1], result[0])\n\n return self", "metadata": "root.Stream.connect", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 527 }, { "content": " def close(self, flush=True):\n \"\"\"\n Close the channel.\n \"\"\"\n if self._closed:\n return\n\n if flush and self._send_buffer:\n self._closing = True\n return\n\n self.read_delimiter = None\n self._recv_buffer = \"\"\n self._send_buffer = []\n\n self.connected = False\n self.connecting = False\n\n self.ssl_enabled = False\n self._ssl_enabling = False\n self._ssl_socket_wrapped = False\n self._ssl_handshake_done = False\n self._ssl_call_on_connect = False\n\n self._safely_call(self.on_close)\n\n self._remote_address = None\n self._local_address = None\n\n _Channel.close(self)\n\n self._closing = False", "metadata": "root.Stream.close", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 589 }, { "content": " def write(self, data, flush=False):\n \"\"\"\n Write data to the channel.\n\n Data will not be written immediately, but will be buffered\n internally until it can be sent without blocking the process.\n\n Calling :meth:`write()` on a closed or disconnected channel will\n raise a :exc:`RuntimeError`.\n\n ========== ===================================================\n Arguments Description\n ========== ===================================================\n data A string of data to write to the channel.\n flush *Optional.* If True, flush the internal write\n buffer. See :meth:`~pants.stream.Stream.flush` for\n details.\n ========== ===================================================\n \"\"\"\n if self._closed or self._closing:\n raise RuntimeError(\"write() called on closed %r.\" % self)\n\n if not self.connected:\n raise RuntimeError(\"write() called on disconnected %r.\" % self)\n\n if self._send_buffer and self._send_buffer[-1][0] == Stream.SEND_STRING:\n data_type, existing_data = self._send_buffer.pop(-1)\n data = existing_data + data\n\n self._send_buffer.append((Stream.SEND_STRING, data))\n\n if flush:\n self._process_send_buffer()\n else:\n self._start_waiting_for_write_event()", "metadata": "root.Stream.write", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 624 }, { "content": " def write_file(self, sfile, nbytes=0, offset=0, flush=False):\n \"\"\"\n Write a file to the channel.\n\n The file will not be written immediately, but will be buffered\n internally until it can be sent without blocking the process.\n\n Calling :meth:`write_file()` on a closed or disconnected channel\n will raise a :exc:`RuntimeError`.\n\n ========== ====================================================\n Arguments Description\n ========== ====================================================\n sfile A file object to write to the channel.\n nbytes *Optional.* The number of bytes of the file to\n write. If 0, all bytes will be written.\n offset *Optional.* The number of bytes to offset writing\n by.\n flush *Optional.* If True, flush the internal write\n buffer. See :meth:`~pants.stream.Stream.flush` for\n details.\n ========== ====================================================\n \"\"\"\n if self._closed or self._closing:\n raise RuntimeError(\"write_file() called on closed %r.\" % self)\n\n if not self.connected:\n raise RuntimeError(\"write_file() called on disconnected %r.\" % self)\n\n self._send_buffer.append((Stream.SEND_FILE, (sfile, offset, nbytes)))\n\n if flush:\n self._process_send_buffer()\n else:\n self._start_waiting_for_write_event()", "metadata": "root.Stream.write_file", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 660 }, { "content": " def write_packed(self, *data, **kwargs):\n \"\"\"\n Write packed binary data to the channel.\n\n If the current :attr:`read_delimiter` is an instance of\n :class:`struct.Struct` or :class:`netstruct.NetStruct` the format will\n be read from that Struct, otherwise you will need to\n provide a ``format``.\n\n ========== ====================================================\n Argument Description\n ========== ====================================================\n \\*data Any number of values to be passed through\n :mod:`struct` and written to the remote host.\n flush *Optional.* If True, flush the internal write\n buffer. See :meth:`~pants.stream.Stream.flush`\n for details.\n format *Optional.* A formatting string to pack the\n provided data with. If one isn't provided, the read\n delimiter will be used.\n ========== ====================================================\n \"\"\"\n format = kwargs.get(\"format\")\n if format:\n self.write(struct.pack(format, *data), kwargs.get(\"flush\", False))\n elif not isinstance(self._read_delimiter, (Struct, _NetStruct)):\n raise ValueError(\"No format is available for writing packed data.\")\n else:\n self.write(self._read_delimiter.pack(*data),\n kwargs.get(\"flush\", False))", "metadata": "root.Stream.write_packed", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 696 }, { "content": " def flush(self):\n \"\"\"\n Attempt to immediately write any internally buffered data to the\n channel without waiting for a write event.\n\n This method can be fairly expensive to call and should be used\n sparingly.\n\n Calling :meth:`flush()` on a closed or disconnected channel will\n raise a :exc:`RuntimeError`.\n \"\"\"\n if self._closed or self._closing:\n raise RuntimeError(\"flush() called on closed %r.\" % self)\n\n if not self.connected:\n raise RuntimeError(\"flush() called on disconnected %r.\" % self)\n\n if not self._send_buffer:\n return\n\n self._stop_waiting_for_write_event()\n self._process_send_buffer()", "metadata": "root.Stream.flush", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 727 }, { "content": " def on_ssl_handshake(self):\n \"\"\"\n Placeholder. Called after the channel has finished its SSL\n handshake.\n \"\"\"\n pass", "metadata": "root.Stream.on_ssl_handshake", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 752 }, { "content": " def on_ssl_handshake_error(self, exception):\n \"\"\"\n Placeholder. Called when an error occurs during the SSL\n handshake.\n\n By default, logs the exception and closes the channel.\n\n ========== ============\n Argument Description\n ========== ============\n exception The exception that was raised.\n ========== ============\n \"\"\"\n log.exception(exception)\n self.close(flush=False)", "metadata": "root.Stream.on_ssl_handshake_error", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 761 }, { "content": " def on_ssl_error(self, exception):\n \"\"\"\n Placeholder. Called when an error occurs in the underlying SSL\n implementation.\n\n By default, logs the exception and closes the channel.\n\n ========== ============\n Argument Description\n ========== ============\n exception The exception that was raised.\n ========== ============\n \"\"\"\n log.exception(exception)\n self.close(flush=False)", "metadata": "root.Stream.on_ssl_error", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 777 }, { "content": " def _do_connect(self, address, family, error=None):\n \"\"\"\n A callback method to be used with\n :meth:`~pants._channel._Channel._resolve_addr` - either connects\n immediately or notifies the user of an error.\n\n ========= =====================================================\n Argument Description\n ========= =====================================================\n address The address to connect to or None if address\n resolution failed.\n family The detected socket family or None if address\n resolution failed.\n error *Optional.* Error information or None if no error\n occurred.\n ========= =====================================================\n \"\"\"\n if not address:\n self.connecting = False\n e = StreamConnectError(*error)\n self._safely_call(self.on_connect_error, e)\n return\n\n if self._socket:\n if self._socket.family != family:\n self.engine.remove_channel(self)\n self._socket_close()\n self._closed = False\n\n sock = socket.socket(family, socket.SOCK_STREAM)\n self._socket_set(sock)\n self.engine.add_channel(self)\n\n try:\n connected = self._socket_connect(address)\n except socket.error as err:\n self.close(flush=False)\n e = StreamConnectError(err.errno, err.strerror)\n self._safely_call(self.on_connect_error, e)\n return\n\n if connected:\n self._handle_connect_event()", "metadata": "root.Stream._do_connect", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 795 }, { "content": " def _handle_read_event(self):\n \"\"\"\n Handle a read event raised on the channel.\n \"\"\"\n if self.ssl_enabled and not self._ssl_handshake_done:\n self._ssl_do_handshake()\n return\n\n while True:\n try:\n data = self._socket_recv()\n except socket.error as err:\n self._safely_call(self.on_read_error, err)\n return\n\n if not data:\n break\n else:\n self._recv_buffer += data\n\n if len(self._recv_buffer) > self._recv_buffer_size_limit:\n # Try processing the buffer to reduce its length.\n self._process_recv_buffer()\n\n # If the buffer's still too long, overflow error.\n if len(self._recv_buffer) > self._recv_buffer_size_limit:\n e = StreamBufferOverflow(\"Buffer length exceeded upper limit on %r.\" % self)\n self._safely_call(self.on_overflow_error, e)\n return\n\n self._process_recv_buffer()\n\n # This block was moved out of the above loop to address issue #41.\n if data is None:\n self.close(flush=False)", "metadata": "root.Stream._handle_read_event", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 841 }, { "content": " def _handle_write_event(self):\n \"\"\"\n Handle a write event raised on the channel.\n \"\"\"\n if self.ssl_enabled and not self._ssl_handshake_done:\n self._ssl_do_handshake()\n return\n\n if not self.connected:\n self._handle_connect_event()\n\n if not self._send_buffer:\n return\n\n self._process_send_buffer()", "metadata": "root.Stream._handle_write_event", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 877 }, { "content": " def _handle_error_event(self):\n \"\"\"\n Handle an error event raised on the channel.\n \"\"\"\n if self.connecting:\n # That's no moon...\n self._handle_connect_event()\n else:\n _Channel._handle_error_event(self)", "metadata": "root.Stream._handle_error_event", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 893 }, { "content": " def _handle_connect_event(self):\n \"\"\"\n Handle a connect event raised on the channel.\n \"\"\"\n self.connecting = False\n err, errstr = self._get_socket_error()\n if err == 0:\n self.connected = True\n if self._ssl_enabling:\n self._ssl_call_on_connect = True\n self._process_send_buffer()\n else:\n self._safely_call(self.on_connect)\n else:\n # ... it's a space station!\n e = StreamConnectError(err, errstr)\n self._safely_call(self.on_connect_error, e)", "metadata": "root.Stream._handle_connect_event", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 903 }, { "content": " def _process_recv_buffer(self):\n \"\"\"\n Process the :attr:`~pants.stream.Stream._recv_buffer`, passing\n chunks of data to :meth:`~pants.stream.Stream.on_read`.\n \"\"\"\n while self._recv_buffer:\n delimiter = self.read_delimiter\n\n if delimiter is None:\n data = self._recv_buffer\n self._recv_buffer = \"\"\n self._safely_call(self.on_read, data)\n\n elif isinstance(delimiter, (int, long)):\n if len(self._recv_buffer) < delimiter:\n break\n data = self._recv_buffer[:delimiter]\n self._recv_buffer = self._recv_buffer[delimiter:]\n self._safely_call(self.on_read, data)\n\n elif isinstance(delimiter, basestring):\n mark = self._recv_buffer.find(delimiter)\n if mark == -1:\n break\n data = self._recv_buffer[:mark]\n self._recv_buffer = self._recv_buffer[mark + len(delimiter):]\n self._safely_call(self.on_read, data)\n\n elif isinstance(delimiter, Struct):\n if len(self._recv_buffer) < delimiter.size:\n break\n data = self._recv_buffer[:delimiter.size]\n self._recv_buffer = self._recv_buffer[delimiter.size:]\n\n # Safely unpack it. This should *probably* never error.\n try:\n data = delimiter.unpack(data)\n except struct.error:\n log.exception(\"Unable to unpack data on %r.\" % self)\n self.close()\n break\n\n # Unlike most on_read calls, this one sends every variable of\n # the parsed data as its own argument.\n self._safely_call(self.on_read, *data)\n\n elif isinstance(delimiter, _NetStruct):\n if not self._netstruct_iter:\n # We need to get started.\n self._netstruct_iter = delimiter.iter_unpack()\n self._netstruct_needed = next(self._netstruct_iter)\n\n if len(self._recv_buffer) < self._netstruct_needed:\n break\n\n data = self._netstruct_iter.send(\n self._recv_buffer[:self._netstruct_needed])\n self._recv_buffer = self._recv_buffer[self._netstruct_needed:]\n\n if isinstance(data, (int,long)):\n self._netstruct_needed = data\n continue\n\n # Still here? Then we've got our object. Delete the NetStruct\n # state and send the data.\n self._netstruct_needed = None\n self._netstruct_iter = None\n\n self._safely_call(self.on_read, *data)\n\n elif isinstance(delimiter, RegexType):\n # Depending on regex_search, we could do this two ways.\n if self.regex_search:\n match = delimiter.search(self._recv_buffer)\n if not match:\n break\n\n data = self._recv_buffer[:match.start()]\n self._recv_buffer = self._recv_buffer[match.end():]\n\n else:\n # Require the match to be at the beginning.\n data = delimiter.match(self._recv_buffer)\n if not data:\n break\n\n self._recv_buffer = self._recv_buffer[data.end():]\n\n # Send either the string or the match object.\n self._safely_call(self.on_read, data)\n\n else:\n # The safeguards in the read delimiter property should\n # prevent this from happening unless people start\n # getting too crafty for their own good.\n err = InvalidReadDelimiterError(\"Invalid read delimiter on %r.\" % self)\n self._safely_call(self.on_error, err)\n break\n\n if self._closed or not self.connected:\n break", "metadata": "root.Stream._process_recv_buffer", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 923 }, { "content": " def _process_send_buffer(self):\n \"\"\"\n Process the :attr:`~pants.stream.Stream._send_buffer`, passing\n outgoing data to :meth:`~pants._channel._Channel._socket_send`\n or :meth:`~pants._channel._Channel._socket_sendfile` and calling\n :meth:`~pants.stream.Stream.on_write` when sending has finished.\n \"\"\"\n while self._send_buffer:\n data_type, data = self._send_buffer.pop(0)\n\n if data_type == Stream.SEND_STRING:\n bytes_sent = self._process_send_string(data)\n elif data_type == Stream.SEND_FILE:\n bytes_sent = self._process_send_file(*data)\n elif data_type == Stream.SEND_SSL_HANDSHAKE:\n bytes_sent = self._process_send_ssl_handshake(data)\n\n if bytes_sent == 0:\n break\n\n if not self._closed and not self._send_buffer:\n self._safely_call(self.on_write)\n\n if self._closing:\n self.close(flush=False)", "metadata": "root.Stream._process_send_buffer", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1025 }, { "content": " def _process_send_string(self, data):\n \"\"\"\n Send data from a string to the remote socket.\n \"\"\"\n try:\n bytes_sent = self._socket_send(data)\n except socket.error as err:\n self._safely_call(self.on_write_error, err)\n return 0\n\n if len(data) > bytes_sent:\n self._send_buffer.insert(0, (Stream.SEND_STRING, data[bytes_sent:]))\n\n return bytes_sent", "metadata": "root.Stream._process_send_string", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1051 }, { "content": " def _process_send_file(self, sfile, offset, nbytes):\n \"\"\"\n Send data from a file to the remote socket.\n \"\"\"\n try:\n bytes_sent = self._socket_sendfile(sfile, offset, nbytes)\n except socket.error as err:\n self._safely_call(self.on_write_error, err)\n return 0\n\n offset += bytes_sent\n\n if nbytes > 0:\n if nbytes - bytes_sent > 0:\n nbytes -= bytes_sent\n else:\n # Reached the end of the segment.\n return bytes_sent\n\n # TODO This is awful. Find a better way.\n if os.fstat(sfile.fileno()).st_size - offset <= 0:\n # Reached the end of the file.\n return bytes_sent\n\n self._send_buffer.insert(0, (Stream.SEND_FILE, (sfile, offset, nbytes)))\n\n return bytes_sent", "metadata": "root.Stream._process_send_file", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1066 }, { "content": " def _process_send_ssl_handshake(self, ssl_options):\n \"\"\"\n Enable SSL and begin the handshake.\n \"\"\"\n self._ssl_enabling = False\n\n if not self._ssl_socket_wrapped:\n try:\n self._socket = ssl.wrap_socket(self._socket, **ssl_options)\n except ssl.SSLError as err:\n self._ssl_enabling = True\n self._safely_call(self.on_ssl_error, err)\n return 0\n else:\n self._ssl_socket_wrapped = True\n\n self.ssl_enabled = True\n\n try:\n bytes_sent = self._ssl_do_handshake()\n except Exception as err:\n self._safely_call(self.on_ssl_handshake_error, err)\n return 0\n\n # Unlike strings and files, the SSL handshake is not re-added to\n # the queue. This is because the stream's state has been\n # modified and the handshake will continue until it's complete.\n return bytes_sent", "metadata": "root.Stream._process_send_ssl_handshake", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1094 }, { "content": " def _socket_recv(self):\n \"\"\"\n Receive data from the socket.\n\n Returns a string of data read from the socket. The data is None if\n the socket has been closed.\n\n Overrides :meth:`pants._channel._Channel._socket_recv` to handle\n SSL-specific behaviour.\n \"\"\"\n try:\n return _Channel._socket_recv(self)\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n return ''\n else:\n raise", "metadata": "root.Stream._socket_recv", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1125 }, { "content": " def _socket_send(self, data):\n \"\"\"\n Send data to the socket.\n\n Returns the number of bytes that were sent to the socket.\n\n Overrides :meth:`pants._channel._Channel._socket_send` to handle\n SSL-specific behaviour.\n\n ========= ============\n Argument Description\n ========= ============\n data The string of data to send.\n ========= ============\n \"\"\"\n try:\n bytes_sent = _Channel._socket_send(self, data)\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n self._start_waiting_for_write_event()\n return 0\n else:\n raise\n\n # SSLSocket.send() can return 0 rather than raise an exception\n # if it needs a write event.\n if self.ssl_enabled and bytes_sent == 0:\n self._start_waiting_for_write_event()\n return bytes_sent", "metadata": "root.Stream._socket_send", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1143 }, { "content": " def _socket_sendfile(self, sfile, offset, nbytes):\n \"\"\"\n Send data from a file to a remote socket.\n\n Returns the number of bytes that were sent to the socket.\n\n Overrides :meth:`pants._channel._Channel._socket_sendfile` to\n handle SSL-specific behaviour.\n\n ========= ============\n Argument Description\n ========= ============\n sfile The file to send.\n offset The number of bytes to offset writing by.\n nbytes The number of bytes of the file to write. If 0, all bytes will be written.\n ========= ============\n \"\"\"\n return _Channel._socket_sendfile(self, sfile, offset, nbytes, self.ssl_enabled)", "metadata": "root.Stream._socket_sendfile", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1173 }, { "content": " def _ssl_do_handshake(self):\n \"\"\"\n Perform an asynchronous SSL handshake.\n \"\"\"\n try:\n self._socket.do_handshake()\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n return 0\n elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n self._start_waiting_for_write_event()\n return 0\n elif err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):\n self.close(flush=False)\n return 0\n elif err.args[0] == ssl.SSL_ERROR_SSL:\n self._safely_call(self.on_ssl_handshake_error, err)\n return 0\n else:\n raise\n except socket.error as err:\n if err.args[0] in (errno.ECONNRESET, errno.EPIPE):\n self.close(flush=False)\n return 0\n else:\n raise\n else:\n self._ssl_handshake_done = True\n self._safely_call(self.on_ssl_handshake)\n if self._ssl_call_on_connect:\n self._safely_call(self.on_connect)\n return None", "metadata": "root.Stream._ssl_do_handshake", "header": "['class', 'Stream', '(', '_Channel', ')', ':', '___EOS___']", "index": 1192 }, { "content": "class StreamBufferOverflow(Exception):\n \"\"\"\n Raised when a stream's internal buffer has exceeded its maximum\n allowed size.\n \"\"\"\n pass", "metadata": "root.StreamBufferOverflow", "header": "['module', '___EOS___']", "index": 1230 }, { "content": "class StreamConnectError(Exception):\n \"\"\"\n Raised when an error has occurred during an attempt to connect a\n stream to a remote host.\n \"\"\"\n pass", "metadata": "root.StreamConnectError", "header": "['module', '___EOS___']", "index": 1237 }, { "content": "class InvalidReadDelimiterError(Exception):\n \"\"\"\n Raised when a channel tries to process incoming data with an\n invalid read delimiter.\n \"\"\"\n pass", "metadata": "root.InvalidReadDelimiterError", "header": "['module', '___EOS___']", "index": 1244 } ]
[ { "span": "import functools", "start_line": 137, "start_column": 0, "end_line": 137, "end_column": 16 }, { "span": "from pants._channel import _Channel, HAS_IPV6, sock_type", "start_line": 144, "start_column": 0, "end_line": 144, "end_column": 56 }, { "span": "from pants.engine import Engine", "start_line": 145, "start_column": 0, "end_line": 145, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", "-", "2012", " ", "Pant", "s", " ", "Dev", "elope", "rs", " ", "(", "see", " ", "AUTHOR", "S", ".", "txt", ")_", "\\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_", "\"\"\"", "\\", "10", ";", "Stream", "ing", " ", "(", "TC", "P", ")", " ", "connecti", "on", " ", "implementation", ".", "\\", "10", ";", "\\", "10", ";", "Stream", "s", " ", "are", " ", "one", " ", "of", " ", "the", " ", "two", " ", "main", " ", "types", " ", "of", " ", "channel", "s", " ", "in", " ", "Pant", "s", " ", "-", " ", "the", " ", "other", "\\", "10", ";", "bei", "ng", " ", ":", "mod", ":`", "server", "s", " ", "<", "pant", "s", ".", "server", ">`", ".", " ", "Stream", "s", " ", "represent", " ", "connections", "\\", "10", ";", "bet", "ween", " ", "two", " ", "endpoint", "s", ".", " ", "The", "y", " ", "may", " ", "be", " ", "used", " ", "for", " ", "bot", "h", " ", "client", " ", "and", " ", "server", "\\", "10", ";", "applica", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", "Stream", "s", "\\", "10", ";", "=======", "\\", "10", ";", "To", " ", "write", " ", "a", " ", "Pant", "s", " ", "applica", "tion", " ", "you", " ", "will", " ", "first", " ", "need", " ", "to", " ", "subclass", "\\", "10", ";", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`.", " ", "You", "r", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", "\\", "10", ";", "subclass", " ", "will", " ", "contain", " ", "the", " ", "major", "it", "y", " ", "of", " ", "your", " ", "networking", " ", "code", " ", "in", " ", "the", " ", "form", "\\", "10", ";", "of", " ", "event", " ", "handler", "s", ".", " ", "Event", " ", "handler", "s", " ", "are", " ", "method", "s", " ", "beginn", "ing", " ", "with", " ", "``", "on", "\\u`", "`", " ", "and", "\\", "10", ";", "can", " ", "be", " ", "safe", "ly", " ", "overrid", "den", " ", "by", " ", "your", " ", "subclass", ".", "\\", "10", ";", "\\", "10", ";", "Connect", "ing", "\\", "10", ";", "----------", "\\", "10", ";", "Be", "fore", " ", "a", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "can", " ", "be", " ", "used", ",", " ", "it", " ", "must", "\\", "10", ";", "first", " ", "be", " ", "connect", "ed", " ", "to", " ", "a", " ", "remote", " ", "host", ".", " ", "If", " ", "you", " ", "are", " ", "writ", "ing", " ", "a", " ", "server", "\\", "10", ";", "applica", "tion", ",", " ", "all", " ", "new", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "created", " ", "by", "\\", "10", ";", "your", " ", ":", "class", ":`", "~", "pant", "s", ".", "server", ".", "Server", "`", " ", "will", " ", "be", " ", "connect", "ed", ".", " ", "On", "ce", " ", "the", "y", " ", "are", "\\", "10", ";", "created", " ", "by", " ", "the", " ", ":", "class", ":`", "~", "pant", "s", ".", "server", ".", "Server", "`", ",", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "`", " ", "will", " ", "be", " ", "call", "ed", " ", "and", " ", "your", "\\", "10", ";", ":", "class", ":`", "~", "pant", "s", ".", "eng", "ine", ".", "Engine", "`", " ", "will", " ", "begin", " ", "dispatch", "ing", " ", "events", " ", "to", " ", "your", "\\", "10", ";", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "you", " ", "are", " ", "writ", "ing", " ", "a", " ", "client", " ", "applica", "tion", ",", " ", "you", " ", "must", " ", "first", " ", "instantiate", " ", "your", "\\", "10", ";", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "subclass", " ", "and", " ", "then", " ", "use", " ", "the", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "connect", "`", " ", "method", " ", "to", " ", "connect", " ", "the", " ", "channel", " ", "to", " ", "a", "\\", "10", ";", "remote", " ", "host", ".", " ", "On", "ce", " ", "the", " ", "connecti", "on", " ", "has", " ", "bee", "n", " ", "success", "full", "y", " ", "establish", "ed", ",", " ", "the", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "`", " ", "event", " ", "handler", " ", "will", " ", "be", " ", "call", "ed", " ", "and", "\\", "10", ";", "your", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "will", " ", "start", " ", "receiv", "ing", " ", "events", ".", "\\", "10", ";", "Bear", " ", "in", " ", "mind", " ", "tha", "t", " ", "the", " ", "connecti", "on", " ", "will", " ", "not", " ", "be", " ", "establish", "ed", " ", "unti", "l", " ", "the", "\\", "10", ";", ":", "class", ":`", "~", "pant", "s", ".", "eng", "ine", ".", "Engine", "`", " ", "is", " ", "runn", "ing", ".", " ", "As", " ", "suc", "h", ",", " ", "a", " ", "common", " ", "pattern", " ", "whe", "n", "\\", "10", ";", "writ", "ing", " ", "client", " ", "applica", "tion", "s", " ", "with", " ", "Pant", "s", " ", "is", " ", "to", " ", "call", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "connect", "`", ",", " ", "start", " ", "the", " ", "eng", "ine", " ", "and", " ", "then", " ", "put", " ", "all", "\\", "10", ";", "other", " ", "initialization", " ", "code", " ", "in", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "`.", "\\", "10", ";", "\\", "10", ";", "Writ", "ing", " ", "Data", "\\", "10", ";", "------------", "\\", "10", ";", "On", "ce", " ", "your", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "is", " ", "connect", "ed", " ", "to", " ", "a", "\\", "10", ";", "remote", " ", "host", ",", " ", "you", " ", "can", " ", "begin", " ", "to", " ", "write", " ", "data", " ", "to", " ", "the", " ", "channel", ".", " ", "Us", "e", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "write", "`", " ", "to", " ", "write", " ", "string", " ", "data", " ", "to", " ", "the", " ", "channel", ",", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "write", "\\u", "file", "`", " ", "to", " ", "efficien", "tl", "y", " ", "write", " ", "data", " ", "from", "\\", "10", ";", "an", " ", "open", " ", "file", " ", "and", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "write", "\\u", "pack", "ed", "`", " ", "to", " ", "write", "\\", "10", ";", "pack", "ed", " ", "binar", "y", " ", "data", ".", " ", "As", " ", "you", " ", "call", " ", "these", " ", "method", "s", ",", " ", "Pant", "s", " ", "internal", "ly", " ", "buffer", "s", "\\", "10", ";", "your", " ", "outgoing", " ", "data", ".", " ", "On", "ce", " ", "the", " ", "buffer", " ", "is", " ", "complete", "ly", " ", "empty", ",", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "write", "`", " ", "will", " ", "be", " ", "call", "ed", ".", " ", "Be", " ", "awa", "re", " ", "tha", "t", " ", "if", "\\", "10", ";", "you", " ", "continuous", "ly", " ", "write", " ", "data", " ", "to", " ", "your", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "tha", "t", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "write", "`", " ", "may", " ", "not", " ", "be", " ", "call", "ed", " ", "very", " ", "frequent", "ly", ".", "\\", "10", ";", "If", " ", "you", " ", "wish", " ", "to", " ", "bypass", " ", "the", " ", "internal", " ", "bufferi", "ng", " ", "and", " ", "atte", "mpt", " ", "to", " ", "write", " ", "your", "\\", "10", ";", "data", " ", "immediate", "ly", " ", "you", " ", "can", " ", "use", " ", "the", " ", "``", "flush", "``", " ", "options", " ", "presen", "t", " ", "in", " ", "the", " ", "three", "\\", "10", ";", "write", " ", "method", "s", " ", "or", " ", "call", " ", "the", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "flush", "`", " ", "method", "\\", "10", ";", "your", "self", ".", " ", "Thi", "s", " ", "can", " ", "help", " ", "to", " ", "improve", " ", "your", " ", "applica", "tion", "'", "s", " ", "respons", "ive", "ness", " ", "but", "\\", "10", ";", "calling", " ", "it", " ", "excess", "ively", " ", "can", " ", "reduce", " ", "over", "all", " ", "perform", "anc", "e", ".", " ", "General", "ly", "\\", "10", ";", "speak", "ing", ",", " ", "it", " ", "is", " ", "usef", "ul", " ", "whe", "n", " ", "you", " ", "know", " ", "with", " ", "cert", "aint", "y", " ", "tha", "t", " ", "you", " ", "have", "\\", "10", ";", "finish", "ed", " ", "writ", "ing", " ", "one", " ", "discrete", " ", "chunk", " ", "of", " ", "data", " ", "(", "i", ".", "e", ".", " ", "an", " ", "HTTP", " ", "response", ").", "\\", "10", ";", "\\", "10", ";", "Reading", " ", "Data", "\\", "10", ";", "------------", "\\", "10", ";", "A", " ", "connect", "ed", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "will", " ", "automati", "call", "y", "\\", "10", ";", "receive", " ", "all", " ", "inco", "ming", " ", "data", " ", "from", " ", "the", " ", "remote", " ", "host", ".", " ", "By", " ", "default", ",", " ", "all", " ", "inco", "ming", "\\", "10", ";", "data", " ", "is", " ", "immediate", "ly", " ", "pass", "ed", " ", "to", " ", "the", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "read", "`", "\\", "10", ";", "event", " ", "handler", " ", "for", " ", "your", " ", "code", " ", "to", " ", "process", ".", " ", "The", "\\", "10", ";", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "read", "\\u", "delimiter", "`", " ", "attribute", " ", "can", " ", "be", " ", "used", " ", "to", "\\", "10", ";", "control", " ", "this", " ", "behaviour", " ", "by", " ", "caus", "ing", " ", "Pant", "s", " ", "to", " ", "buffer", " ", "inco", "ming", " ", "data", "\\", "10", ";", "internal", "ly", ",", " ", "only", " ", "forward", "ing", " ", "it", " ", "to", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "read", "`", "\\", "10", ";", "whe", "n", " ", "a", " ", "partic", "ular", " ", "condition", " ", "is", " ", "met", ".", " ", "If", " ", "the", " ", "condition", " ", "is", " ", "neve", "r", " ", "met", ",", " ", "the", "\\", "10", ";", "internal", " ", "buffer", " ", "will", " ", "eventual", "ly", " ", "exceed", " ", "the", " ", "allow", "ed", "\\", "10", ";", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "buffer", "\\u", "size", "`", " ", "and", " ", "the", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "overflow", "\\u", "error", "`", " ", "handler", " ", "method", " ", "will", " ", "be", "\\", "10", ";", "call", "ed", ".", " ", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "read", "\\u", "delimiter", "`", " ", "is", " ", "extreme", "ly", "\\", "10", ";", "power", "ful", " ", "whe", "n", " ", "used", " ", "effective", "ly", ".", "\\", "10", ";", "\\", "10", ";", "Clos", "ing", "\\", "10", ";", "-------", "\\", "10", ";", "To", " ", "close", " ", "a", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", ",", " ", "simp", "ly", " ", "call", " ", "the", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "close", "`", " ", "method", ".", " ", "On", "ce", " ", "a", " ", "stream", " ", "has", " ", "bee", "n", " ", "close", "d", "\\", "10", ";", "it", " ", "shou", "ld", " ", "not", " ", "be", " ", "reus", "ed", ".", "\\", "10", ";", "\\", "10", ";", "Hand", "ling", " ", "Error", "s", "\\", "10", ";", "--------------", "-", "\\", "10", ";", "Des", "pit", "e", " ", "best", " ", "effort", "s", ",", " ", "error", "s", " ", "will", " ", "occ", "asi", "onal", "ly", " ", "occur", " ", "in", " ", "async", "hronous", "\\", "10", ";", "code", ".", " ", "Pant", "s", " ", "handle", "s", " ", "these", " ", "error", "s", " ", "by", " ", "passi", "ng", " ", "the", " ", "result", "ing", " ", "exception", "\\", "10", ";", "object", " ", "to", " ", "one", " ", "of", " ", "a", " ", "number", " ", "of", " ", "error", " ", "handler", " ", "method", "s", ".", " ", "The", "y", " ", "are", ":", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "\\u", "error", "`", ",", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "overflow", "\\u", "error", "`", " ", "and", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "error", "`.", " ", "Addition", "ally", ",", " ", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error", "`", " ", "and", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "error", "`", " ", "exist", " ", "to", " ", "handle", " ", "SS", "L", "-", "specific", "\\", "10", ";", "error", "s", ".", "\\", "10", ";", "\\", "10", ";", "SS", "L", "\\", "10", ";", "===", "\\", "10", ";", "Pant", "s", " ", "stream", "s", " ", "have", " ", "SS", "L", " ", "support", ".", " ", "If", " ", "you", " ", "are", " ", "writ", "ing", " ", "a", " ", "server", " ", "applica", "tion", ",", "\\", "10", ";", "use", " ", ":", "meth", ":`", "Server", ".", "start", "SS", "L", " ", "<", "pant", "s", ".", "server", ".", "Server", ".", "start", "SS", "L", ">`", " ", "to", " ", "enable", " ", "SS", "L", "\\", "10", ";", "on", " ", "your", " ", "server", ".", " ", "Ea", "ch", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "created", " ", "by", " ", "your", "\\", "10", ";", "server", " ", "from", " ", "tha", "t", " ", "point", " ", "forward", " ", "will", " ", "be", " ", "SS", "L", "-", "enable", "d", ".", " ", "If", " ", "you", " ", "are", " ", "writ", "ing", " ", "a", "\\", "10", ";", "client", " ", "applica", "tion", ",", " ", "call", "\\", "10", ";", ":", "meth", ":`", "Stream", ".", "start", "SS", "L", " ", "<", "pant", "s", ".", "stream", ".", "Stream", ".", "start", "SS", "L", ">`", " ", "bef", "ore", " ", "calling", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "connect", "`.", " ", "Alternative", "ly", ",", " ", "you", " ", "can", " ", "pass", " ", "a", "\\", "10", ";", "dictionar", "y", " ", "of", " ", "SS", "L", " ", "options", " ", "to", " ", "the", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", "\\", "10", ";", "construct", "or", " ", "whi", "ch", " ", "will", " ", "then", " ", "enable", " ", "SS", "L", " ", "on", " ", "the", " ", "instance", ".", " ", "Whe", "n", " ", "SS", "L", " ", "is", "\\", "10", ";", "enable", "d", " ", "on", " ", "a", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", ",", " ", "an", " ", "SS", "L", " ", "handshake", " ", "occur", "s", "\\", "10", ";", "bet", "ween", " ", "the", " ", "local", " ", "and", " ", "remote", " ", "ends", " ", "of", " ", "the", " ", "connecti", "on", ".", " ", "On", "ce", " ", "the", " ", "SS", "L", "\\", "10", ";", "handshake", " ", "is", " ", "complete", ",", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "`", "\\", "10", ";", "will", " ", "be", " ", "call", "ed", ".", " ", "If", " ", "it", " ", "fail", "s", ",", "\\", "10", ";", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error", "`", " ", "will", " ", "be", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "you", " ", "are", " ", "writ", "ing", " ", "an", " ", "SS", "L", "-", "enable", "d", " ", "applica", "tion", " ", "you", " ", "shou", "ld", " ", "read", " ", "the", "\\", "10", ";", "entire", "ty", " ", "of", " ", "Pyth", "on", "'", "s", " ", ":", "mod", ":`", "ssl", "`", " ", "documentation", ".", " ", "Pant", "s", " ", "doe", "s", " ", "not", " ", "override", "\\", "10", ";", "any", " ", "of", " ", "Pyth", "on", "'", "s", " ", "SS", "L", " ", "default", "s", " ", "unl", "ess", " ", "clear", "ly", " ", "state", "d", " ", "in", " ", "this", " ", "documentation", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pants_", "._", "\\u", "channel_", "import_", "\\u", "Channel_", ",_", "HAS", "\\u", "IP", "V6", "_", ",_", "sock", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pants_", "._", "engine_", "import_", "Engine_", "\\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 ", " _", "from_", "nets", "truct", "_", "import_", "Net", "Struct_", "as_", "\\u", "Net", "Struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "fake", " ", "class", " ", "bec", "aus", "e", " ", "isin", "stance", " ", "expect", "s", " ", "a", " ", "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_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constants_", "\\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_", "Rege", "x", "Type_", "=_", "type_", "(_", "re_", "._", "compile_", "(_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Struct_", "=_", "struct_", "._", "Struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Logging_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "pant", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stream", " ", "Class_", "\\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_", "#", " ", "Exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "\\u", "Net", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Net", "Struct_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "stream", "-", "orient", "ed", " ", "connecti", "on", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", ":", "class", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", "`", " ", "instance", " ", "represent", "s", " ", "eit", "her", " ", "a", " ", "local", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", " ", "to", " ", "a", " ", "remote", " ", "server", " ", "or", " ", "a", " ", "remote", " ", "connecti", "on", " ", "to", " ", "a", " ", "local", "\\", "10", ";", " ", " ", " ", " ", "server", " ", "over", " ", "a", " ", "stream", "ing", ",", " ", "connecti", "on", "-", "orient", "ed", " ", "protoc", "ol", " ", "suc", "h", " ", "as", " ", "TC", "P", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", "===", " ", " ", "==============", "==============", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Key", "word", " ", "Arg", "ument", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", "===", " ", " ", "==============", "==============", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "eng", "ine", " ", " ", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "The", " ", "eng", "ine", " ", "to", " ", "whi", "ch", " ", "the", " ", "channel", "\\", "10", ";", " ", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "adde", "d", ".", " ", "Default", "s", " ", "to", " ", "the", " ", "global", " ", "eng", "ine", ".", "\\", "10", ";", " ", " ", " ", " ", "socket", " ", " ", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "A", " ", "pre", "-", "exist", "ing", " ", "socket", " ", "to", " ", "wrap", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "can", " ", "be", " ", "a", " ", "regular", " ", ":", "py", ":", "obj", ":`", "~", "socket", ".", "socket", "`", " ", "or", " ", "an", "\\", "10", ";", " ", " ", " ", " ", " ", ":", "py", ":", "obj", ":`", "~", "ssl", ".", "SS", "LS", "ocket", "`.", " ", "If", " ", "a", " ", "socket", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", "provided", ",", " ", "a", " ", "new", " ", "socket", " ", "will", " ", "be", " ", "created", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "channel", " ", "whe", "n", " ", "require", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "ssl", "\\u", "options", " ", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "If", " ", "provided", ",", "\\", "10", ";", " ", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "start", "SS", "L", "`", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", " ", "call", "ed", " ", "with", " ", "these", " ", "options", " ", "onc", "e", " ", "the", " ", "stream", " ", "is", "\\", "10", ";", " ", " ", " ", " ", " ", "read", "y", ".", " ", "By", " ", "default", ",", " ", "SS", "L", " ", "will", " ", "not", " ", "be", " ", "enable", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", "===", " ", " ", "==============", "==============", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEND", "\\u", "STRING_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEND", "\\u", "FILE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEND", "\\u", "SS", "L", "\\u", "HAND", "SHA", "KE", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Proper", "ties", " ", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\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_", "#", " ", "Sett", "ing", " ", "these", " ", "at", " ", "the", " ", "class", " ", "level", " ", "make", "s", " ", "them", " ", "easy", " ", "to", " ", "override", " ", "on", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "per", "-", "class", " ", "basi", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regex", "\\u", "search_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "buffer", "\\u", "size_", "=_", "2_", "**_", "16_", "#", " ", "64", "kb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Control", " ", "Meth", "ods", " ", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\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_", "#####", " ", "I", "/", "O", " ", "Meth", "ods", " ", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\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_", "#####", " ", "Public", " ", "Event", " ", "Handle", "rs", " ", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Public", " ", "Error", " ", "Handle", "rs", " ", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\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_", "#####", " ", "Intern", "al", " ", "Meth", "ods", " ", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Intern", "al", " ", "Event", " ", "Handle", "r", " ", "Meth", "ods", " ", "###########", "###########", "###########", "#####", "_", "\\u\\u\\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_", "#####", " ", "Intern", "al", " ", "Process", "ing", " ", "Meth", "ods", " ", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\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_", "#####", " ", "SS", "L", " ", "Implementation", " ", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\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_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "kwargs_", "._", "get_", "(_", "\"", "socket", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sock_", "and_", "sock", "\\u", "type_", "(_", "sock_", ")_", "!=_", "socket_", "._", "SOCK", "\\u", "STREAM_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Cann", "ot", " ", "create", " ", "a", " ", "%", "s", " ", "with", " ", "a", " ", "socket", " ", "type", " ", "other", " ", "than", " ", "SOCK", "\\u", "STRE", "AM", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Channel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Socket_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "remote", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "/", "O", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "delimiter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "self_", "._", "\\u", "buffer", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chan", "nel", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connected_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SS", "L", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ssl", "\\u", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "socket", "\\u", "wrapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "handshake", "\\u", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "call", "\\u", "on", "\\u", "connect_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "kwargs_", "._", "get_", "(_", "\"", "socket", "\"_", ",_", "None_", ")_", ",_", "ssl_", "._", "SS", "LS", "ocket", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "socket", "\\u", "wrapped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "SSL_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kwargs_", "._", "get_", "(_", "\"", "ssl", "\\u", "options", "\"_", ",_", "None_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "SSL_", "(_", "kwargs_", "[_", "\"", "ssl", "\\u", "options", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remote", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "remote", " ", "address", " ", "to", " ", "whi", "ch", " ", "the", " ", "channel", " ", "is", " ", "connect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "this", " ", "will", " ", "be", " ", "the", " ", "value", " ", "of", " ", "``", "socket", ".", "getp", "eer", "name", "``", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", ".", " ", "It", " ", "is", " ", "possib", "le", " ", "for", " ", "user", " ", "code", " ", "to", " ", "override", " ", "the", " ", "default", "\\", "10", ";", " ", " ", " ", " ", "behaviour", " ", "and", " ", "set", " ", "the", " ", "value", " ", "of", " ", "the", " ", "property", " ", "manu", "ally", ".", " ", "In", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "return", " ", "the", " ", "property", " ", "to", " ", "its", " ", "default", " ", "behaviour", ",", " ", "user", " ", "code", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "to", " ", "delete", " ", "the", " ", "value", ".", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "default", " ", "behaviour", "\\", "10", ";", " ", " ", " ", " ", "channel", ".", "remote", "\\u", "address", " ", "=", " ", "custom", "\\u", "value", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "channel", ".", "remote", "\\u", "address", " ", "will", " ", "return", " ", "custom", "\\u", "value", " ", "now", "\\", "10", ";", " ", " ", " ", " ", "del", " ", "channel", ".", "remote", "\\u", "address", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "default", " ", "behaviour", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "remote", "\\u", "address_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "remote", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "socket_", ":_", "\\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", "socket_", "._", "getp", "eer", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "remote", "\\u", "address_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remote", "\\u", "address_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "remote", "\\u", "address_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "remote", "\\u", "address_", "._", "deleter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remote", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "remote", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\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_", "local", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "address", " ", "of", " ", "the", " ", "channel", " ", "on", " ", "the", " ", "local", " ", "machine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "this", " ", "will", " ", "be", " ", "the", " ", "value", " ", "of", " ", "``", "socket", ".", "getsockname", "``", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", ".", " ", "It", " ", "is", " ", "possib", "le", " ", "for", " ", "user", " ", "code", " ", "to", " ", "override", " ", "the", " ", "default", "\\", "10", ";", " ", " ", " ", " ", "behaviour", " ", "and", " ", "set", " ", "the", " ", "value", " ", "of", " ", "the", " ", "property", " ", "manu", "ally", ".", " ", "In", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "return", " ", "the", " ", "property", " ", "to", " ", "its", " ", "default", " ", "behaviour", ",", " ", "user", " ", "code", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "to", " ", "delete", " ", "the", " ", "value", ".", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "default", " ", "behaviour", "\\", "10", ";", " ", " ", " ", " ", "channel", ".", "local", "\\u", "address", " ", "=", " ", "custom", "\\u", "value", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "channel", ".", "local", "\\u", "address", " ", "will", " ", "return", " ", "custom", "\\u", "value", " ", "now", "\\", "10", ";", " ", " ", " ", " ", "del", " ", "channel", ".", "local", "\\u", "address", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "default", " ", "behaviour", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "local", "\\u", "address_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "local", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "socket_", ":_", "\\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", "socket_", "._", "getsockname", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "local", "\\u", "address_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "address_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "local", "\\u", "address_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "local", "\\u", "address_", "._", "deleter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "local", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\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_", "read", "\\u", "delimiter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "magic", "al", " ", "read", " ", "delimiter", " ", "whi", "ch", " ", "dete", "rmin", "es", " ", "how", " ", "inco", "ming", " ", "data", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "buffered", " ", "by", " ", "the", " ", "stream", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "As", " ", "data", " ", "is", " ", "read", " ", "from", " ", "the", " ", "socket", ",", " ", "it", " ", "is", " ", "buffered", " ", "internal", "ly", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "stream", " ", "bef", "ore", " ", "bei", "ng", " ", "pass", "ed", " ", "to", " ", "the", " ", ":", "meth", ":`", "on", "\\u", "read", "`", " ", "callback", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "the", " ", "read", " ", "delimiter", " ", "dete", "rmin", "es", " ", "whe", "n", " ", "the", " ", "data", " ", "is", " ", "pass", "ed", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "callback", ".", " ", "Valid", " ", "values", " ", "are", " ", "``", "Non", "e", "``", ",", " ", "a", " ", "byte", " ", "string", ",", " ", "an", " ", "integ", "er", "/", "long", ",", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "compile", "d", " ", "regular", " ", "express", "ion", ",", " ", "an", " ", "instance", " ", "of", " ", ":", "class", ":`", "struct", ".", "Stru", "ct", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "an", " ", "instance", " ", "of", " ", ":", "class", ":`", "nets", "truct", ".", "Net", "Stru", "ct", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "``", "Non", "e", "``", ",", " ", "data", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "on", "\\u", "read", "`", " ", "immediate", "ly", " ", "after", " ", "it", " ", "is", " ", "read", " ", "from", " ", "the", " ", "socket", ".", " ", "Thi", "s", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "default", " ", "behaviour", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "a", " ", "byte", " ", "string", ",", " ", "data", " ", "will", " ", "be", " ", "buffered", "\\", "10", ";", " ", " ", " ", " ", "internal", "ly", " ", "unti", "l", " ", "tha", "t", " ", "string", " ", "is", " ", "encounter", "ed", " ", "in", " ", "the", " ", "inco", "ming", "\\", "10", ";", " ", " ", " ", " ", "data", ".", " ", "All", " ", "data", " ", "up", " ", "to", " ", "but", " ", "excluding", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "pass", "ed", " ", "to", " ", ":", "meth", ":`", "on", "\\u", "read", "`.", " ", "The", " ", "segment", " ", "matchi", "ng", " ", "the", " ", "read", " ", "delimiter", "\\", "10", ";", " ", " ", " ", " ", "its", "elf", " ", "is", " ", "discard", "ed", " ", "from", " ", "the", " ", "buffer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "an", " ", "integ", "er", " ", "or", " ", "a", " ", "long", ",", " ", "it", " ", "is", " ", "treat", "ed", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "the", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "read", " ", "bef", "ore", " ", "passi", "ng", " ", "the", " ", "data", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "on", "\\u", "read", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "a", " ", ":", "class", ":`", "struct", ".", "Stru", "ct", "`", " ", "instance", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Stru", "ct", "'", "s", " ", "``", "size", "``", " ", "is", " ", "full", "y", " ", "buffered", " ", "and", " ", "the", " ", "data", " ", "is", " ", "unpacked", " ", "usi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Stru", "ct", " ", "bef", "ore", " ", "its", " ", "sent", " ", "to", " ", ":", "meth", ":`", "on", "\\u", "read", "`.", " ", "Unli", "ke", " ", "other", " ", "types", " ", "of", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "delimiter", "s", ",", " ", "this", " ", "can", " ", "result", " ", "in", " ", "more", " ", "than", " ", "one", " ", "argu", "ment", " ", "bei", "ng", " ", "pass", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "on", "\\u", "read", "`", ",", " ", "as", " ", "in", " ", "the", " ", "follow", "ing", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "struct", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "pant", "s", " ", "import", " ", "Stream", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Exam", "ple", "(", "Stream", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "on", "\\u", "connect", "(", "self", "):", "\\", "10", ";", " ", " ", "self", ".", "read", "\\u", "delimiter", " ", "=", " ", "struct", ".", "Stru", "ct", "(\"", "!", "LL", "H", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "on", "\\u", "read", "(", "self", ",", " ", "packet", "\\u", "type", ",", " ", "length", ",", " ", "id", "):", "\\", "10", ";", " ", " ", "pass", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "an", " ", "instance", " ", "of", " ", ":", "class", ":`", "nets", "truct", ".", "Net", "Stru", "ct", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Net", "Stru", "ct", "'", "s", " ", ":", "attr", ":`", "~", "nets", "truct", ".", "Net", "Stru", "ct", ".", "minim", "um", "\\u", "size", "`", " ", "is", " ", "buffered", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "unpacked", " ", "with", " ", "the", " ", "Net", "Stru", "ct", ",", " ", "and", " ", "addition", "al", " ", "data", " ", "is", " ", "buffered", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "necessar", "y", " ", "unti", "l", " ", "the", " ", "Net", "Stru", "ct", " ", "can", " ", "be", " ", "complete", "ly", " ", "unpacked", ".", " ", "On", "ce", " ", "read", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "data", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", ":", "meth", ":`", "on", "\\u", "read", "`.", " ", "Us", "ing", " ", "Stru", "ct", " ", "and", " ", "Net", "Stru", "ct", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "*", "very", "*", " ", "similar", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "a", " ", "compile", "d", " ", "regular", " ", "express", "ion", "\\", "10", ";", " ", " ", " ", " ", "(:", "class", ":`", "re", ".", "Rege", "x", "Object", "`)", ",", " ", "there", " ", "are", " ", "two", " ", "possib", "le", " ", "behavior", "s", " ", "tha", "t", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "switch", " ", "bet", "ween", " ", "by", " ", "setti", "ng", " ", "the", " ", "value", " ", "of", " ", ":", "attr", ":`", "regex", "\\u", "search", "`.", " ", "If", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", "regex", "\\u", "search", "`", " ", "is", " ", "Tru", "e", ",", " ", "as", " ", "is", " ", "the", " ", "default", ",", " ", "the", " ", "delimiter", "'", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "re", ".", "Rege", "x", "Object", ".", "search", "`", " ", "method", " ", "is", " ", "used", " ", "and", ",", " ", "if", " ", "a", " ", "match", " ", "is", " ", "found", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "string", " ", "bef", "ore", " ", "tha", "t", " ", "match", " ", "is", " ", "pass", "ed", " ", "to", " ", ":", "meth", ":`", "on", "\\u", "read", "`.", " ", "The", " ", "segment", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "was", " ", "matche", "d", " ", "by", " ", "the", " ", "regular", " ", "express", "ion", " ", "will", " ", "be", " ", "discard", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", ":", "attr", ":`", "regex", "\\u", "search", "`", " ", "is", " ", "Fal", "se", ",", " ", "the", " ", "delimiter", "'", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "re", ".", "Rege", "x", "Object", ".", "match", "`", " ", "method", " ", "is", " ", "used", " ", "inst", "ead", " ", "and", ",", " ", "if", " ", "a", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "found", ",", " ", "the", " ", "match", " ", "object", " ", "its", "elf", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", ":", "meth", ":`", "on", "\\u", "read", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "gi", "ving", " ", "you", " ", "access", " ", "to", " ", "the", " ", "captur", "e", " ", "group", "s", ".", " ", "Again", ",", " ", "the", " ", "segment", " ", "tha", "t", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "matche", "d", " ", "by", " ", "the", " ", "regular", " ", "express", "ion", " ", "will", " ", "be", " ", "discard", "ed", " ", "from", " ", "the", " ", "buffer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", "ing", " ", "to", " ", "set", " ", "the", " ", "read", " ", "delimiter", " ", "to", " ", "any", " ", "other", " ", "value", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Type", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "effective", " ", "use", " ", "of", " ", "the", " ", "read", " ", "delimiter", " ", "can", " ", "great", "ly", " ", "simplify", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "implementation", " ", "of", " ", "cert", "ain", " ", "protoc", "ols", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "read", "\\u", "delimiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "read", "\\u", "delimiter_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read", "\\u", "delimiter_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", "or_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", "or_", "isinstance_", "(_", "value_", ",_", "Rege", "x", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "\\u", "delimiter_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "self_", "._", "\\u", "buffer", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "\\u", "delimiter_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "self_", "._", "\\u", "buffer", "\\u", "size_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "\\u", "delimiter_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "self_", "._", "\\u", "buffer", "\\u", "size_", ",_", "value_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "\\u", "Net", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "\\u", "delimiter_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "self_", "._", "\\u", "buffer", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "._", "minim", "um", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Atte", "mpte", "d", " ", "to", " ", "set", " ", "read", "\\u", "delimiter", " ", "to", " ", "a", " ", "value", " ", "with", " ", "an", " ", "invalid", " ", "type", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "Net", "Stru", "ct", " ", "state", " ", "whe", "n", " ", "we", " ", "change", " ", "the", " ", "read", " ", "delimiter", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "buffer", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "maxim", "um", " ", "size", ",", " ", "in", " ", "bytes", ",", " ", "of", " ", "the", " ", "internal", " ", "buffer", " ", "used", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "inco", "ming", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "bufferi", "ng", " ", "data", " ", "it", " ", "is", " ", "importa", "nt", " ", "to", " ", "ensure", " ", "tha", "t", " ", "inor", "din", "ate", "\\", "10", ";", " ", " ", " ", " ", "amounts", " ", "of", " ", "memory", " ", "are", " ", "not", " ", "used", ".", " ", "Sett", "ing", " ", "the", " ", "buffer", " ", "size", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "sensi", "ble", " ", "value", " ", "can", " ", "prevent", " ", "codi", "ng", " ", "error", "s", " ", "or", " ", "mali", "cio", "us", " ", "use", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "caus", "ing", " ", "your", " ", "applica", "tion", " ", "to", " ", "consume", " ", "incr", "easi", "ngl", "y", " ", "large", " ", "amounts", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "memory", ".", " ", "By", " ", "default", ",", " ", "a", " ", "maxim", "um", " ", "of", " ", "64", "kb", " ", "of", " ", "data", " ", "will", " ", "be", " ", "store", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "buffer", " ", "size", " ", "is", " ", "mainl", "y", " ", "rele", "van", "t", " ", "whe", "n", " ", "usi", "ng", " ", "a", " ", "string", " ", "value", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "read", "\\u", "delimiter", "`.", " ", "Be", "caus", "e", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "cann", "ot", " ", "guaran", "tee", " ", "tha", "t", " ", "the", " ", "string", " ", "will", " ", "appear", ",", " ", "hav", "ing", " ", "an", " ", "upper", "\\", "10", ";", " ", " ", " ", " ", "limit", " ", "on", " ", "the", " ", "size", " ", "of", " ", "the", " ", "data", " ", "is", " ", "appropr", "iate", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "read", " ", "delimiter", " ", "is", " ", "set", " ", "to", " ", "a", " ", "number", " ", "large", "r", " ", "than", " ", "the", " ", "buffer", "\\", "10", ";", " ", " ", " ", " ", "size", ",", " ", "the", " ", "buffer", " ", "size", " ", "will", " ", "be", " ", "increase", "d", " ", "to", " ", "accom", "mod", "ate", " ", "the", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "delimiter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "the", " ", "internal", " ", "buffer", "'", "s", " ", "size", " ", "exceed", "s", " ", "the", " ", "maxim", "um", " ", "allow", "ed", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "overflow", "\\u", "error", "`", " ", "callback", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "invoke", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", "ing", " ", "to", " ", "set", " ", "the", " ", "buffer", " ", "size", " ", "to", " ", "anyt", "hing", " ", "other", " ", "than", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "integ", "er", " ", "or", " ", "long", " ", "will", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Type", "Error", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "buffer", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "buffer", "\\u", "size_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "buffer", "\\u", "size_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "(_", "long_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "buffer", "\\u", "size", " ", "must", " ", "be", " ", "an", " ", "int", " ", "or", " ", "a", " ", "long", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "buffer", "\\u", "size_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "\\u", "read", "\\u", "delimiter_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "value_", ",_", "self_", "._", "\\u", "read", "\\u", "delimiter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "self_", "._", "\\u", "read", "\\u", "delimiter_", ",_", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "delimiter_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "self_", "._", "\\u", "read", "\\u", "delimiter_", ",_", "\\u", "Net", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "max_", "(_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "delimiter_", "._", "minim", "um", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "SSL_", "(_", "self_", ",_", "ssl", "\\u", "options_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Enable", " ", "SS", "L", " ", "on", " ", "the", " ", "channel", " ", "and", " ", "perform", " ", "a", " ", "handshake", " ", "at", " ", "the", " ", "next", "\\", "10", ";", " ", " ", " ", " ", "opportunit", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SS", "L", " ", "is", " ", "only", " ", "enable", "d", " ", "on", " ", "a", " ", "channel", " ", "onc", "e", " ", "all", " ", "currentl", "y", " ", "pend", "ing", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "bee", "n", " ", "writt", "en", ".", " ", "If", " ", "a", " ", "problem", " ", "occur", "s", " ", "at", " ", "this", " ", "stage", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "error", "`", " ", "is", " ", "call", "ed", ".", " ", "On", "ce", " ", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "bee", "n", " ", "enable", "d", ",", " ", "the", " ", "SS", "L", " ", "handshake", " ", "begins", " ", "-", " ", "this", " ", "typical", "ly", "\\", "10", ";", " ", " ", " ", " ", "take", "s", " ", "some", " ", "time", " ", "and", " ", "may", " ", "fail", ",", " ", "in", " ", "whi", "ch", " ", "case", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error", "`", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", ".", " ", "Whe", "n", " ", "the", " ", "handshake", " ", "is", " ", "success", "full", "y", " ", "complete", "d", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "`", " ", "is", " ", "call", "ed", " ", "and", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "channel", " ", "is", " ", "secure", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Typical", "ly", ",", " ", "this", " ", "method", " ", "is", " ", "call", "ed", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "connect", "`.", " ", "In", " ", "this", " ", "case", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "ssl", "\\u", "handshake", "`", " ", "will", " ", "be", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "`.", " ", "If", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "start", "SS", "L", "`", " ", "is", " ", "call", "ed", " ", "after", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "connect", "`", ",", " ", "the", " ", "reverse", " ", "is", " ", "true", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "possib", "le", ",", " ", "alth", "ou", "gh", " ", "unu", "sua", "l", ",", " ", "to", " ", "start", " ", "SS", "L", " ", "on", " ", "a", " ", "channel", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "alr", "ead", "y", " ", "connect", "ed", " ", "and", " ", "active", ".", " ", "In", " ", "this", " ", "case", ",", " ", "as", " ", "note", "d", " ", "above", ",", "\\", "10", ";", " ", " ", " ", " ", "SS", "L", " ", "will", " ", "only", " ", "be", " ", "enable", "d", " ", "and", " ", "the", " ", "handshake", " ", "perform", "ed", " ", "after", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "currentl", "y", " ", "pend", "ing", " ", "data", " ", "has", " ", "bee", "n", " ", "writt", "en", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "SS", "L", " ", "options", " ", "argu", "ment", " ", "will", " ", "be", " ", "pass", "ed", " ", "through", " ", "to", "\\", "10", ";", " ", " ", " ", " ", ":", "func", ":`", "ssl", ".", "wrap", "\\u", "socket", "`", " ", "as", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "-", " ", "see", " ", "the", "\\", "10", ";", " ", " ", " ", " ", ":", "mod", ":`", "ssl", "`", " ", "documentation", " ", "for", " ", "fur", "ther", " ", "informati", "on", ".", " ", "You", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "typical", "ly", " ", "want", " ", "to", " ", "provide", " ", "the", " ", "``", "keyfile", "``", ",", " ", "``", "certfile", "``", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "ca", "\\u", "cert", "s", "``", " ", "options", ".", " ", "The", " ", "``", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect", "``", " ", "option", "\\", "10", ";", " ", " ", " ", " ", "**", "must", "**", " ", "be", " ", "``", "Fal", "se", "``", ",", " ", "or", " ", "a", " ", ":", "exc", ":`", "Value", "Error", "`", " ", "will", " ", "be", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", "ing", " ", "to", " ", "enable", " ", "SS", "L", " ", "on", " ", "a", " ", "close", "d", " ", "channel", " ", "or", " ", "a", " ", "channel", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "alr", "ead", "y", " ", "has", " ", "SS", "L", " ", "enable", "d", " ", "on", " ", "it", " ", "will", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Run", "time", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "============", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", " ", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "============", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "ssl", "\\u", "options", " ", " ", "*", "Optio", "nal", ".*", " ", "Key", "word", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", "\\", "10", ";", " ", " ", " ", ":", "func", ":`", "ssl", ".", "wrap", "\\u", "socket", "`.", "\\", "10", ";", " ", " ", " ", " ", "============", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "enabled_", "or_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "start", "SS", "L", "()", " ", "call", "ed", " ", "on", " ", "SS", "L", "-", "enable", "d", " ", "%", "r", "\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", "or_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "start", "SS", "L", "()", " ", "call", "ed", " ", "on", " ", "close", "d", " ", "%", "r", "\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ssl", "\\u", "options_", "._", "setdefault_", "(_", "\"", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect", "\"_", ",_", "False_", ")_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "SS", "L", " ", "option", " ", "'", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect", "'", " ", "must", " ", "be", " ", "Fal", "se", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "append_", "(_", "(_", "Stream_", "._", "SEND", "\\u", "SS", "L", "\\u", "HAND", "SHA", "KE", "_", ",_", "ssl", "\\u", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Connect", " ", "the", " ", "channel", " ", "to", " ", "a", " ", "remote", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "give", "n", " ", "``", "address", "``", " ", "is", " ", "resolve", "d", " ", "and", " ", "used", " ", "by", " ", "the", " ", "channel", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "connect", " ", "to", " ", "the", " ", "remote", " ", "server", ".", " ", "If", " ", "an", " ", "error", " ", "occur", "s", " ", "at", " ", "any", " ", "stage", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "process", ",", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "\\u", "error", "`", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", ".", " ", "Whe", "n", " ", "a", " ", "connecti", "on", " ", "is", " ", "success", "full", "y", " ", "establish", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "connect", "`", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Address", "es", " ", "can", " ", "be", " ", "represent", "ed", " ", "in", " ", "a", " ", "number", " ", "of", " ", "different", " ", "way", "s", ".", " ", "A", "\\", "10", ";", " ", " ", " ", " ", "single", " ", "string", " ", "is", " ", "treat", "ed", " ", "as", " ", "a", " ", "UNIX", " ", "address", ".", " ", "A", " ", "single", " ", "integ", "er", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "treat", "ed", " ", "as", " ", "a", " ", "port", " ", "and", " ", "convert", "ed", " ", "to", " ", "a", " ", "2", "-", "tuple", " ", "of", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "``", "(''", ",", " ", "port", ")``.", " ", "A", " ", "2", "-", "tuple", " ", "is", " ", "treat", "ed", " ", "as", " ", "an", " ", "IP", "v", "4", " ", "address", " ", "and", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "4", "-", "tuple", " ", "is", " ", "treat", "ed", " ", "as", " ", "an", " ", "IP", "v6", " ", "address", ".", " ", "See", " ", "the", " ", ":", "mod", ":`", "socket", "`", "\\", "10", ";", " ", " ", " ", " ", "documentation", " ", "for", " ", "fur", "ther", " ", "informati", "on", " ", "on", " ", "socket", " ", "addresse", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "socket", " ", "exist", "s", " ", "on", " ", "the", " ", "channel", ",", " ", "one", " ", "will", " ", "be", " ", "created", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "socket", " ", "famil", "y", " ", "appropr", "iate", " ", "for", " ", "the", " ", "give", "n", " ", "address", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "error", " ", "will", " ", "occur", " ", "dur", "ing", " ", "the", " ", "connecti", "on", " ", "if", " ", "the", " ", "give", "n", " ", "address", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "not", " ", "of", " ", "a", " ", "valid", " ", "format", " ", "or", " ", "of", " ", "an", " ", "ina", "ppro", "pri", "ate", " ", "format", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "socket", " ", "(", "e", ".", "g", ".", " ", "if", " ", "an", " ", "IP", " ", "address", " ", "is", " ", "give", "n", " ", "to", " ", "a", " ", "UNIX", " ", "socket", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ing", " ", ":", "meth", ":`", "connect", "()`", " ", "on", " ", "a", " ", "close", "d", " ", "channel", " ", "or", " ", "a", " ", "channel", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "alr", "ead", "y", " ", "connect", "ed", " ", "will", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Run", "time", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", " ", "==============", "==============", "==============", "=====", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", " ", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", " ", "==============", "==============", "==============", "=====", "\\", "10", ";", " ", " ", " ", " ", "address", " ", " ", "The", " ", "remote", " ", "address", " ", "to", " ", "connect", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", " ", "==============", "==============", "==============", "=====", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "connected_", "or_", "self_", "._", "connecti", "ng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "connect", "()", " ", "call", "ed", " ", "on", " ", "active", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", "or_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "connect", "()", " ", "call", "ed", " ", "on", " ", "close", "d", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "connecti", "ng_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "address_", ",_", "family_", ",_", "resolved_", "=_", "self_", "._", "\\u", "format\\u", "address_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "resolved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "do", "\\u", "connect_", "(_", "address_", ",_", "family_", ")_", "\\u\\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 ", " _", "result_", "=_", "socket_", "._", "getadd", "rin", "fo_", "(_", "address_", "[_", "0_", "]_", ",_", "address_", "[_", "1_", "]_", ",_", "family_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "Stream", "Connect", "Error_", "(_", "err_", "._", "errno_", ",_", "err_", "._", "strerror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect", "\\u", "error_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "only", " ", "care", " ", "abo", "ut", " ", "the", " ", "first", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "connect_", "(_", "result_", "[_", "-_", "1_", "]_", ",_", "result_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "flush_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clos", "e", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", ":_", "\\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_", "flush_", "and_", "self_", "._", "\\u", "send", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "closing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "\\u", "delimiter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connected_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ssl", "\\u", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "socket", "\\u", "wrapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "handshake", "\\u", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "call", "\\u", "on", "\\u", "connect_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "remote", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Channel_", "._", "close_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "closing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "data_", ",_", "flush_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "data", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Data", " ", "will", " ", "not", " ", "be", " ", "writt", "en", " ", "immediate", "ly", ",", " ", "but", " ", "will", " ", "be", " ", "buffered", "\\", "10", ";", " ", " ", " ", " ", "internal", "ly", " ", "unti", "l", " ", "it", " ", "can", " ", "be", " ", "sent", " ", "with", "out", " ", "blockin", "g", " ", "the", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ing", " ", ":", "meth", ":`", "write", "()`", " ", "on", " ", "a", " ", "close", "d", " ", "or", " ", "disconnected", " ", "channel", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Run", "time", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", " ", "A", " ", "string", " ", "of", " ", "data", " ", "to", " ", "write", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "flush", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "If", " ", "Tru", "e", ",", " ", "flush", " ", "the", " ", "internal", " ", "write", "\\", "10", ";", " ", " ", "buffer", ".", " ", "See", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "flush", "`", " ", "for", "\\", "10", ";", " ", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", "or_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "write", "()", " ", "call", "ed", " ", "on", " ", "close", "d", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "write", "()", " ", "call", "ed", " ", "on", " ", "disconnected", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "send", "\\u", "buffer_", "and_", "self_", "._", "\\u", "send", "\\u", "buffer_", "[_", "-_", "1_", "]_", "[_", "0_", "]_", "==_", "Stream_", "._", "SEND", "\\u", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", ",_", "exist", "ing", "\\u", "data_", "=_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "pop_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "exist", "ing", "\\u", "data_", "+_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "append_", "(_", "(_", "Stream_", "._", "SEND", "\\u", "STRING_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "flush_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\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", "start", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "file_", "(_", "self_", ",_", "sfile_", ",_", "nbytes_", "=_", "0_", ",_", "offset_", "=_", "0_", ",_", "flush_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "a", " ", "file", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "file", " ", "will", " ", "not", " ", "be", " ", "writt", "en", " ", "immediate", "ly", ",", " ", "but", " ", "will", " ", "be", " ", "buffered", "\\", "10", ";", " ", " ", " ", " ", "internal", "ly", " ", "unti", "l", " ", "it", " ", "can", " ", "be", " ", "sent", " ", "with", "out", " ", "blockin", "g", " ", "the", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ing", " ", ":", "meth", ":`", "write", "\\u", "file", "()`", " ", "on", " ", "a", " ", "close", "d", " ", "or", " ", "disconnected", " ", "channel", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Run", "time", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "sfi", "le", " ", " ", " ", "A", " ", "file", " ", "object", " ", "to", " ", "write", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "nb", "ytes", " ", " ", "*", "Optio", "nal", ".*", " ", "The", " ", "number", " ", "of", " ", "bytes", " ", "of", " ", "the", " ", "file", " ", "to", "\\", "10", ";", " ", " ", "write", ".", " ", "If", " ", "0", ",", " ", "all", " ", "bytes", " ", "will", " ", "be", " ", "writt", "en", ".", "\\", "10", ";", " ", " ", " ", " ", "offset", " ", " ", "*", "Optio", "nal", ".*", " ", "The", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "offset", " ", "writ", "ing", "\\", "10", ";", " ", " ", "by", ".", "\\", "10", ";", " ", " ", " ", " ", "flush", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "If", " ", "Tru", "e", ",", " ", "flush", " ", "the", " ", "internal", " ", "write", "\\", "10", ";", " ", " ", "buffer", ".", " ", "See", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "flush", "`", " ", "for", "\\", "10", ";", " ", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", "or_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "write", "\\u", "file", "()", " ", "call", "ed", " ", "on", " ", "close", "d", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "write", "\\u", "file", "()", " ", "call", "ed", " ", "on", " ", "disconnected", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "append_", "(_", "(_", "Stream_", "._", "SEND", "\\u", "FILE_", ",_", "(_", "sfile_", ",_", "offset_", ",_", "nbytes_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "flush_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\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", "start", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "packed_", "(_", "self_", ",_", "*_", "data_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "pack", "ed", " ", "binar", "y", " ", "data", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "current", " ", ":", "attr", ":`", "read", "\\u", "delimiter", "`", " ", "is", " ", "an", " ", "instance", " ", "of", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "struct", ".", "Stru", "ct", "`", " ", "or", " ", ":", "class", ":`", "nets", "truct", ".", "Net", "Stru", "ct", "`", " ", "the", " ", "format", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "read", " ", "from", " ", "tha", "t", " ", "Stru", "ct", ",", " ", "other", "wis", "e", " ", "you", " ", "will", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "provide", " ", "a", " ", "``", "format", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "\\\\*", "data", " ", " ", "Any", " ", "number", " ", "of", " ", "values", " ", "to", " ", "be", " ", "pass", "ed", " ", "through", "\\", "10", ";", " ", " ", ":", "mod", ":`", "struct", "`", " ", "and", " ", "writt", "en", " ", "to", " ", "the", " ", "remote", " ", "host", ".", "\\", "10", ";", " ", " ", " ", " ", "flush", " ", " ", " ", "*", "Optio", "nal", ".*", " ", "If", " ", "Tru", "e", ",", " ", "flush", " ", "the", " ", "internal", " ", "write", "\\", "10", ";", " ", " ", "buffer", ".", " ", "See", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "flush", "`", "\\", "10", ";", " ", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "format", " ", " ", "*", "Optio", "nal", ".*", " ", "A", " ", "format", "ting", " ", "string", " ", "to", " ", "pack", " ", "the", "\\", "10", ";", " ", " ", "provided", " ", "data", " ", "with", ".", " ", "If", " ", "one", " ", "isn", "'", "t", " ", "provided", ",", " ", "the", " ", "read", "\\", "10", ";", " ", " ", "delimiter", " ", "will", " ", "be", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "=_", "kwargs_", "._", "get_", "(_", "\"", "format", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "struct_", "._", "pack_", "(_", "format_", ",_", "*_", "data_", ")_", ",_", "kwargs_", "._", "get_", "(_", "\"", "flush", "\"_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "self_", "._", "\\u", "read", "\\u", "delimiter_", ",_", "(_", "Struct_", ",_", "\\u", "Net", "Struct_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "No", " ", "format", " ", "is", " ", "avail", "able", " ", "for", " ", "writ", "ing", " ", "pack", "ed", " ", "data", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "self_", "._", "\\u", "read", "\\u", "delimiter_", "._", "pack_", "(_", "*_", "data_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "._", "get_", "(_", "\"", "flush", "\"_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\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_", "flush_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", " ", "to", " ", "immediate", "ly", " ", "write", " ", "any", " ", "internal", "ly", " ", "buffered", " ", "data", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "channel", " ", "with", "out", " ", "wait", "ing", " ", "for", " ", "a", " ", "write", " ", "event", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "can", " ", "be", " ", "fair", "ly", " ", "expen", "sive", " ", "to", " ", "call", " ", "and", " ", "shou", "ld", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "spar", "ingl", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ing", " ", ":", "meth", ":`", "flush", "()`", " ", "on", " ", "a", " ", "close", "d", " ", "or", " ", "disconnected", " ", "channel", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "a", " ", ":", "exc", ":`", "Run", "time", "Error", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "closed_", "or_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "flush", "()", " ", "call", "ed", " ", "on", " ", "close", "d", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "flush", "()", " ", "call", "ed", " ", "on", " ", "disconnected", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "send", "\\u", "buffer_", ":_", "\\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_", "self_", "._", "\\u", "stop", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Place", "holder", ".", " ", "Call", "ed", " ", "after", " ", "the", " ", "channel", " ", "has", " ", "finish", "ed", " ", "its", " ", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", "handshake", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error_", "(_", "self_", ",_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Place", "holder", ".", " ", "Call", "ed", " ", "whe", "n", " ", "an", " ", "error", " ", "occur", "s", " ", "dur", "ing", " ", "the", " ", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", "handshake", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "logs", " ", "the", " ", "exception", " ", "and", " ", "closes", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", " ", " ", "The", " ", "exception", " ", "tha", "t", " ", "was", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "exception_", "(_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "ssl", "\\u", "error_", "(_", "self_", ",_", "exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Place", "holder", ".", " ", "Call", "ed", " ", "whe", "n", " ", "an", " ", "error", " ", "occur", "s", " ", "in", " ", "the", " ", "underl", "ying", " ", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", "implementation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", ",", " ", "logs", " ", "the", " ", "exception", " ", "and", " ", "closes", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", " ", " ", "The", " ", "exception", " ", "tha", "t", " ", "was", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "exception_", "(_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "do", "\\u", "connect_", "(_", "self_", ",_", "address_", ",_", "family_", ",_", "error_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "callback", " ", "method", " ", "to", " ", "be", " ", "used", " ", "with", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "resolve", "\\u", "addr", "`", " ", "-", " ", "eit", "her", " ", "connects", "\\", "10", ";", " ", " ", " ", " ", "immediate", "ly", " ", "or", " ", "notifi", "es", " ", "the", " ", "user", " ", "of", " ", "an", " ", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "==============", "==============", "==============", "=========", "==", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "==============", "==============", "==============", "=========", "==", "\\", "10", ";", " ", " ", " ", " ", "address", " ", " ", " ", " ", "The", " ", "address", " ", "to", " ", "connect", " ", "to", " ", "or", " ", "Non", "e", " ", "if", " ", "address", "\\", "10", ";", " ", "resolu", "tion", " ", "fail", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "famil", "y", " ", "The", " ", "detect", "ed", " ", "socket", " ", "famil", "y", " ", "or", " ", "Non", "e", " ", "if", " ", "address", "\\", "10", ";", " ", "resolu", "tion", " ", "fail", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "error", " ", " ", "*", "Optio", "nal", ".*", " ", "Error", " ", "informati", "on", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "error", "\\", "10", ";", " ", "occur", "red", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "==============", "==============", "==============", "=========", "==", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "address_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connecti", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "Stream", "Connect", "Error_", "(_", "*_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect", "\\u", "error_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "socket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "socket_", "._", "family_", "!=_", "family_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "engine_", "._", "remove", "\\u", "channel_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closed_", "=_", "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_", "sock_", "=_", "socket_", "._", "socket_", "(_", "family_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket", "\\u", "set_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "add", "\\u", "channel_", "(_", "self_", ")_", "\\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 ", " _", "connected_", "=_", "self_", "._", "\\u", "socket", "\\u", "connect_", "(_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "Stream", "Connect", "Error_", "(_", "err_", "._", "errno_", ",_", "err_", "._", "strerror_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect", "\\u", "error_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handle", "\\u", "connect", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "read", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "a", " ", "read", " ", "event", " ", "raise", "d", " ", "on", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "enabled_", "and_", "not_", "self_", "._", "\\u", "ssl", "\\u", "handshake", "\\u", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "do", "\\u", "handshake", "_", "(_", ")_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "socket", "\\u", "recv_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read", "\\u", "error_", ",_", "err_", ")_", "\\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_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "recv", "\\u", "buffer_", "+=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", ">_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "process", "ing", " ", "the", " ", "buffer", " ", "to", " ", "reduce", " ", "its", " ", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "process", "\\u", "recv", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "buffer", "'", "s", " ", "still", " ", "too", " ", "long", ",", " ", "overflow", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", ">_", "self_", "._", "\\u", "recv", "\\u", "buffer", "\\u", "size", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "e_", "=_", "Stream", "Buffer", "Over", "flow_", "(_", "\"", "Buffer", " ", "length", " ", "exceed", "ed", " ", "upper", " ", "limit", " ", "on", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "overflow", "\\u", "error_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "process", "\\u", "recv", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "block", " ", "was", " ", "moved", " ", "out", " ", "of", " ", "the", " ", "above", " ", "loop", " ", "to", " ", "address", " ", "issue", " ", "#", "41.", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "write", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "a", " ", "write", " ", "event", " ", "raise", "d", " ", "on", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "enabled_", "and_", "not_", "self_", "._", "\\u", "ssl", "\\u", "handshake", "\\u", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "do", "\\u", "handshake", "_", "(_", ")_", "\\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_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handle", "\\u", "connect", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "send", "\\u", "buffer_", ":_", "\\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_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "error", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "an", " ", "error", " ", "event", " ", "raise", "d", " ", "on", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "connecti", "ng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tha", "t", "'", "s", " ", "no", " ", "moon", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handle", "\\u", "connect", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "Channel_", "._", "\\u", "handle", "\\u", "error", "\\u", "event_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "connect", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "a", " ", "connect", " ", "event", " ", "raise", "d", " ", "on", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "ng_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", ",_", "errst", "r_", "=_", "self_", "._", "\\u", "get", "\\u", "socket", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connected_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "call", "\\u", "on", "\\u", "connect_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", ")_", "\\u\\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", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect_", ")_", "\\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_", "#", " ", "...", " ", "it", "'", "s", " ", "a", " ", "space", " ", "station", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "Stream", "Connect", "Error_", "(_", "err_", ",_", "errst", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect", "\\u", "error_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\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", "process", "\\u", "recv", "\\u", "buffer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Process", " ", "the", " ", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".\\u", "recv", "\\u", "buffer", "`", ",", " ", "passi", "ng", "\\", "10", ";", " ", " ", " ", " ", "chunks", " ", "of", " ", "data", " ", "to", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "read", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delimiter_", "=_", "self_", "._", "read", "\\u", "delimiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delimiter_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "delimiter_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", "<_", "delimiter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", ":_", "delimiter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "delimiter_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "delimiter_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "._", "find_", "(_", "delimiter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mark_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", ":_", "mark_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "mark_", "+_", "len_", "(_", "delimiter_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "delimiter_", ",_", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", "<_", "delimiter_", "._", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", ":_", "delimiter_", "._", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "delimiter_", "._", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Safe", "ly", " ", "unpack", " ", "it", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "*", "probab", "ly", "*", " ", "neve", "r", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "delimiter_", "._", "unpack_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "struct_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "exception_", "(_", "\"", "Una", "ble", " ", "to", " ", "unpack", " ", "data", " ", "on", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unli", "ke", " ", "most", " ", "on", "\\u", "read", " ", "calls", ",", " ", "this", " ", "one", " ", "send", "s", " ", "every", " ", "variab", "le", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "parsed", " ", "data", " ", "as", " ", "its", " ", "own", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "*_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "delimiter_", ",_", "\\u", "Net", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "get", " ", "start", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", "=_", "delimiter_", "._", "iter", "\\u", "unpack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", "=_", "next_", "(_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", "<_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", ":_", "\\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_", "data_", "=_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", "._", "send_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", ":_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stil", "l", " ", "here", "?", " ", "The", "n", " ", "we", "'", "ve", " ", "got", " ", "our", " ", "object", ".", " ", "Delete", " ", "the", " ", "Net", "Struct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "state", " ", "and", " ", "send", " ", "the", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "nets", "truct", "\\u", "needed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "nets", "truct", "\\u", "iter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "*_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "delimiter_", ",_", "Rege", "x", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Depend", "ing", " ", "on", " ", "regex", "\\u", "search", ",", " ", "we", " ", "coul", "d", " ", "do", " ", "this", " ", "two", " ", "way", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "regex", "\\u", "search_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "delimiter_", "._", "search_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "match_", ":_", "\\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_", "data_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", ":_", "match_", "._", "start_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "match_", "._", "end_", "(_", ")_", ":_", "]_", "\\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_", "#", " ", "Requ", "ire", " ", "the", " ", "match", " ", "to", " ", "be", " ", "at", " ", "the", " ", "beginn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "delimiter_", "._", "match_", "(_", "self_", "._", "\\u", "recv", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\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_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "=_", "self_", "._", "\\u", "recv", "\\u", "buffer_", "[_", "data_", "._", "end_", "(_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "eit", "her", " ", "the", " ", "string", " ", "or", " ", "the", " ", "match", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "read_", ",_", "data_", ")_", "\\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", " ", "safe", "guard", "s", " ", "in", " ", "the", " ", "read", " ", "delimiter", " ", "property", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prevent", " ", "this", " ", "from", " ", "happ", "eni", "ng", " ", "unl", "ess", " ", "people", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "getti", "ng", " ", "too", " ", "craft", "y", " ", "for", " ", "thei", "r", " ", "own", " ", "good", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "Inva", "lid", "Read", "Delimite", "r", "Error_", "(_", "\"", "Inva", "lid", " ", "read", " ", "delimiter", " ", "on", " ", "%", "r", ".\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "error_", ",_", "err_", ")_", "\\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_", "if_", "self_", "._", "\\u", "closed_", "or_", "not_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "send", "\\u", "buffer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Process", " ", "the", " ", ":", "attr", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".\\u", "send", "\\u", "buffer", "`", ",", " ", "passi", "ng", "\\", "10", ";", " ", " ", " ", " ", "outgoing", " ", "data", " ", "to", " ", ":", "meth", ":`", "~", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "socket", "\\u", "send", "`", "\\", "10", ";", " ", " ", " ", " ", "or", " ", ":", "meth", ":`", "~", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "socket", "\\u", "send", "file", "`", " ", "and", " ", "calling", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "pant", "s", ".", "stream", ".", "Stream", ".", "on", "\\u", "write", "`", " ", "whe", "n", " ", "sendin", "g", " ", "has", " ", "finish", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "send", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", ",_", "data_", "=_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data\\u", "type_", "==_", "Stream_", "._", "SEND", "\\u", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "string_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data\\u", "type_", "==_", "Stream_", "._", "SEND", "\\u", "FILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "file_", "(_", "*_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data\\u", "type_", "==_", "Stream_", "._", "SEND", "\\u", "SS", "L", "\\u", "HAND", "SHA", "KE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "process", "\\u", "send", "\\u", "ssl", "\\u", "handshake", "_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bytes", "\\u", "sent_", "==_", "0_", ":_", "\\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_", "not_", "self_", "._", "\\u", "closed_", "and_", "not_", "self_", "._", "\\u", "send", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "closing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "send", "\\u", "string_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "data", " ", "from", " ", "a", " ", "string", " ", "to", " ", "the", " ", "remote", " ", "socket", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "socket", "\\u", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "write", "\\u", "error_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "data_", ")_", ">_", "bytes", "\\u", "sent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "insert_", "(_", "0_", ",_", "(_", "Stream_", "._", "SEND", "\\u", "STRING_", ",_", "data_", "[_", "bytes", "\\u", "sent_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "send", "\\u", "file_", "(_", "self_", ",_", "sfile_", ",_", "offset_", ",_", "nbytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "data", " ", "from", " ", "a", " ", "file", " ", "to", " ", "the", " ", "remote", " ", "socket", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "socket", "\\u", "send", "file_", "(_", "sfile_", ",_", "offset_", ",_", "nbytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "write", "\\u", "error_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "+=_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nbytes_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "nbytes_", "-_", "bytes", "\\u", "sent_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbytes_", "-=_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reach", "ed", " ", "the", " ", "end", " ", "of", " ", "the", " ", "segment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Thi", "s", " ", "is", " ", "aw", "ful", ".", " ", "Fin", "d", " ", "a", " ", "bett", "er", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "fsta", "t_", "(_", "sfile_", "._", "fileno_", "(_", ")_", ")_", "._", "st", "\\u", "size_", "-_", "offset_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reach", "ed", " ", "the", " ", "end", " ", "of", " ", "the", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "send", "\\u", "buffer_", "._", "insert_", "(_", "0_", ",_", "(_", "Stream_", "._", "SEND", "\\u", "FILE_", ",_", "(_", "sfile_", ",_", "offset_", ",_", "nbytes_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "send", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ",_", "ssl", "\\u", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Enable", " ", "SS", "L", " ", "and", " ", "begin", " ", "the", " ", "handshake", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "ssl", "\\u", "socket", "\\u", "wrapped_", ":_", "\\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", "socket_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "self_", "._", "\\u", "socket_", ",_", "**_", "ssl", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "ena", "blin", "g_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "ssl", "\\u", "error_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ssl", "\\u", "socket", "\\u", "wrapped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ssl", "\\u", "enabled_", "=_", "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 ", " _", "bytes", "\\u", "sent_", "=_", "self_", "._", "\\u", "ssl", "\\u", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unli", "ke", " ", "string", "s", " ", "and", " ", "files", ",", " ", "the", " ", "SS", "L", " ", "handshake", " ", "is", " ", "not", " ", "re", "-", "adde", "d", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "queue", ".", " ", "Thi", "s", " ", "is", " ", "bec", "aus", "e", " ", "the", " ", "stream", "'", "s", " ", "state", " ", "has", " ", "bee", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modifi", "ed", " ", "and", " ", "the", " ", "handshake", " ", "will", " ", "continue", " ", "unti", "l", " ", "it", "'", "s", " ", "complete", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "socket", "\\u", "recv_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Receive", " ", "data", " ", "from", " ", "the", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "string", " ", "of", " ", "data", " ", "read", " ", "from", " ", "the", " ", "socket", ".", " ", "The", " ", "data", " ", "is", " ", "Non", "e", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "socket", " ", "has", " ", "bee", "n", " ", "close", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Override", "s", " ", ":", "meth", ":`", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "socket", "\\u", "recv", "`", " ", "to", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", "SS", "L", "-", "specific", " ", "behaviour", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Channel_", "._", "\\u", "socket", "\\u", "recv_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "socket", "\\u", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "data", " ", "to", " ", "the", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "bytes", " ", "tha", "t", " ", "wer", "e", " ", "sent", " ", "to", " ", "the", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Override", "s", " ", ":", "meth", ":`", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "socket", "\\u", "send", "`", " ", "to", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", "SS", "L", "-", "specific", " ", "behaviour", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", "The", " ", "string", " ", "of", " ", "data", " ", "to", " ", "send", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "\\u", "sent_", "=_", "\\u", "Channel_", "._", "\\u", "socket", "\\u", "send_", "(_", "self_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SS", "LS", "ocket", ".", "send", "()", " ", "can", " ", "return", " ", "0", " ", "rat", "her", " ", "than", " ", "raise", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "it", " ", "need", "s", " ", "a", " ", "write", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "enabled_", "and_", "bytes", "\\u", "sent_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes", "\\u", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "socket", "\\u", "send", "file_", "(_", "self_", ",_", "sfile_", ",_", "offset_", ",_", "nbytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "data", " ", "from", " ", "a", " ", "file", " ", "to", " ", "a", " ", "remote", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "bytes", " ", "tha", "t", " ", "wer", "e", " ", "sent", " ", "to", " ", "the", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Override", "s", " ", ":", "meth", ":`", "pant", "s", ".\\u", "channel", ".\\u", "Chan", "nel", ".\\u", "socket", "\\u", "send", "file", "`", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", "SS", "L", "-", "specific", " ", "behaviour", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "sfi", "le", " ", " ", "The", " ", "file", " ", "to", " ", "send", ".", "\\", "10", ";", " ", " ", " ", " ", "offset", " ", "The", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "offset", " ", "writ", "ing", " ", "by", ".", "\\", "10", ";", " ", " ", " ", " ", "nb", "ytes", " ", "The", " ", "number", " ", "of", " ", "bytes", " ", "of", " ", "the", " ", "file", " ", "to", " ", "write", ".", " ", "If", " ", "0", ",", " ", "all", " ", "bytes", " ", "will", " ", "be", " ", "writt", "en", ".", "\\", "10", ";", " ", " ", " ", " ", "=========", " ", " ", "============", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "Channel_", "._", "\\u", "socket", "\\u", "send", "file_", "(_", "self_", ",_", "sfile_", ",_", "offset_", ",_", "nbytes_", ",_", "self_", "._", "ssl", "\\u", "enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stream_", "(_", "\\u", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ssl", "\\u", "do", "\\u", "handshake", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "an", " ", "async", "hronous", " ", "SS", "L", " ", "handshake", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "socket_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "start", "\\u", "wait", "ing", "\\u", "for", "\\u", "write", "\\u", "event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "in_", "(_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "EOF_", ",_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "ZERO", "\\u", "RETURN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "SSL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "ssl", "\\u", "handshake", "\\u", "error_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "in_", "(_", "errno_", "._", "ECO", "NN", "RESET_", ",_", "errno_", "._", "EPI", "PE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", "flush_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\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_", "._", "\\u", "ssl", "\\u", "handshake", "\\u", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "ssl", "\\u", "handshake", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "ssl", "\\u", "call", "\\u", "on", "\\u", "connect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "safe", "ly", "\\u", "call_", "(_", "self_", "._", "on", "\\u", "connect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Stream", "Buffer", "Over", "flow_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "whe", "n", " ", "a", " ", "stream", "'", "s", " ", "internal", " ", "buffer", " ", "has", " ", "exceed", "ed", " ", "its", " ", "maxim", "um", "\\", "10", ";", " ", " ", " ", " ", "allow", "ed", " ", "size", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Stream", "Connect", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "whe", "n", " ", "an", " ", "error", " ", "has", " ", "occur", "red", " ", "dur", "ing", " ", "an", " ", "atte", "mpt", " ", "to", " ", "connect", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "stream", " ", "to", " ", "a", " ", "remote", " ", "host", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Inva", "lid", "Read", "Delimite", "r", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "whe", "n", " ", "a", " ", "channel", " ", "trie", "s", " ", "to", " ", "process", " ", "inco", "ming", " ", "data", " ", "with", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "invalid", " ", "read", " ", "delimiter", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
MongoEngine/mongoengine/tests/document/class_methods.py
[ { "content": " def test_drop_collection(self):\n \"\"\"Ensure that the collection may be dropped from the database.\n \"\"\"\n collection_name = 'person'\n self.Person(name='Test').save()\n self.assertTrue(collection_name in self.db.collection_names())\n\n self.Person.drop_collection()\n self.assertFalse(collection_name in self.db.collection_names())", "metadata": "root.ClassMethodsTest.test_drop_collection", "header": "['class', 'ClassMethodsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_custom_collection_name_operations(self):\n \"\"\"Ensure that a collection with a specified name is used as expected.\n \"\"\"\n collection_name = 'personCollTest'\n\n class Person(Document):\n name = StringField()\n meta = {'collection': collection_name}\n\n Person(name=\"Test User\").save()\n self.assertTrue(collection_name in self.db.collection_names())\n\n user_obj = self.db[collection_name].find_one()\n self.assertEqual(user_obj['name'], \"Test User\")\n\n user_obj = Person.objects[0]\n self.assertEqual(user_obj.name, \"Test User\")\n\n Person.drop_collection()\n self.assertFalse(collection_name in self.db.collection_names())", "metadata": "root.ClassMethodsTest.test_custom_collection_name_operations", "header": "['class', 'ClassMethodsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 313 } ]
[ { "span": "self.assertTrue(collection_name in self.db.collection_names())", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 70 }, { "span": "self.assertFalse(collection_name in self.db.collection_names())", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 71 }, { "span": "self.assertTrue(collection_name in self.db.collection_names())", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 70 }, { "span": "self.assertFalse(collection_name in self.db.collection_names())", "start_line": 332, "start_column": 8, "end_line": 332, "end_column": 71 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Class", "Meth", "ods", "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", "drop", "\\u", "collection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "collection", " ", "may", " ", "be", " ", "dropped", " ", "from", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection", "\\u", "name_", "=_", "'", "person", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Person_", "(_", "name_", "=_", "'", "Test", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "collection", "\\u", "name_", "in_", "self_", "._", "db_", "._", "collection", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Person_", "._", "drop", "\\u", "collection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "collection", "\\u", "name_", "in_", "self_", "._", "db_", "._", "collection", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Class", "Meth", "ods", "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", "custom", "\\u", "collection", "\\u", "name", "\\u", "operations_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "tha", "t", " ", "a", " ", "collection", " ", "with", " ", "a", " ", "specified", " ", "name", " ", "is", " ", "used", " ", "as", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection", "\\u", "name_", "=_", "'", "person", "Coll", "Test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Person_", "(_", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "String", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "collection", "'_", ":_", "collection", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Person_", "(_", "name_", "=_", "\"", "Test", " ", "User", "\"_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "collection", "\\u", "name_", "in_", "self_", "._", "db_", "._", "collection", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "obj_", "=_", "self_", "._", "db_", "[_", "collection", "\\u", "name_", "]_", "._", "find", "\\u", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user", "\\u", "obj_", "[_", "'", "name", "'_", "]_", ",_", "\"", "Test", " ", "User", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "obj_", "=_", "Person_", "._", "objects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user", "\\u", "obj_", "._", "name_", ",_", "\"", "Test", " ", "User", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Person_", "._", "drop", "\\u", "collection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "collection", "\\u", "name_", "in_", "self_", "._", "db_", "._", "collection", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2 ]
Unused import
mrsmn/tweetuoso/tweetuoso/tests/tweet_commit.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__appname__ = 'tweet_commit.py'\n__version__ = \"0.1\"\n__author__ = \"c0ding\"\n__licence__ = \"Apache v2.0 License\"\n\nimport tweepy\nfrom git import Repo\nfrom config import keys\nfrom colorama import Fore, Style\n\n# Git repository path\ngit_path = 'repo_path'\n\n\n\n\nif __name__ == '__main__':\n\ttweet_commit()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def twitter_authorize():\n\t\"\"\" Function doc \"\"\"\n\tauth = tweepy.OAuthHandler(keys['consumer_key'], keys['consumer_secret'])\n\tauth.set_access_token(keys['access_token'], keys['access_secret'])\n\tapi = tweepy.API(auth)\n\treturn api", "metadata": "root.twitter_authorize", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def tweet_commit():\n\trepo = Repo(git_path)\n\tassert repo.bare == False\n\trepo.config_reader()\n\tlast_commit = repo.head.commit.message.strip(\"\\n\")\n\tapi = twitter_authorize()\n\ttweet = \"#Tweetuoso - The #Twitter Commandline client written in #Python updated: \" + last_commit + \" | http://is.gd/piWhzm\"\n\ttry:\n\t\tapi.update_status(tweet)\n\t\tprint \"Last commit tweeted successfully!\"\n\texcept tweepy.TweepError as error:\n\t\tprint(\"Error occured: \" + Fore.RED + \"%s\" % error + Fore.RESET)", "metadata": "root.tweet_commit", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "from colorama import Fore, Style", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "app", "name\\u\\u_", "=_", "'", "tweet", "\\u", "commit", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "0.", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "c0", "ding", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "licence", "\\u\\u_", "=_", "\"", "Ap", "ache", " ", "v2", ".0", " ", "License", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tweepy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git_", "import_", "Repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "config_", "import_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colorama_", "import_", "Fore_", ",_", "Style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Git", " ", "repos", "itor", "y", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "path_", "=_", "'", "repo", "\\u", "path", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tweet", "\\u", "commit_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "twit", "ter", "\\u", "authorize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", " ", "Function", " ", "doc", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "tweepy_", "._", "OA", "uth", "Handler_", "(_", "keys_", "[_", "'", "consume", "r", "\\u", "key", "'_", "]_", ",_", "keys_", "[_", "'", "consume", "r", "\\u", "secret", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "._", "set\\u", "access", "\\u", "token_", "(_", "keys_", "[_", "'", "access", "\\u", "token", "'_", "]_", ",_", "keys_", "[_", "'", "access", "\\u", "secret", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "=_", "tweepy_", "._", "API_", "(_", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "api_", "\\u\\u\\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_", "tweet", "\\u", "commit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "repo_", "=_", "Repo_", "(_", "git", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "repo_", "._", "bare", "_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "config", "\\u", "reader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "commit_", "=_", "repo_", "._", "head_", "._", "commit_", "._", "message_", "._", "strip_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "=_", "twit", "ter", "\\u", "authorize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tweet_", "=_", "\"#", "Tweet", "uo", "so", " ", "-", " ", "The", " ", "#", "Twit", "ter", " ", "Command", "line", " ", "client", " ", "writt", "en", " ", "in", " ", "#", "Pyth", "on", " ", "update", "d", ":", " ", "\"_", "+_", "last", "\\u", "commit_", "+_", "\"", " ", "|", " ", "http", "://", "is", ".", "gd", "/", "pi", "Wh", "zm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "api_", "._", "update", "\\u", "status_", "(_", "tweet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Las", "t", " ", "commit", " ", "tweet", "ed", " ", "success", "full", "y", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tweepy_", "._", "Twe", "ep", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "\"", "Error", " ", "occure", "d", ":", " ", "\"_", "+_", "Fore_", "._", "RED_", "+_", "\"%", "s", "\"_", "%_", "error_", "+_", "Fore_", "._", "RESET_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
AppScale/appscale/AppServer/lib/django-1.5/django/contrib/admin/templatetags/admin_list.py
[ { "content": "from __future__ import unicode_literals\n\nimport datetime\n\nfrom django.contrib.admin.util import (lookup_field, display_for_field,\n display_for_value, label_for_field)\nfrom django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,\n ORDER_VAR, PAGE_VAR, SEARCH_VAR)\nfrom django.contrib.admin.templatetags.admin_static import static\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db import models\nfrom django.utils import formats\nfrom django.utils.html import format_html\nfrom django.utils.safestring import mark_safe\nfrom django.utils import six\nfrom django.utils.text import capfirst\nfrom django.utils.translation import ugettext as _\nfrom django.utils.encoding import smart_text, force_text\nfrom django.template import Library\nfrom django.template.loader import get_template\nfrom django.template.context import Context\n\nregister = Library()\n\nDOT = '.'\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register.simple_tag\ndef paginator_number(cl,i):\n \"\"\"\n Generates an individual page index link in a paginated list.\n \"\"\"\n if i == DOT:\n return '... '\n elif i == cl.page_num:\n return format_html('<span class=\"this-page\">{0}</span> ', i+1)\n else:\n return format_html('<a href=\"{0}\"{1}>{2}</a> ',\n cl.get_query_string({PAGE_VAR: i}),\n mark_safe(' class=\"end\"' if i == cl.paginator.num_pages-1 else ''),\n i+1)", "metadata": "root.paginator_number", "header": "['module', '___EOS___']", "index": 26 }, { "content": "@register.inclusion_tag('admin/pagination.html')\ndef pagination(cl):\n \"\"\"\n Generates the series of links to the pages in a paginated list.\n \"\"\"\n paginator, page_num = cl.paginator, cl.page_num\n\n pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page\n if not pagination_required:\n page_range = []\n else:\n ON_EACH_SIDE = 3\n ON_ENDS = 2\n\n # If there are 10 or fewer pages, display links to every page.\n # Otherwise, do some fancy\n if paginator.num_pages <= 10:\n page_range = range(paginator.num_pages)\n else:\n # Insert \"smart\" pagination links, so that there are always ON_ENDS\n # links at either end of the list of pages, and there are always\n # ON_EACH_SIDE links at either end of the \"current page\" link.\n page_range = []\n if page_num > (ON_EACH_SIDE + ON_ENDS):\n page_range.extend(range(0, ON_EACH_SIDE - 1))\n page_range.append(DOT)\n page_range.extend(range(page_num - ON_EACH_SIDE, page_num + 1))\n else:\n page_range.extend(range(0, page_num + 1))\n if page_num < (paginator.num_pages - ON_EACH_SIDE - ON_ENDS - 1):\n page_range.extend(range(page_num + 1, page_num + ON_EACH_SIDE + 1))\n page_range.append(DOT)\n page_range.extend(range(paginator.num_pages - ON_ENDS, paginator.num_pages))\n else:\n page_range.extend(range(page_num + 1, paginator.num_pages))\n\n need_show_all_link = cl.can_show_all and not cl.show_all and cl.multi_page\n return {\n 'cl': cl,\n 'pagination_required': pagination_required,\n 'show_all_url': need_show_all_link and cl.get_query_string({ALL_VAR: ''}),\n 'page_range': page_range,\n 'ALL_VAR': ALL_VAR,\n '1': 1,\n }", "metadata": "root.pagination", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def result_headers(cl):\n \"\"\"\n Generates the list column headers.\n \"\"\"\n ordering_field_columns = cl.get_ordering_field_columns()\n for i, field_name in enumerate(cl.list_display):\n text, attr = label_for_field(field_name, cl.model,\n model_admin = cl.model_admin,\n return_attr = True\n )\n if attr:\n # Potentially not sortable\n\n # if the field is the action checkbox: no sorting and special class\n if field_name == 'action_checkbox':\n yield {\n \"text\": text,\n \"class_attrib\": mark_safe(' class=\"action-checkbox-column\"'),\n \"sortable\": False,\n }\n continue\n\n admin_order_field = getattr(attr, \"admin_order_field\", None)\n if not admin_order_field:\n # Not sortable\n yield {\n \"text\": text,\n \"sortable\": False,\n }\n continue\n\n # OK, it is sortable if we got this far\n th_classes = ['sortable']\n order_type = ''\n new_order_type = 'asc'\n sort_priority = 0\n sorted = False\n # Is it currently being sorted on?\n if i in ordering_field_columns:\n sorted = True\n order_type = ordering_field_columns.get(i).lower()\n sort_priority = list(ordering_field_columns).index(i) + 1\n th_classes.append('sorted %sending' % order_type)\n new_order_type = {'asc': 'desc', 'desc': 'asc'}[order_type]\n\n # build new ordering param\n o_list_primary = [] # URL for making this field the primary sort\n o_list_remove = [] # URL for removing this field from sort\n o_list_toggle = [] # URL for toggling order type for this field\n make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n)\n\n for j, ot in ordering_field_columns.items():\n if j == i: # Same column\n param = make_qs_param(new_order_type, j)\n # We want clicking on this header to bring the ordering to the\n # front\n o_list_primary.insert(0, param)\n o_list_toggle.append(param)\n # o_list_remove - omit\n else:\n param = make_qs_param(ot, j)\n o_list_primary.append(param)\n o_list_toggle.append(param)\n o_list_remove.append(param)\n\n if i not in ordering_field_columns:\n o_list_primary.insert(0, make_qs_param(new_order_type, i))\n\n\n yield {\n \"text\": text,\n \"sortable\": True,\n \"sorted\": sorted,\n \"ascending\": order_type == \"asc\",\n \"sort_priority\": sort_priority,\n \"url_primary\": cl.get_query_string({ORDER_VAR: '.'.join(o_list_primary)}),\n \"url_remove\": cl.get_query_string({ORDER_VAR: '.'.join(o_list_remove)}),\n \"url_toggle\": cl.get_query_string({ORDER_VAR: '.'.join(o_list_toggle)}),\n \"class_attrib\": format_html(' class=\"{0}\"', ' '.join(th_classes))\n if th_classes else '',\n }", "metadata": "root.result_headers", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def _boolean_icon(field_val):\n icon_url = static('admin/img/icon-%s.gif' %\n {True: 'yes', False: 'no', None: 'unknown'}[field_val])\n return format_html('<img src=\"{0}\" alt=\"{1}\" />', icon_url, field_val)", "metadata": "root._boolean_icon", "header": "['module', '___EOS___']", "index": 169 }, { "content": "def items_for_result(cl, result, form):\n \"\"\"\n Generates the actual list of data.\n \"\"\"\n first = True\n pk = cl.lookup_opts.pk.attname\n for field_name in cl.list_display:\n row_class = ''\n try:\n f, attr, value = lookup_field(field_name, result, cl.model_admin)\n except ObjectDoesNotExist:\n result_repr = EMPTY_CHANGELIST_VALUE\n else:\n if f is None:\n if field_name == 'action_checkbox':\n row_class = mark_safe(' class=\"action-checkbox\"')\n allow_tags = getattr(attr, 'allow_tags', False)\n boolean = getattr(attr, 'boolean', False)\n if boolean:\n allow_tags = True\n result_repr = display_for_value(value, boolean)\n # Strip HTML tags in the resulting text, except if the\n # function has an \"allow_tags\" attribute set to True.\n if allow_tags:\n result_repr = mark_safe(result_repr)\n if isinstance(value, (datetime.date, datetime.time)):\n row_class = mark_safe(' class=\"nowrap\"')\n else:\n if isinstance(f.rel, models.ManyToOneRel):\n field_val = getattr(result, f.name)\n if field_val is None:\n result_repr = EMPTY_CHANGELIST_VALUE\n else:\n result_repr = field_val\n else:\n result_repr = display_for_field(value, f)\n if isinstance(f, (models.DateField, models.TimeField, models.ForeignKey)):\n row_class = mark_safe(' class=\"nowrap\"')\n if force_text(result_repr) == '':\n result_repr = mark_safe('&nbsp;')\n # If list_display_links not defined, add the link tag to the first field\n if (first and not cl.list_display_links) or field_name in cl.list_display_links:\n table_tag = {True:'th', False:'td'}[first]\n first = False\n url = cl.url_for_result(result)\n # Convert the pk to something that can be used in Javascript.\n # Problem cases are long ints (23L) and non-ASCII strings.\n if cl.to_field:\n attr = str(cl.to_field)\n else:\n attr = pk\n value = result.serializable_value(attr)\n result_id = repr(force_text(value))[1:]\n yield format_html('<{0}{1}><a href=\"{2}\"{3}>{4}</a></{5}>',\n table_tag,\n row_class,\n url,\n format_html(' onclick=\"opener.dismissRelatedLookupPopup(window, {0}); return false;\"', result_id)\n if cl.is_popup else '',\n result_repr,\n table_tag)\n else:\n # By default the fields come from ModelAdmin.list_editable, but if we pull\n # the fields out of the form instead of list_editable custom admins\n # can provide fields on a per request basis\n if (form and field_name in form.fields and not (\n field_name == cl.model._meta.pk.name and\n form[cl.model._meta.pk.name].is_hidden)):\n bf = form[field_name]\n result_repr = mark_safe(force_text(bf.errors) + force_text(bf))\n yield format_html('<td{0}>{1}</td>', row_class, result_repr)\n if form and not form[cl.model._meta.pk.name].is_hidden:\n yield format_html('<td>{0}</td>', force_text(form[cl.model._meta.pk.name]))", "metadata": "root.items_for_result", "header": "['module', '___EOS___']", "index": 174 }, { "content": "class ResultList(list):\n # Wrapper class used to return items in a list_editable\n # changelist, annotated with the form object for error\n # reporting purposes. Needed to maintain backwards\n # compatibility with existing admin templates.", "metadata": "root.ResultList", "header": "['module', '___EOS___']", "index": 248 }, { "content": " def __init__(self, form, *items):\n self.form = form\n super(ResultList, self).__init__(*items)", "metadata": "root.ResultList.__init__", "header": "['class', 'ResultList', '(', 'list', ')', ':', '___NEWLINE___', '# Wrapper class used to return items in a list_editable', '___NL___', '# changelist, annotated with the form object for error', '___NL___', '# reporting purposes. Needed to maintain backwards', '___NL___', '# compatibility with existing admin templates.', '___NL___', '___EOS___']", "index": 253 }, { "content": "def results(cl):\n if cl.formset:\n for res, form in zip(cl.result_list, cl.formset.forms):\n yield ResultList(form, items_for_result(cl, res, form))\n else:\n for res in cl.result_list:\n yield ResultList(None, items_for_result(cl, res, None))", "metadata": "root.results", "header": "['module', '___EOS___']", "index": 257 }, { "content": "def result_hidden_fields(cl):\n if cl.formset:\n for res, form in zip(cl.result_list, cl.formset.forms):\n if form[cl.model._meta.pk.name].is_hidden:\n yield mark_safe(force_text(form[cl.model._meta.pk.name]))", "metadata": "root.result_hidden_fields", "header": "['module', '___EOS___']", "index": 265 }, { "content": "@register.inclusion_tag(\"admin/change_list_results.html\")\ndef result_list(cl):\n \"\"\"\n Displays the headers and data list together\n \"\"\"\n headers = list(result_headers(cl))\n num_sorted_fields = 0\n for h in headers:\n if h['sortable'] and h['sorted']:\n num_sorted_fields += 1\n return {'cl': cl,\n 'result_hidden_fields': list(result_hidden_fields(cl)),\n 'result_headers': headers,\n 'num_sorted_fields': num_sorted_fields,\n 'results': list(results(cl))}", "metadata": "root.result_list", "header": "['module', '___EOS___']", "index": 271 }, { "content": "@register.inclusion_tag('admin/date_hierarchy.html')\ndef date_hierarchy(cl):\n \"\"\"\n Displays the date hierarchy for date drill-down functionality.\n \"\"\"\n if cl.date_hierarchy:\n field_name = cl.date_hierarchy\n year_field = '%s__year' % field_name\n month_field = '%s__month' % field_name\n day_field = '%s__day' % field_name\n field_generic = '%s__' % field_name\n year_lookup = cl.params.get(year_field)\n month_lookup = cl.params.get(month_field)\n day_lookup = cl.params.get(day_field)\n\n link = lambda d: cl.get_query_string(d, [field_generic])\n\n if not (year_lookup or month_lookup or day_lookup):\n # select appropriate start level\n date_range = cl.query_set.aggregate(first=models.Min(field_name),\n last=models.Max(field_name))\n if date_range['first'] and date_range['last']:\n if date_range['first'].year == date_range['last'].year:\n year_lookup = date_range['first'].year\n if date_range['first'].month == date_range['last'].month:\n month_lookup = date_range['first'].month\n\n if year_lookup and month_lookup and day_lookup:\n day = datetime.date(int(year_lookup), int(month_lookup), int(day_lookup))\n return {\n 'show': True,\n 'back': {\n 'link': link({year_field: year_lookup, month_field: month_lookup}),\n 'title': capfirst(formats.date_format(day, 'YEAR_MONTH_FORMAT'))\n },\n 'choices': [{'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))}]\n }\n elif year_lookup and month_lookup:\n days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')\n return {\n 'show': True,\n 'back': {\n 'link': link({year_field: year_lookup}),\n 'title': str(year_lookup)\n },\n 'choices': [{\n 'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),\n 'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))\n } for day in days]\n }\n elif year_lookup:\n months = cl.query_set.filter(**{year_field: year_lookup}).dates(field_name, 'month')\n return {\n 'show' : True,\n 'back': {\n 'link' : link({}),\n 'title': _('All dates')\n },\n 'choices': [{\n 'link': link({year_field: year_lookup, month_field: month.month}),\n 'title': capfirst(formats.date_format(month, 'YEAR_MONTH_FORMAT'))\n } for month in months]\n }\n else:\n years = cl.query_set.dates(field_name, 'year')\n return {\n 'show': True,\n 'choices': [{\n 'link': link({year_field: str(year.year)}),\n 'title': str(year.year),\n } for year in years]\n }", "metadata": "root.date_hierarchy", "header": "['module', '___EOS___']", "index": 287 }, { "content": "@register.inclusion_tag('admin/search_form.html')\ndef search_form(cl):\n \"\"\"\n Displays a search form for searching the list.\n \"\"\"\n return {\n 'cl': cl,\n 'show_result_count': cl.result_count != cl.full_result_count,\n 'search_var': SEARCH_VAR\n }", "metadata": "root.search_form", "header": "['module', '___EOS___']", "index": 360 }, { "content": "@register.simple_tag\ndef admin_list_filter(cl, spec):\n tpl = get_template(spec.template)\n return tpl.render(Context({\n 'title': spec.title,\n 'choices' : list(spec.choices(cl)),\n 'spec': spec,\n }))", "metadata": "root.admin_list_filter", "header": "['module', '___EOS___']", "index": 371 }, { "content": "@register.inclusion_tag('admin/actions.html', takes_context=True)\ndef admin_actions(context):\n \"\"\"\n Track the number of times the action field has been rendered on the page,\n so we know which value to use.\n \"\"\"\n context['action_index'] = context.get('action_index', -1) + 1\n return context", "metadata": "root.admin_actions", "header": "['module', '___EOS___']", "index": 380 } ]
[ { "span": "from django.utils import six", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 28 }, { "span": "from django.utils.encoding import smart_text, force_text", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "util_", "import_", "(_", "look", "up", "\\u", "field_", ",_", "display", "\\u", "for", "\\u", "field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "for", "\\u", "value_", ",_", "label", "\\u", "for", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "views_", "._", "main_", "import_", "(_", "ALL", "\\u", "VAR_", ",_", "EMP", "TY", "\\u", "CHANGE", "LIST", "\\u", "VALUE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ORDE", "R", "\\u", "VAR_", ",_", "PAGE", "\\u", "VAR_", ",_", "SEARCH", "\\u", "VAR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "templatet", "ags_", "._", "admin", "\\u", "static_", "import_", "static_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "format\\u", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "text_", "import_", "cap", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "smart", "\\u", "text_", ",_", "force", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "get", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "context_", "import_", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DOT", "_", "=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "register_", "._", "simple", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pagina", "tor", "\\u", "number_", "(_", "cl_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "an", " ", "individual", " ", "page", " ", "index", " ", "link", " ", "in", " ", "a", " ", "paginated", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "DOT", "_", ":_", "\\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_", "elif_", "i_", "==_", "cl_", "._", "page", "\\u", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format\\u", "html_", "(_", "'<", "span", " ", "class", "=\"", "this", "-", "page", "\">", "{", "0", "}", "</", "span", ">", " ", "'_", ",_", "i_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format\\u", "html_", "(_", "'<", "a", " ", "href", "=\"", "{", "0", "}\"", "{", "1", "}>", "{", "2", "}", "</", "a", ">", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "{_", "PAGE", "\\u", "VAR_", ":_", "i_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mark", "\\u", "safe_", "(_", "'", " ", "class", "=\"", "end", "\"'_", "if_", "i_", "==_", "cl_", "._", "paginator_", "._", "num", "\\u", "pages_", "-_", "1_", "else_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "admin", "/", "pagina", "tion", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pagination_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "the", " ", "series", " ", "of", " ", "link", "s", " ", "to", " ", "the", " ", "page", "s", " ", "in", " ", "a", " ", "paginated", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginator_", ",_", "page", "\\u", "num_", "=_", "cl_", "._", "paginator_", ",_", "cl_", "._", "page", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pagina", "tion", "\\u", "required_", "=_", "(_", "not_", "cl_", "._", "show", "\\u", "all_", "or_", "not_", "cl_", "._", "can", "\\u", "show", "\\u", "all_", ")_", "and_", "cl_", "._", "multi", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pagina", "tion", "\\u", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ON", "\\u", "ENDS", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "10", " ", "or", " ", "few", "er", " ", "page", "s", ",", " ", "display", " ", "link", "s", " ", "to", " ", "every", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "do", " ", "some", " ", "fancy", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "paginator_", "._", "num", "\\u", "pages_", "<=_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "=_", "range_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Insert", " ", "\"", "smart", "\"", " ", "pagina", "tion", " ", "link", "s", ",", " ", "so", " ", "tha", "t", " ", "there", " ", "are", " ", "alw", "ay", "s", " ", "ON", "\\u", "ENDS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "link", "s", " ", "at", " ", "eit", "her", " ", "end", " ", "of", " ", "the", " ", "list", " ", "of", " ", "page", "s", ",", " ", "and", " ", "there", " ", "are", " ", "alw", "ays_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ON", "\\u", "EAC", "H", "\\u", "SIDE", " ", "link", "s", " ", "at", " ", "eit", "her", " ", "end", " ", "of", " ", "the", " ", "\"", "current", " ", "page", "\"", " ", "link", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "page", "\\u", "num_", ">_", "(_", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", "+_", "ON", "\\u", "ENDS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "0_", ",_", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "range_", "._", "append_", "(_", "DOT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "page", "\\u", "num_", "-_", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", ",_", "page", "\\u", "num_", "+_", "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 ", " _", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "0_", ",_", "page", "\\u", "num_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "page", "\\u", "num_", "<_", "(_", "paginator_", "._", "num", "\\u", "pages_", "-_", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", "-_", "ON", "\\u", "ENDS", "_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "page", "\\u", "num_", "+_", "1_", ",_", "page", "\\u", "num_", "+_", "ON", "\\u", "EAC", "H", "\\u", "SIDE", "_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "range_", "._", "append_", "(_", "DOT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "paginator_", "._", "num", "\\u", "pages_", "-_", "ON", "\\u", "ENDS", "_", ",_", "paginator_", "._", "num", "\\u", "pages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "range_", "._", "extend_", "(_", "range_", "(_", "page", "\\u", "num_", "+_", "1_", ",_", "paginator_", "._", "num", "\\u", "pages_", ")_", ")_", "\\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_", "need", "\\u", "show", "\\u", "all", "\\u", "link_", "=_", "cl_", "._", "can", "\\u", "show", "\\u", "all_", "and_", "not_", "cl_", "._", "show", "\\u", "all_", "and_", "cl_", "._", "multi", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cl", "'_", ":_", "cl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pagina", "tion", "\\u", "require", "d", "'_", ":_", "pagina", "tion", "\\u", "required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "all", "\\u", "url", "'_", ":_", "need", "\\u", "show", "\\u", "all", "\\u", "link_", "and_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "{_", "ALL", "\\u", "VAR_", ":_", "''_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "\\u", "range", "'_", ":_", "page", "\\u", "range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALL", "\\u", "VAR", "'_", ":_", "ALL", "\\u", "VAR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "1", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "result", "\\u", "headers_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "the", " ", "list", " ", "column", " ", "header", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orderi", "ng", "\\u", "field", "\\u", "columns_", "=_", "cl_", "._", "get", "\\u", "orderi", "ng", "\\u", "field", "\\u", "columns_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "field", "\\u", "name_", "in_", "enumerate_", "(_", "cl_", "._", "list", "\\u", "display_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", ",_", "attr_", "=_", "label", "\\u", "for", "\\u", "field_", "(_", "field", "\\u", "name_", ",_", "cl_", "._", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "admin_", "=_", "cl_", "._", "model", "\\u", "admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "attr_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pot", "ential", "ly", " ", "not", " ", "sortable", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "field", " ", "is", " ", "the", " ", "action", " ", "checkb", "ox", ":", " ", "no", " ", "sorting", " ", "and", " ", "special", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field", "\\u", "name_", "==_", "'", "action", "\\u", "checkb", "ox", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "class", "\\u", "attrib", "\"_", ":_", "mark", "\\u", "safe_", "(_", "'", " ", "class", "=\"", "action", "-", "checkb", "ox", "-", "column", "\"'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sortable", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "admin", "\\u", "order", "\\u", "field_", "=_", "getattr_", "(_", "attr_", ",_", "\"", "admin", "\\u", "order", "\\u", "field", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "admin", "\\u", "order", "\\u", "field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "sortable", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sortable", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OK", ",", " ", "it", " ", "is", " ", "sortable", " ", "if", " ", "we", " ", "got", " ", "this", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "th", "\\u", "classes_", "=_", "[_", "'", "sortable", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "type_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "order", "\\u", "type_", "=_", "'", "asc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "priority_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sorted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Is", " ", "it", " ", "currentl", "y", " ", "bei", "ng", " ", "sorte", "d", " ", "on", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "in_", "orderi", "ng", "\\u", "field", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "type_", "=_", "orderi", "ng", "\\u", "field", "\\u", "columns_", "._", "get_", "(_", "i_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "priority_", "=_", "list_", "(_", "orderi", "ng", "\\u", "field", "\\u", "columns_", ")_", "._", "index_", "(_", "i_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th", "\\u", "classes_", "._", "append_", "(_", "'", "sorte", "d", " ", "%", "sendin", "g", "'_", "%_", "order", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "order", "\\u", "type_", "=_", "{_", "'", "asc", "'_", ":_", "'", "desc", "'_", ",_", "'", "desc", "'_", ":_", "'", "asc", "'_", "}_", "[_", "order", "\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "new", " ", "orderi", "ng", " ", "param_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "o", "\\u", "list", "\\u", "primary_", "=_", "[_", "]_", "#", " ", "URL", " ", "for", " ", "mak", "ing", " ", "this", " ", "field", " ", "the", " ", "primary", " ", "sort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "remove_", "=_", "[_", "]_", "#", " ", "URL", " ", "for", " ", "remo", "ving", " ", "this", " ", "field", " ", "from", " ", "sort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "toggle_", "=_", "[_", "]_", "#", " ", "URL", " ", "for", " ", "tog", "glin", "g", " ", "order", " ", "type", " ", "for", " ", "this", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "qs", "\\u", "param_", "=_", "lambda_", "t_", ",_", "n_", ":_", "(_", "'-'_", "if_", "t_", "==_", "'", "desc", "'_", "else_", "''_", ")_", "+_", "str_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", ",_", "ot_", "in_", "orderi", "ng", "\\u", "field", "\\u", "columns_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "==_", "i_", ":_", "#", " ", "Sam", "e", " ", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "make", "\\u", "qs", "\\u", "param_", "(_", "new", "\\u", "order", "\\u", "type_", ",_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "click", "ing", " ", "on", " ", "this", " ", "header", " ", "to", " ", "bring", " ", "the", " ", "orderi", "ng", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "front_", "\\u\\u\\uNL\\u\\u\\u_", "o", "\\u", "list", "\\u", "primary_", "._", "insert_", "(_", "0_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "toggle_", "._", "append_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "o", "\\u", "list", "\\u", "remove", " ", "-", " ", "omit", "_", "\\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 ", " _", "param_", "=_", "make", "\\u", "qs", "\\u", "param_", "(_", "ot_", ",_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "primary_", "._", "append_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "toggle_", "._", "append_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "list", "\\u", "remove_", "._", "append_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "not_", "in_", "orderi", "ng", "\\u", "field", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o", "\\u", "list", "\\u", "primary_", "._", "insert_", "(_", "0_", ",_", "make", "\\u", "qs", "\\u", "param_", "(_", "new", "\\u", "order", "\\u", "type_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sortable", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sorte", "d", "\"_", ":_", "sorted_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ascen", "ding", "\"_", ":_", "order", "\\u", "type_", "==_", "\"", "asc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sort", "\\u", "priorit", "y", "\"_", ":_", "sort", "\\u", "priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\\u", "primary", "\"_", ":_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "{_", "ORDE", "R", "\\u", "VAR_", ":_", "'.'_", "._", "join_", "(_", "o", "\\u", "list", "\\u", "primary_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\\u", "remove", "\"_", ":_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "{_", "ORDE", "R", "\\u", "VAR_", ":_", "'.'_", "._", "join_", "(_", "o", "\\u", "list", "\\u", "remove_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\\u", "toggle", "\"_", ":_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "{_", "ORDE", "R", "\\u", "VAR_", ":_", "'.'_", "._", "join_", "(_", "o", "\\u", "list", "\\u", "toggle_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "class", "\\u", "attrib", "\"_", ":_", "format\\u", "html_", "(_", "'", " ", "class", "=\"", "{", "0", "}\"'_", ",_", "'", " ", "'_", "._", "join_", "(_", "th", "\\u", "classes_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "th", "\\u", "classes_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "boolean", "\\u", "icon_", "(_", "field", "\\u", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "url_", "=_", "static_", "(_", "'", "admin", "/", "img", "/", "icon", "-%", "s", ".", "gif", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "True_", ":_", "'", "ye", "s", "'_", ",_", "False_", ":_", "'", "no", "'_", ",_", "None_", ":_", "'", "unknown", "'_", "}_", "[_", "field", "\\u", "val_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "html_", "(_", "'<", "img", " ", "src", "=\"", "{", "0", "}\"", " ", "alt", "=\"", "{", "1", "}\"", " ", "/>'_", ",_", "icon", "\\u", "url_", ",_", "field", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items", "\\u", "for", "\\u", "result_", "(_", "cl_", ",_", "result_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "the", " ", "actual", " ", "list", " ", "of", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "cl_", "._", "look", "up", "\\u", "opts_", "._", "pk_", "._", "attn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field", "\\u", "name_", "in_", "cl_", "._", "list", "\\u", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "\\u", "class_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", ",_", "attr_", ",_", "value_", "=_", "look", "up", "\\u", "field_", "(_", "field", "\\u", "name_", ",_", "result_", ",_", "cl_", "._", "model", "\\u", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "repr_", "=_", "EMP", "TY", "\\u", "CHANGE", "LIST", "\\u", "VALUE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field", "\\u", "name_", "==_", "'", "action", "\\u", "checkb", "ox", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row", "\\u", "class_", "=_", "mark", "\\u", "safe_", "(_", "'", " ", "class", "=\"", "action", "-", "checkb", "ox", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "allow", "\\u", "tags_", "=_", "getattr_", "(_", "attr_", ",_", "'", "allow", "\\u", "tags", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boolean_", "=_", "getattr_", "(_", "attr_", ",_", "'", "boolean", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "boolean_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "repr_", "=_", "display", "\\u", "for", "\\u", "value_", "(_", "value_", ",_", "boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "HTM", "L", " ", "tags", " ", "in", " ", "the", " ", "result", "ing", " ", "text", ",", " ", "except", " ", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "has", " ", "an", " ", "\"", "allow", "\\u", "tags", "\"", " ", "attribute", " ", "set", " ", "to", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "allow", "\\u", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result", "\\u", "repr_", "=_", "mark", "\\u", "safe_", "(_", "result", "\\u", "repr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "datetime_", "._", "date_", ",_", "datetime_", "._", "time_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row", "\\u", "class_", "=_", "mark", "\\u", "safe_", "(_", "'", " ", "class", "=\"", "now", "rap", "\"'_", ")_", "\\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_", "isinstance_", "(_", "f_", "._", "rel_", ",_", "models_", "._", "Many", "To", "One", "Rel", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "val_", "=_", "getattr_", "(_", "result_", ",_", "f_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "val_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result", "\\u", "repr_", "=_", "EMP", "TY", "\\u", "CHANGE", "LIST", "\\u", "VALUE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result", "\\u", "repr_", "=_", "field", "\\u", "val_", "\\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 ", " ", "_", "result", "\\u", "repr_", "=_", "display", "\\u", "for", "\\u", "field_", "(_", "value_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "f_", ",_", "(_", "models_", "._", "Date", "Field_", ",_", "models_", "._", "Time", "Field_", ",_", "models_", "._", "Fore", "ign", "Key_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row", "\\u", "class_", "=_", "mark", "\\u", "safe_", "(_", "'", " ", "class", "=\"", "now", "rap", "\"'_", ")_", "\\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_", "force", "\\u", "text_", "(_", "result", "\\u", "repr_", ")_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "repr_", "=_", "mark", "\\u", "safe_", "(_", "'&", "nb", "sp", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "list", "\\u", "display", "\\u", "link", "s", " ", "not", " ", "defin", "ed", ",", " ", "add", " ", "the", " ", "link", " ", "tag", " ", "to", " ", "the", " ", "first", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "first_", "and_", "not_", "cl_", "._", "list", "\\u", "display", "\\u", "links_", ")_", "or_", "field", "\\u", "name_", "in_", "cl_", "._", "list", "\\u", "display", "\\u", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "tag_", "=_", "{_", "True_", ":_", "'", "th", "'_", ",_", "False_", ":_", "'", "td", "'_", "}_", "[_", "first_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "cl_", "._", "url", "\\u", "for", "\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "the", " ", "pk", " ", "to", " ", "somet", "hing", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "in", " ", "Javascript", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prob", "lem", " ", "case", "s", " ", "are", " ", "long", " ", "ints", " ", "(", "23", "L", ")", " ", "and", " ", "non", "-", "ASCII", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cl_", "._", "to", "\\u", "field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr_", "=_", "str_", "(_", "cl_", "._", "to", "\\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 ", " _", "attr_", "=_", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "result_", "._", "serializable", "\\u", "value_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "id_", "=_", "repr_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "format\\u", "html_", "(_", "'<", "{", "0", "}{", "1", "}>", "<", "a", " ", "href", "=\"", "{", "2", "}\"", "{", "3", "}>", "{", "4", "}", "</", "a", "><", "/{", "5", "}>", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format\\u", "html_", "(_", "'", " ", "onc", "lick", "=\"", "opene", "r", ".", "dismiss", "Rela", "ted", "Look", "up", "Pop", "up", "(", "window", ",", " ", "{", "0", "})", ";", " ", "return", " ", "fal", "se", ";", "\"'_", ",_", "result", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cl_", "._", "is", "\\u", "popup_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "repr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "By", " ", "default", " ", "the", " ", "fields", " ", "come", " ", "from", " ", "Model", "Admi", "n", ".", "list", "\\u", "edita", "ble", ",", " ", "but", " ", "if", " ", "we", " ", "pull_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "fields", " ", "out", " ", "of", " ", "the", " ", "form", " ", "inst", "ead", " ", "of", " ", "list", "\\u", "edita", "ble", " ", "custom", " ", "admins_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "provide", " ", "fields", " ", "on", " ", "a", " ", "per", " ", "request", " ", "basis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "form_", "and_", "field", "\\u", "name_", "in_", "form_", "._", "fields_", "and_", "not_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "name_", "==_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "[_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", "]_", "._", "is", "\\u", "hidden_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bf_", "=_", "form_", "[_", "field", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "repr_", "=_", "mark", "\\u", "safe_", "(_", "force", "\\u", "text_", "(_", "bf_", "._", "errors_", ")_", "+_", "force", "\\u", "text_", "(_", "bf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "format\\u", "html_", "(_", "'<", "td", "{", "0", "}>", "{", "1", "}", "</", "td", ">'_", ",_", "row", "\\u", "class_", ",_", "result", "\\u", "repr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form_", "and_", "not_", "form_", "[_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", "]_", "._", "is", "\\u", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "format\\u", "html_", "(_", "'<", "td", ">", "{", "0", "}", "</", "td", ">'_", ",_", "force", "\\u", "text_", "(_", "form_", "[_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Result", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wrapper", " ", "class", " ", "used", " ", "to", " ", "return", " ", "items", " ", "in", " ", "a", " ", "list", "\\u", "editable_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "changeli", "st", ",", " ", "annotated", " ", "with", " ", "the", " ", "form", " ", "object", " ", "for", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reporting", " ", "purpose", "s", ".", " ", "Needed", " ", "to", " ", "maintain", " ", "backwards_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", " ", "with", " ", "exist", "ing", " ", "admin", " ", "template", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Result", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wrapper", " ", "class", " ", "used", " ", "to", " ", "return", " ", "items", " ", "in", " ", "a", " ", "list", "\\u", "editable_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "changeli", "st", ",", " ", "annotated", " ", "with", " ", "the", " ", "form", " ", "object", " ", "for", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reporting", " ", "purpose", "s", ".", " ", "Needed", " ", "to", " ", "maintain", " ", "backwards_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", " ", "with", " ", "exist", "ing", " ", "admin", " ", "template", "s", "._", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "form_", ",_", "*_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "form_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Result", "List_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "results_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cl_", "._", "formset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "res_", ",_", "form_", "in_", "zip_", "(_", "cl_", "._", "result", "\\u", "list_", ",_", "cl_", "._", "formset_", "._", "forms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Result", "List_", "(_", "form_", ",_", "items", "\\u", "for", "\\u", "result_", "(_", "cl_", ",_", "res_", ",_", "form_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "res_", "in_", "cl_", "._", "result", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Result", "List_", "(_", "None_", ",_", "items", "\\u", "for", "\\u", "result_", "(_", "cl_", ",_", "res_", ",_", "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_", "result", "\\u", "hidden", "\\u", "fields_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cl_", "._", "formset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "res_", ",_", "form_", "in_", "zip_", "(_", "cl_", "._", "result", "\\u", "list_", ",_", "cl_", "._", "formset_", "._", "forms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form_", "[_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", "]_", "._", "is", "\\u", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "mark", "\\u", "safe_", "(_", "force", "\\u", "text_", "(_", "form_", "[_", "cl_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "\"", "admin", "/", "change", "\\u", "list", "\\u", "results", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "result", "\\u", "list_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", "s", " ", "the", " ", "header", "s", " ", "and", " ", "data", " ", "list", " ", "tog", "ether", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "list_", "(_", "result", "\\u", "headers_", "(_", "cl_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "sorte", "d\\u", "fields_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "h_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "h_", "[_", "'", "sortable", "'_", "]_", "and_", "h_", "[_", "'", "sorte", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "sorte", "d\\u", "fields_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "cl", "'_", ":_", "cl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "\\u", "hidden", "\\u", "fields", "'_", ":_", "list_", "(_", "result", "\\u", "hidden", "\\u", "fields_", "(_", "cl_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "\\u", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "sorte", "d\\u", "fields", "'_", ":_", "num", "\\u", "sorte", "d\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "results", "'_", ":_", "list_", "(_", "results_", "(_", "cl_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "admin", "/", "date", "\\u", "hier", "arch", "y", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "date", "\\u", "hierarchy_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", "s", " ", "the", " ", "date", " ", "hier", "arch", "y", " ", "for", " ", "date", " ", "drill", "-", "down", " ", "functional", "it", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cl_", "._", "date", "\\u", "hierarchy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "name_", "=_", "cl_", "._", "date", "\\u", "hierarchy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year", "\\u", "field_", "=_", "'%", "s", "\\u\\u", "year", "'_", "%_", "field", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "\\u", "field_", "=_", "'%", "s", "\\u\\u", "month", "'_", "%_", "field", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "\\u", "field_", "=_", "'%", "s", "\\u\\u", "day", "'_", "%_", "field", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "generic_", "=_", "'%", "s", "\\u\\u'_", "%_", "field", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year", "\\u", "lookup_", "=_", "cl_", "._", "params_", "._", "get_", "(_", "year", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "\\u", "lookup_", "=_", "cl_", "._", "params_", "._", "get_", "(_", "month", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "\\u", "lookup_", "=_", "cl_", "._", "params_", "._", "get_", "(_", "day", "\\u", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "lambda_", "d_", ":_", "cl_", "._", "get", "\\u", "query", "\\u", "string_", "(_", "d_", ",_", "[_", "field", "\\u", "generic_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "year", "\\u", "lookup_", "or_", "month", "\\u", "lookup_", "or_", "day", "\\u", "lookup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "select", " ", "appropr", "iate", " ", "start", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "date", "\\u", "range_", "=_", "cl_", "._", "query", "\\u", "set_", "._", "aggregate_", "(_", "first_", "=_", "models_", "._", "Min_", "(_", "field", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "last_", "=_", "models_", "._", "Max_", "(_", "field", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "date", "\\u", "range_", "[_", "'", "first", "'_", "]_", "and_", "date", "\\u", "range_", "[_", "'", "last", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "date", "\\u", "range_", "[_", "'", "first", "'_", "]_", "._", "year_", "==_", "date", "\\u", "range_", "[_", "'", "last", "'_", "]_", "._", "year_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "year", "\\u", "lookup_", "=_", "date", "\\u", "range_", "[_", "'", "first", "'_", "]_", "._", "year_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "date", "\\u", "range_", "[_", "'", "first", "'_", "]_", "._", "month_", "==_", "date", "\\u", "range_", "[_", "'", "last", "'_", "]_", "._", "month_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "month", "\\u", "lookup_", "=_", "date", "\\u", "range_", "[_", "'", "first", "'_", "]_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "year", "\\u", "lookup_", "and_", "month", "\\u", "lookup_", "and_", "day", "\\u", "lookup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "day_", "=_", "datetime_", "._", "date_", "(_", "int_", "(_", "year", "\\u", "lookup_", ")_", ",_", "int_", "(_", "month", "\\u", "lookup_", ")_", ",_", "int_", "(_", "day", "\\u", "lookup_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", ",_", "month", "\\u", "field_", ":_", "month", "\\u", "lookup_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "cap", "first_", "(_", "formats_", "._", "date", "\\u", "format_", "(_", "day_", ",_", "'", "YEA", "R", "\\u", "MONTH", "\\u", "FORMAT", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "s", "'_", ":_", "[_", "{_", "'", "title", "'_", ":_", "cap", "first_", "(_", "formats_", "._", "date", "\\u", "format_", "(_", "day_", ",_", "'", "MONTH", "\\u", "DAY", "\\u", "FORMAT", "'_", ")_", ")_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "year", "\\u", "lookup_", "and_", "month", "\\u", "lookup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "days_", "=_", "cl_", "._", "query", "\\u", "set_", "._", "filter_", "(_", "**_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", ",_", "month", "\\u", "field_", ":_", "month", "\\u", "lookup_", "}_", ")_", "._", "dates_", "(_", "field", "\\u", "name_", ",_", "'", "day", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "str_", "(_", "year", "\\u", "lookup_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "s", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", ",_", "month", "\\u", "field_", ":_", "month", "\\u", "lookup_", ",_", "day", "\\u", "field_", ":_", "day_", "._", "day_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "cap", "first_", "(_", "formats_", "._", "date", "\\u", "format_", "(_", "day_", ",_", "'", "MONTH", "\\u", "DAY", "\\u", "FORMAT", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "for_", "day_", "in_", "days_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "year", "\\u", "lookup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "months_", "=_", "cl_", "._", "query", "\\u", "set_", "._", "filter_", "(_", "**_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", "}_", ")_", "._", "dates_", "(_", "field", "\\u", "name_", ",_", "'", "month", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "\\u_", "(_", "'", "All", " ", "dates", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "s", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "year", "\\u", "field_", ":_", "year", "\\u", "lookup_", ",_", "month", "\\u", "field_", ":_", "month_", "._", "month_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "cap", "first_", "(_", "formats_", "._", "date", "\\u", "format_", "(_", "month_", ",_", "'", "YEA", "R", "\\u", "MONTH", "\\u", "FORMAT", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "for_", "month_", "in_", "months_", "]_", "\\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 ", " _", "years_", "=_", "cl_", "._", "query", "\\u", "set_", "._", "dates_", "(_", "field", "\\u", "name_", ",_", "'", "year", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "s", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "link_", "(_", "{_", "year", "\\u", "field_", ":_", "str_", "(_", "year_", "._", "year_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "str_", "(_", "year_", "._", "year_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "for_", "year_", "in_", "years_", "]_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "admin", "/", "search", "\\u", "form", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "search", "\\u", "form_", "(_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", "s", " ", "a", " ", "search", " ", "form", " ", "for", " ", "search", "ing", " ", "the", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cl", "'_", ":_", "cl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "\\u", "result", "\\u", "count", "'_", ":_", "cl_", "._", "result", "\\u", "count_", "!=_", "cl_", "._", "full", "\\u", "result", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "search", "\\u", "var", "'_", ":_", "SEARCH", "\\u", "VAR_", "\\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_", "@_", "register_", "._", "simple", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "admin", "\\u", "list", "\\u", "filter_", "(_", "cl_", ",_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tpl_", "=_", "get", "\\u", "template_", "(_", "spec_", "._", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tpl_", "._", "render_", "(_", "Context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "spec_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "choice", "s", "'_", ":_", "list_", "(_", "spec_", "._", "choices_", "(_", "cl_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spec", "'_", ":_", "spec_", ",_", "\\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_", "@_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "admin", "/", "action", "s", ".", "html", "'_", ",_", "take", "s", "\\u", "context_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "admin", "\\u", "actions_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Track", " ", "the", " ", "number", " ", "of", " ", "times", " ", "the", " ", "action", " ", "field", " ", "has", " ", "bee", "n", " ", "render", "ed", " ", "on", " ", "the", " ", "page", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "we", " ", "know", " ", "whi", "ch", " ", "value", " ", "to", " ", "use", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "action", "\\u", "index", "'_", "]_", "=_", "context_", "._", "get_", "(_", "'", "action", "\\u", "index", "'_", ",_", "-_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
statsmodels/statsmodels/statsmodels/stats/multivariate_tools.py
[ { "content": "def cc_stats(x1, x2, demean=True):\n '''MANOVA statistics based on canonical correlation coefficient\n\n Calculates Pillai's Trace, Wilk's Lambda, Hotelling's Trace and\n Roy's Largest Root.\n\n Parameters\n ----------\n x1, x2 : ndarrays, 2_D\n two 2-dimensional data arrays, observations in rows, variables in columns\n demean : bool\n If demean is true, then the mean is subtracted from each variable.\n\n Returns\n -------\n res : dict\n Dictionary containing the test statistics.\n\n Notes\n -----\n\n same as `canon` in Stata\n\n missing: F-statistics and p-values\n\n TODO: should return a results class instead\n produces nans sometimes, singular, perfect correlation of x1, x2 ?\n\n '''\n\n nobs1, k1 = x1.shape # endogenous ?\n nobs2, k2 = x2.shape\n cc = cancorr(x1, x2, demean=demean)\n cc2 = cc**2\n lam = (cc2 / (1 - cc2)) # what if max cc2 is 1 ?\n # Problem: ccr might not care if x1 or x2 are reduced rank,\n # but df will depend on rank\n df_model = k1 * k2 # df_hypothesis (we do not include mean in x1, x2)\n df_resid = k1 * (nobs1 - k2 - demean)\n s = min(df_model, k1)\n m = 0.5 * (df_model - k1)\n n = 0.5 * (df_resid - k1 - 1)\n\n df1 = k1 * df_model\n df2 = k2\n\n\n pt_value = cc2.sum() # Pillai's trace\n wl_value = np.product(1 / (1 + lam)) # Wilk's Lambda\n ht_value = lam.sum() # Hotelling's Trace\n rm_value = lam.max() # Roy's largest root\n #from scipy import stats\n # what's the distribution, the test statistic ?\n res = {}\n res['canonical correlation coefficient'] = cc\n res['eigenvalues'] = lam\n res[\"Pillai's Trace\"] = pt_value\n res[\"Wilk's Lambda\"] = wl_value\n res[\"Hotelling's Trace\"] = ht_value\n res[\"Roy's Largest Root\"] = rm_value\n res['df_resid'] = df_resid\n res['df_m'] = m\n return res", "metadata": "root.cc_stats", "header": "['module', '___EOS___']", "index": 188 } ]
[ { "span": "s ", "start_line": 227, "start_column": 4, "end_line": 227, "end_column": 5 }, { "span": "n ", "start_line": 229, "start_column": 4, "end_line": 229, "end_column": 5 }, { "span": "df1 ", "start_line": 231, "start_column": 4, "end_line": 231, "end_column": 7 }, { "span": "df2 ", "start_line": 232, "start_column": 4, "end_line": 232, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cc", "\\u", "stats_", "(_", "x1_", ",_", "x2_", ",_", "dem", "ean_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "MAN", "OV", "A", " ", "statistic", "s", " ", "based", " ", "on", " ", "canonical", " ", "correlation", " ", "coefficient", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "es", " ", "Pil", "lai", "'", "s", " ", "Trace", ",", " ", "Wil", "k", "'", "s", " ", "Lam", "bda", ",", " ", "Hot", "elli", "ng", "'", "s", " ", "Trace", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "Ro", "y", "'", "s", " ", "Large", "st", " ", "Roo", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x1", ",", " ", "x2", " ", ":", " ", "ndar", "rays", ",", " ", "2", "\\u", "D", "\\", "10", ";", " ", " ", " ", " ", "two", " ", "2", "-", "dimension", "al", " ", "data", " ", "arrays", ",", " ", "observa", "tion", "s", " ", "in", " ", "rows", ",", " ", "variab", "les", " ", "in", " ", "column", "s", "\\", "10", ";", " ", " ", " ", " ", "dem", "ean", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", " ", "If", " ", "dem", "ean", " ", "is", " ", "true", ",", " ", "then", " ", "the", " ", "mean", " ", "is", " ", "subtract", "ed", " ", "from", " ", "each", " ", "variab", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "res", " ", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "Dict", "ionar", "y", " ", "contain", "ing", " ", "the", " ", "test", " ", "statistic", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "as", " ", "`", "canon", "`", " ", "in", " ", "Stat", "a", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "missi", "ng", ":", " ", "F", "-", "statistic", "s", " ", "and", " ", "p", "-", "values", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "TOD", "O", ":", " ", "shou", "ld", " ", "return", " ", "a", " ", "results", " ", "class", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "produce", "s", " ", "nans", " ", "somet", "imes", ",", " ", "singular", ",", " ", "perfect", " ", "correlation", " ", "of", " ", "x1", ",", " ", "x2", " ", "?", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nob", "s1_", ",_", "k1_", "=_", "x1_", "._", "shape_", "#", " ", "endo", "geno", "us", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "s2_", ",_", "k2_", "=_", "x2_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "can", "corr_", "(_", "x1_", ",_", "x2_", ",_", "dem", "ean_", "=_", "dem", "ean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "2_", "=_", "cc_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lam_", "=_", "(_", "cc", "2_", "/_", "(_", "1_", "-_", "cc", "2_", ")_", ")_", "#", " ", "what", " ", "if", " ", "max", " ", "cc", "2", " ", "is", " ", "1", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prob", "lem", ":", " ", "ccr", " ", "mig", "ht", " ", "not", " ", "care", " ", "if", " ", "x1", " ", "or", " ", "x2", " ", "are", " ", "reduce", "d", " ", "rank", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "but", " ", "df", " ", "will", " ", "depend", " ", "on", " ", "rank_", "\\u\\u\\uNL\\u\\u\\u_", "df", "\\u", "model_", "=_", "k1_", "*_", "k2_", "#", " ", "df", "\\u", "hypothesis", " ", "(", "we", " ", "do", " ", "not", " ", "include", " ", "mean", " ", "in", " ", "x1", ",", " ", "x2", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "\\u", "resid_", "=_", "k1_", "*_", "(_", "nob", "s1_", "-_", "k2_", "-_", "dem", "ean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "min_", "(_", "df", "\\u", "model_", ",_", "k1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "0.5_", "*_", "(_", "df", "\\u", "model_", "-_", "k1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "0.5_", "*_", "(_", "df", "\\u", "resid_", "-_", "k1_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df1_", "=_", "k1_", "*_", "df", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df2_", "=_", "k2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt", "\\u", "value_", "=_", "cc", "2_", "._", "sum_", "(_", ")_", "#", " ", "Pil", "lai", "'", "s", " ", "trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wl", "\\u", "value_", "=_", "np_", "._", "product_", "(_", "1_", "/_", "(_", "1_", "+_", "lam_", ")_", ")_", "#", " ", "Wil", "k", "'", "s", " ", "Lambda_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ht", "\\u", "value_", "=_", "lam_", "._", "sum_", "(_", ")_", "#", " ", "Hot", "elli", "ng", "'", "s", " ", "Trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm", "\\u", "value_", "=_", "lam_", "._", "max_", "(_", ")_", "#", " ", "Ro", "y", "'", "s", " ", "large", "st", " ", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "sci", "py", " ", "import", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", "'", "s", " ", "the", " ", "distribu", "tion", ",", " ", "the", " ", "test", " ", "statistic", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "canonical", " ", "correlation", " ", "coefficient", "'_", "]_", "=_", "cc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "eigenvalues", "'_", "]_", "=_", "lam_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "\"", "Pil", "lai", "'", "s", " ", "Trace", "\"_", "]_", "=_", "pt", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "\"", "Wil", "k", "'", "s", " ", "Lam", "bda", "\"_", "]_", "=_", "wl", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "\"", "Hot", "elli", "ng", "'", "s", " ", "Trace", "\"_", "]_", "=_", "ht", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "\"", "Ro", "y", "'", "s", " ", "Large", "st", " ", "Roo", "t", "\"_", "]_", "=_", "rm", "\\u", "value_", "\\u\\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, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 argument to super() is not enclosing class
sihrc/tornado-boilerplate/indico/error/__init__.py
[ { "content": " def __init__(self, message, code):\n self.message = message\n self.code = code\n super(Exception, self).__init__(message)", "metadata": "root.IndicoError.__init__", "header": "['class', 'IndicoError', '(', 'Exception', ')', ':', '___EOS___']", "index": 5 } ]
[ { "span": "super(Exception, self).", "start_line": 8, "start_column": 8, "end_line": 8, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Indic", "o", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "message_", ",_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Exception_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ierror/BeautifulMind.io/beautifulmind/mindmap/migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'mindmap.mindmap': {\n 'Meta': {'object_name': 'MindMap'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'root_component': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['mindmap.MindMapComponent']\"}),\n 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '300'})\n },\n 'mindmap.mindmapcomponent': {\n 'Meta': {'object_name': 'MindMapComponent'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': \"'children'\", 'null': 'True', 'to': \"orm['mindmap.MindMapComponent']\"}),\n 'pos_left': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'pos_top': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})\n }\n }\n\n complete_apps = ['mindmap']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'MindMapComponent'\n db.create_table('mindmap_mindmapcomponent', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('parent', self.gf('mptt.fields.TreeForeignKey')(blank=True, related_name='children', null=True, to=orm['mindmap.MindMapComponent'])),\n ('pos_top', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),\n ('pos_left', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),\n ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),\n ('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),\n ('lft', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),\n ('rght', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),\n ('tree_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),\n ('level', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),\n ))\n db.send_create_signal('mindmap', ['MindMapComponent'])\n\n # Adding model 'MindMap'\n db.create_table('mindmap_mindmap', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=300)),\n ('root_component', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mindmap.MindMapComponent'])),\n ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),\n ('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),\n ))\n db.send_create_signal('mindmap', ['MindMap'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting model 'MindMapComponent'\n db.delete_table('mindmap_mindmapcomponent')\n\n # Deleting model 'MindMap'\n db.delete_table('mindmap_mindmap')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 38 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mind", "map", ".", "mind", "map", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Min", "d", "Map", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "component", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "mind", "map", ".", "Min", "d", "Map", "Compo", "nent", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mind", "map", ".", "mind", "map", "component", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Min", "d", "Map", "Compo", "nent", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "mpt", "t", ".", "fields", ".", "Tree", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "mind", "map", ".", "Min", "d", "Map", "Compo", "nent", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pos", "\\u", "left", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pos", "\\u", "top", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "mind", "map", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Min", "d", "Map", "Compo", "nent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "mind", "map", "\\u", "mind", "map", "component", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "title", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "parent", "'_", ",_", "self_", "._", "gf_", "(_", "'", "mpt", "t", ".", "fields", ".", "Tree", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "child", "ren", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "mind", "map", ".", "Min", "d", "Map", "Compo", "nent", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "pos", "\\u", "top", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "pos", "\\u", "left", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "modifi", "ed", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lft", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rg", "ht", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tree", "\\u", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "level", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "mind", "map", "'_", ",_", "[_", "'", "Min", "d", "Map", "Compo", "nent", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Min", "d", "Map", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "mind", "map", "\\u", "mind", "map", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slug", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ")_", "(_", "unique_", "=_", "True_", ",_", "max", "\\u", "length_", "=_", "300_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "root", "\\u", "component", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "mind", "map", ".", "Min", "d", "Map", "Compo", "nent", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "modifi", "ed", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "mind", "map", "'_", ",_", "[_", "'", "Min", "d", "Map", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Min", "d", "Map", "Compo", "nent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "'", "mind", "map", "\\u", "mind", "map", "component", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Min", "d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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Azure/azure-sdk-for-python/azure-servicemanagement-legacy/tests/test_legacy_mgmt_affinitygroup.py
[ { "content": " @record\n def test_list_affinity_groups(self):\n # Arrange\n self._create_affinity_group(self.affinity_group_name)\n\n # Act\n result = self.sms.list_affinity_groups()\n\n # Assert\n self.assertIsNotNone(result)\n self.assertTrue(len(result) > 0)\n\n group = None\n for temp in result:\n if temp.name == self.affinity_group_name:\n group = temp\n break\n\n self.assertIsNotNone(group)\n self.assertIsNotNone(group.name)\n self.assertIsNotNone(group.label)\n self.assertIsNotNone(group.description)\n self.assertIsNotNone(group.location)\n self.assertIsNotNone(group.capabilities)\n self.assertTrue(len(group.capabilities) > 0)", "metadata": "root.LegacyMgmtAffinityGroupTest.test_list_affinity_groups", "header": "['class', 'LegacyMgmtAffinityGroupTest', '(', 'LegacyMgmtTestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " @record\n def test_get_affinity_group_properties(self):\n # Arrange\n self.hosted_service_name = self.get_resource_name('utsvc')\n self.storage_account_name = self.get_resource_name('utstorage')\n self._create_affinity_group(self.affinity_group_name)\n self.sms.create_hosted_service(\n self.hosted_service_name,\n 'affgrptestlabel',\n 'affgrptestdesc',\n None,\n self.affinity_group_name)\n self.sms.create_storage_account(\n self.storage_account_name,\n self.storage_account_name + 'desc',\n self.storage_account_name + 'label',\n self.affinity_group_name)\n\n # Act\n result = self.sms.get_affinity_group_properties(\n self.affinity_group_name)\n\n # Assert\n self.assertIsNotNone(result)\n self.assertEqual(result.name, self.affinity_group_name)\n self.assertIsNotNone(result.label)\n self.assertIsNotNone(result.description)\n self.assertIsNotNone(result.location)\n self.assertIsNotNone(result.hosted_services[0])\n self.assertEqual(\n result.hosted_services[0].service_name, self.hosted_service_name)\n self.assertEqual(\n result.hosted_services[0].hosted_service_properties.affinity_group,\n self.affinity_group_name)\n # not sure why azure does not return any storage service\n self.assertTrue(len(result.capabilities) > 0)", "metadata": "root.LegacyMgmtAffinityGroupTest.test_get_affinity_group_properties", "header": "['class', 'LegacyMgmtAffinityGroupTest', '(', 'LegacyMgmtTestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " @record\n def test_list_locations(self):\n # Arrange\n\n # Act\n result = self.sms.list_locations()\n\n # Assert\n self.assertIsNotNone(result)\n self.assertTrue(len(result) > 0)\n self.assertIsNotNone(result[0].name)\n self.assertIsNotNone(result[0].display_name)\n self.assertIsNotNone(result[0].available_services)\n self.assertTrue(len(result[0].available_services) > 0)\n self.assertTrue(len(result[0].compute_capabilities.web_worker_role_sizes) > 0)\n self.assertTrue(len(result[0].compute_capabilities.virtual_machines_role_sizes) > 0)", "metadata": "root.LegacyMgmtAffinityGroupTest.test_list_locations", "header": "['class', 'LegacyMgmtAffinityGroupTest', '(', 'LegacyMgmtTestCase', ')', ':', '___EOS___']", "index": 183 } ]
[ { "span": "self.assertTrue(len(result) > 0)", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 40 }, { "span": "self.assertTrue(len(group.capabilities) > 0)", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 52 }, { "span": "self.assertTrue(len(result.capabilities) > 0)", "start_line": 136, "start_column": 8, "end_line": 136, "end_column": 53 }, { "span": "self.assertTrue(len(result) > 0)", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 40 }, { "span": "self.assertTrue(len(result[0].available_services) > 0)", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 62 }, { "span": "self.assertTrue(len(result[0].compute_capabilities.web_worker_role_sizes) > 0)", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 86 }, { "span": "self.assertTrue(len(result[0].compute_capabilities.virtual_machines_role_sizes) > 0)", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 92 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Leg", "ac", "y", "Mgmt", "Affi", "nit", "y", "Group", "Test_", "(_", "Leg", "ac", "y", "Mgmt", "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_", "@_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "affinity", "\\u", "groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Arr", "ange_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "affinity", "\\u", "group_", "(_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Act_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "sms_", "._", "list", "\\u", "affinity", "\\u", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "temp_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "temp_", "._", "name_", "==_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "temp_", "\\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_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "group_", "._", "capabilities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "group_", "._", "capabilities_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Leg", "ac", "y", "Mgmt", "Affi", "nit", "y", "Group", "Test_", "(_", "Leg", "ac", "y", "Mgmt", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "affinity", "\\u", "group", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Arr", "ange_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hoste", "d\\u", "service", "\\u", "name_", "=_", "self_", "._", "get", "\\u", "resource", "\\u", "name_", "(_", "'", "uts", "vc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "storage", "\\u", "account", "\\u", "name_", "=_", "self_", "._", "get", "\\u", "resource", "\\u", "name_", "(_", "'", "uts", "tora", "ge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "affinity", "\\u", "group_", "(_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sms_", "._", "create", "\\u", "hoste", "d\\u", "service_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "hoste", "d\\u", "service", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aff", "grp", "testl", "abel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aff", "grp", "testd", "esc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sms_", "._", "create", "\\u", "storage", "\\u", "account_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage", "\\u", "account", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage", "\\u", "account", "\\u", "name_", "+_", "'", "desc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "storage", "\\u", "account", "\\u", "name_", "+_", "'", "label", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Act_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "sms_", "._", "get", "\\u", "affinity", "\\u", "group", "\\u", "properties_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "name_", ",_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "._", "hoste", "d\\u", "services_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "hoste", "d\\u", "services_", "[_", "0_", "]_", "._", "service", "\\u", "name_", ",_", "self_", "._", "hoste", "d\\u", "service", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "hoste", "d\\u", "services_", "[_", "0_", "]_", "._", "hoste", "d\\u", "service", "\\u", "properties_", "._", "affinity", "\\u", "group_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "affinity", "\\u", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "sure", " ", "wh", "y", " ", "azu", "re", " ", "doe", "s", " ", "not", " ", "return", " ", "any", " ", "storage", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", "._", "capabilities_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Leg", "ac", "y", "Mgmt", "Affi", "nit", "y", "Group", "Test_", "(_", "Leg", "ac", "y", "Mgmt", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "locations_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Arr", "ange_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Act_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "sms_", "._", "list", "\\u", "locations_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "[_", "0_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "[_", "0_", "]_", "._", "display", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "result_", "[_", "0_", "]_", "._", "avail", "able", "\\u", "services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", "[_", "0_", "]_", "._", "avail", "able", "\\u", "services_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", "[_", "0_", "]_", "._", "compute", "\\u", "capabilities_", "._", "web", "\\u", "worker", "\\u", "role", "\\u", "sizes_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "result_", "[_", "0_", "]_", "._", "compute", "\\u", "capabilities_", "._", "virtual", "\\u", "machine", "s", "\\u", "role", "\\u", "sizes_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
'import *' may pollute namespace
ctxis/canape/CANAPE.Scripting/Lib/ctypes/_endian.py
[ { "content": "######################################################################\n# This file should be kept compatible with Python 2.3, see PEP 291. #\n######################################################################\nimport sys\nfrom ctypes import *\n\n_array_type = type(c_int * 3)\n\n\n\n################################################################\n\n# Note: The Structure metaclass checks for the *presence* (not the\n# value!) of a _swapped_bytes_ attribute to determine the bit order in\n# structures containing bit fields.\n\nif sys.byteorder == \"little\":\n _OTHER_ENDIAN = \"__ctype_be__\"\n\n LittleEndianStructure = Structure\n\n\nelif sys.byteorder == \"big\":\n _OTHER_ENDIAN = \"__ctype_le__\"\n\n BigEndianStructure = Structure\n\nelse:\n raise RuntimeError(\"Invalid byteorder\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from ctypes import *", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "kep", "t", " ", "compatible", " ", "with", " ", "Pyth", "on", " ", "2.3", ",", " ", "see", " ", "PE", "P", " ", "291", ".", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "array", "\\u", "type_", "=_", "type_", "(_", "c\\u", "int_", "*_", "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\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "The", " ", "Structur", "e", " ", "metaclass", " ", "checks", " ", "for", " ", "the", " ", "*", "presen", "ce", "*", " ", "(", "not", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", "!)", " ", "of", " ", "a", " ", "\\u", "swapp", "ed", "\\u", "bytes", "\\u", " ", "attribute", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "bit", " ", "order", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "structure", "s", " ", "contain", "ing", " ", "bit", " ", "fields", "._", "\\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_", "sys_", "._", "byteorder_", "==_", "\"", "litt", "le", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "OTHER", "\\u", "ENDI", "AN_", "=_", "\"\\u\\u", "ctype", "\\u", "be", "\\u\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Litt", "le", "Endi", "an", "Structure_", "=_", "Structure_", "\\u\\u\\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_", "elif_", "sys_", "._", "byteorder_", "==_", "\"", "big", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "OTHER", "\\u", "ENDI", "AN_", "=_", "\"\\u\\u", "ctype", "\\u", "le", "\\u\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Big", "Endi", "an", "Structure_", "=_", "Structure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Inva", "lid", " ", "byte", "order", "\"_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Should use a 'with' statement
ojii/django-template-server/templateserver/runserver_template.py
[ { "content": "def get_open_port():\n port = 8000\n while True:\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n try:\n s.bind(('localhost', port))\n except socket.error:\n port += 1\n else:\n break\n finally:\n s.close()\n return port", "metadata": "root.get_open_port", "header": "['module', '___EOS___']", "index": 64 } ]
[ { "span": "s.close()", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Sho", "ul", "d_", "use_", "a_", "'", "with", "'_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "open", "\\u", "port_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "8000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "bind_", "(_", "(_", "'", "local", "host", "'_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "+=_", "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 ", " _", "break_", "\\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 ", " _", "s_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "port_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
SmokinCaterpillar/pypet/pypet/tests/unittests/pypetlogging_test.py
[ { "content": " def test_pickling(self):\n manager = LoggingManager(log_config=get_log_config(), log_stdout=True)\n manager.extract_replacements(FakeTraj())\n manager.check_log_config()\n manager.make_logging_handlers_and_tools()\n dump = pickle.dumps(manager)\n new_manager = pickle.loads(dump)\n manager.finalize()", "metadata": "root.LoggingManagerTest.test_pickling", "header": "['class', 'LoggingManagerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "new_manager ", "start_line": 36, "start_column": 8, "end_line": 36, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Log", "ging", "Manager", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "pick", "ling_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "Log", "ging", "Manager_", "(_", "log", "\\u", "config_", "=_", "get", "\\u", "log", "\\u", "config_", "(_", ")_", ",_", "log", "\\u", "stdout_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "extract", "\\u", "replacements_", "(_", "Fake", "Tra", "j_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "check", "\\u", "log", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "make", "\\u", "logg", "ing", "\\u", "handler", "s", "\\u", "and", "\\u", "tools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump_", "=_", "pickle_", "._", "dumps_", "(_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "manager_", "=_", "pickle_", "._", "loads_", "(_", "dump_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "finalize_", "(_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rlpy/rlpy/rlpy/Domains/PacmanPackage/reinforcementTestClasses.py
[ { "content": "# reinforcementTestClasses.py\n# ---------------------------\n# Licensing Information: Please do not distribute or publish solutions to this\n# project. You are free to use and extend these projects for educational\n# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by\n# John DeNero ([email protected]) and Dan Klein ([email protected]).\n# Student side autograding was added by Brad Miller, Nick Hay, and Pieter\n# Abbeel in Spring 2013.\n# For more info, see http://inst.eecs.berkeley.edu/~cs188/pacman/pacman.html\n\nimport testClasses\nimport random\nimport math\nimport traceback\nimport sys\nimport os\nimport layout\nimport textDisplay\nimport pacman\nimport gridworld\nimport time\nfrom util import Counter, TimeoutFunction, FixedRandom\nfrom collections import defaultdict\nfrom pprint import PrettyPrinter\nfrom hashlib import sha1\nfrom functools import reduce\npp = PrettyPrinter()\nVERBOSE = False\n\nimport gridworld\n\nLIVINGREWARD = -0.1\nNOISE = 0.2\n\n\n\n\n\n\n\n\n\n\n# q6\n\n\n# q7/q8\n# =====\n# Average wins of a pacman agent\n\n\n\n# q2/q3\n# =====\n# For each parameter setting, compute the optimal policy, see if it\n# satisfies some properties\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ValueIterationTest(testClasses.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ValueIterationTest", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def __init__(self, question, testDict):\n super(ValueIterationTest, self).__init__(question, testDict)\n self.discount = float(testDict['discount'])\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n iterations = int(testDict['valueIterations'])\n if 'noise' in testDict:\n self.grid.setNoise(float(testDict['noise']))\n if 'livingReward' in testDict:\n self.grid.setLivingReward(float(testDict['livingReward']))\n maxPreIterations = 10\n self.numsIterationsForDisplay = range(\n min(iterations, maxPreIterations))\n self.testOutFile = testDict['test_out_file']\n if maxPreIterations < iterations:\n self.numsIterationsForDisplay.append(iterations)", "metadata": "root.ValueIterationTest.__init__", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def writeFailureFile(self, string):\n with open(self.testOutFile, 'w') as handle:\n handle.write(string)", "metadata": "root.ValueIterationTest.writeFailureFile", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def removeFailureFileIfExists(self):\n if os.path.exists(self.testOutFile):\n os.remove(self.testOutFile)", "metadata": "root.ValueIterationTest.removeFailureFileIfExists", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n failureOutputFileString = ''\n failureOutputStdString = ''\n for n in self.numsIterationsForDisplay:\n checkPolicy = (n == self.numsIterationsForDisplay[-1])\n testPass, stdOutString, fileOutString = self.executeNIterations(\n grades, moduleDict, solutionDict, n, checkPolicy)\n failureOutputStdString += stdOutString\n failureOutputFileString += fileOutString\n if not testPass:\n self.addMessage(failureOutputStdString)\n self.addMessage(\n 'For more details to help you debug, see test output file %s\\n\\n' %\n self.testOutFile)\n self.writeFailureFile(failureOutputFileString)\n return self.testFail(grades)\n self.removeFailureFileIfExists()\n return self.testPass(grades)", "metadata": "root.ValueIterationTest.execute", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def executeNIterations(self, grades, moduleDict,\n solutionDict, n, checkPolicy):\n testPass = True\n valuesPretty, qValuesPretty, actions, policyPretty = self.runAgent(\n moduleDict, n)\n stdOutString = ''\n fileOutString = ''\n valuesKey = \"values_k_%d\" % n\n if self.comparePrettyValues(valuesPretty, solutionDict[valuesKey]):\n fileOutString += \"Values at iteration %d are correct.\\n\" % n\n fileOutString += \" Student/correct solution:\\n %s\\n\" % self.prettyValueSolutionString(\n valuesKey,\n valuesPretty)\n else:\n testPass = False\n outString = \"Values at iteration %d are NOT correct.\\n\" % n\n outString += \" Student solution:\\n %s\\n\" % self.prettyValueSolutionString(\n valuesKey,\n valuesPretty)\n outString += \" Correct solution:\\n %s\\n\" % self.prettyValueSolutionString(\n valuesKey,\n solutionDict[valuesKey])\n stdOutString += outString\n fileOutString += outString\n for action in actions:\n qValuesKey = 'q_values_k_%d_action_%s' % (n, action)\n qValues = qValuesPretty[action]\n if self.comparePrettyValues(qValues, solutionDict[qValuesKey]):\n fileOutString += \"Q-Values at iteration %d for action %s are correct.\\n\" % (\n n,\n action)\n fileOutString += \" Student/correct solution:\\n %s\\n\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n else:\n testPass = False\n outString = \"Q-Values at iteration %d for action %s are NOT correct.\\n\" % (\n n,\n action)\n outString += \" Student solution:\\n %s\\n\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n outString += \" Correct solution:\\n %s\\n\" % self.prettyValueSolutionString(\n qValuesKey,\n solutionDict[qValuesKey])\n stdOutString += outString\n fileOutString += outString\n if checkPolicy:\n if not self.comparePrettyValues(policyPretty, solutionDict['policy']):\n testPass = False\n outString = \"Policy is NOT correct.\\n\"\n outString += \" Student solution:\\n %s\\n\" % self.prettyValueSolutionString(\n 'policy',\n policyPretty)\n outString += \" Correct solution:\\n %s\\n\" % self.prettyValueSolutionString(\n 'policy',\n solutionDict['policy'])\n stdOutString += outString\n fileOutString += outString\n return testPass, stdOutString, fileOutString", "metadata": "root.ValueIterationTest.executeNIterations", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n policyPretty = ''\n actions = []\n for n in self.numsIterationsForDisplay:\n valuesPretty, qValuesPretty, actions, policyPretty = self.runAgent(\n moduleDict, n)\n handle.write(\n self.prettyValueSolutionString(\n 'values_k_%d' %\n n,\n valuesPretty))\n for action in actions:\n handle.write(\n self.prettyValueSolutionString(\n 'q_values_k_%d_action_%s' %\n (n, action), qValuesPretty[action]))\n handle.write(\n self.prettyValueSolutionString(\n 'policy',\n policyPretty))\n handle.write(\n self.prettyValueSolutionString('actions',\n '\\n'.join(actions) + '\\n'))\n return True", "metadata": "root.ValueIterationTest.writeSolution", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def runAgent(self, moduleDict, numIterations):\n agent = moduleDict['valueIterationAgents'].ValueIterationAgent(\n self.grid,\n discount=self.discount,\n iterations=numIterations)\n states = self.grid.getStates()\n actions = list(\n reduce(lambda a,\n b: set(a).union(b),\n [self.grid.getPossibleActions(state) for state in states]))\n values = {}\n qValues = {}\n policy = {}\n for state in states:\n values[state] = agent.getValue(state)\n policy[state] = agent.computeActionFromValues(state)\n possibleActions = self.grid.getPossibleActions(state)\n for action in actions:\n if action not in qValues:\n qValues[action] = {}\n if action in possibleActions:\n qValues[\n action][\n state] = agent.computeQValueFromValues(\n state,\n action)\n else:\n qValues[action][state] = None\n valuesPretty = self.prettyValues(values)\n policyPretty = self.prettyPolicy(policy)\n qValuesPretty = {}\n for action in actions:\n qValuesPretty[action] = self.prettyValues(qValues[action])\n return (valuesPretty, qValuesPretty, actions, policyPretty)", "metadata": "root.ValueIterationTest.runAgent", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 167 }, { "content": " def prettyPrint(self, elements, formatString):\n pretty = ''\n states = self.grid.getStates()\n for ybar in range(self.grid.grid.height):\n y = self.grid.grid.height - 1 - ybar\n row = []\n for x in range(self.grid.grid.width):\n if (x, y) in states:\n value = elements[(x, y)]\n if value is None:\n row.append(' illegal')\n else:\n row.append(formatString.format(elements[(x, y)]))\n else:\n row.append('_' * 10)\n pretty += ' %s\\n' % (\" \".join(row), )\n pretty += '\\n'\n return pretty", "metadata": "root.ValueIterationTest.prettyPrint", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 202 }, { "content": " def prettyValues(self, values):\n return self.prettyPrint(values, '{0:10.4f}')", "metadata": "root.ValueIterationTest.prettyValues", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def prettyPolicy(self, policy):\n return self.prettyPrint(policy, '{0:10s}')", "metadata": "root.ValueIterationTest.prettyPolicy", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def prettyValueSolutionString(self, name, pretty):\n return '%s: \"\"\"\\n%s\\n\"\"\"\\n\\n' % (name, pretty.rstrip())", "metadata": "root.ValueIterationTest.prettyValueSolutionString", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 227 }, { "content": " def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01):\n aList = self.parsePrettyValues(aPretty)\n bList = self.parsePrettyValues(bPretty)\n if len(aList) != len(bList):\n return False\n for a, b in zip(aList, bList):\n try:\n aNum = float(a)\n bNum = float(b)\n # error = abs((aNum - bNum) / ((aNum + bNum) / 2.0))\n error = abs(aNum - bNum)\n if error > tolerance:\n return False\n except ValueError:\n if a.strip() != b.strip():\n return False\n return True", "metadata": "root.ValueIterationTest.comparePrettyValues", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 230 }, { "content": " def parsePrettyValues(self, pretty):\n values = pretty.split()\n return values", "metadata": "root.ValueIterationTest.parsePrettyValues", "header": "['class', 'ValueIterationTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 248 }, { "content": "class ApproximateQLearningTest(testClasses.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ApproximateQLearningTest", "header": "['module', '___EOS___']", "index": 253 }, { "content": " def __init__(self, question, testDict):\n super(ApproximateQLearningTest, self).__init__(question, testDict)\n self.discount = float(testDict['discount'])\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n if 'noise' in testDict:\n self.grid.setNoise(float(testDict['noise']))\n if 'livingReward' in testDict:\n self.grid.setLivingReward(float(testDict['livingReward']))\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n self.env = gridworld.GridworldEnvironment(self.grid)\n self.epsilon = float(testDict['epsilon'])\n self.learningRate = float(testDict['learningRate'])\n self.extractor = 'IdentityExtractor'\n if 'extractor' in testDict:\n self.extractor = testDict['extractor']\n self.opts = {\n 'actionFn': self.env.getPossibleActions,\n 'epsilon': self.epsilon,\n 'gamma': self.discount,\n 'alpha': self.learningRate}\n numExperiences = int(testDict['numExperiences'])\n maxPreExperiences = 10\n self.numsExperiencesForDisplay = range(\n min(numExperiences, maxPreExperiences))\n self.testOutFile = testDict['test_out_file']\n if maxPreExperiences < numExperiences:\n self.numsExperiencesForDisplay.append(numExperiences)", "metadata": "root.ApproximateQLearningTest.__init__", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 255 }, { "content": " def writeFailureFile(self, string):\n with open(self.testOutFile, 'w') as handle:\n handle.write(string)", "metadata": "root.ApproximateQLearningTest.writeFailureFile", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " def removeFailureFileIfExists(self):\n if os.path.exists(self.testOutFile):\n os.remove(self.testOutFile)", "metadata": "root.ApproximateQLearningTest.removeFailureFileIfExists", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 287 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n failureOutputFileString = ''\n failureOutputStdString = ''\n for n in self.numsExperiencesForDisplay:\n testPass, stdOutString, fileOutString = self.executeNExperiences(\n grades, moduleDict, solutionDict, n)\n failureOutputStdString += stdOutString\n failureOutputFileString += fileOutString\n if not testPass:\n self.addMessage(failureOutputStdString)\n self.addMessage(\n 'For more details to help you debug, see test output file %s\\n\\n' %\n self.testOutFile)\n self.writeFailureFile(failureOutputFileString)\n return self.testFail(grades)\n self.removeFailureFileIfExists()\n return self.testPass(grades)", "metadata": "root.ApproximateQLearningTest.execute", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 291 }, { "content": " def executeNExperiences(self, grades, moduleDict, solutionDict, n):\n testPass = True\n qValuesPretty, weights, actions, lastExperience = self.runAgent(\n moduleDict, n)\n stdOutString = ''\n fileOutString = \"==================== Iteration %d ====================\\n\" % n\n if lastExperience is not None:\n fileOutString += \"Agent observed the transition (startState = %s, action = %s, endState = %s, reward = %f)\\n\\n\" % lastExperience\n weightsKey = 'weights_k_%d' % n\n if weights == eval(solutionDict[weightsKey]):\n fileOutString += \"Weights at iteration %d are correct.\" % n\n fileOutString += \" Student/correct solution:\\n\\n%s\\n\\n\" % pp.pformat(weights)\n for action in actions:\n qValuesKey = 'q_values_k_%d_action_%s' % (n, action)\n qValues = qValuesPretty[action]\n if self.comparePrettyValues(qValues, solutionDict[qValuesKey]):\n fileOutString += \"Q-Values at iteration %d for action '%s' are correct.\" % (\n n,\n action)\n fileOutString += \" Student/correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n else:\n testPass = False\n outString = \"Q-Values at iteration %d for action '%s' are NOT correct.\" % (\n n,\n action)\n outString += \" Student solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n outString += \" Correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n solutionDict[qValuesKey])\n stdOutString += outString\n fileOutString += outString\n return testPass, stdOutString, fileOutString", "metadata": "root.ApproximateQLearningTest.executeNExperiences", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 309 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n for n in self.numsExperiencesForDisplay:\n qValuesPretty, weights, actions, _ = self.runAgent(\n moduleDict, n)\n handle.write(\n self.prettyValueSolutionString('weights_k_%d' %\n n, pp.pformat(weights)))\n for action in actions:\n handle.write(\n self.prettyValueSolutionString(\n 'q_values_k_%d_action_%s' %\n (n, action), qValuesPretty[action]))\n return True", "metadata": "root.ApproximateQLearningTest.writeSolution", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 346 }, { "content": " def runAgent(self, moduleDict, numExperiences):\n agent = moduleDict['qlearningAgents'].ApproximateQAgent(\n extractor=self.extractor,\n **self.opts)\n states = sorted(\n filter(lambda state: len(self.grid.getPossibleActions(state)) > 0,\n self.grid.getStates()))\n randObj = FixedRandom().random\n # choose a random start state and a random possible action from that state\n # get the next state and reward from the transition function\n lastExperience = None\n for i in range(numExperiences):\n startState = randObj.choice(states)\n action = randObj.choice(self.grid.getPossibleActions(startState))\n (endState, reward) = self.env.getRandomNextState(\n startState, action, randObj=randObj)\n lastExperience = (startState, action, endState, reward)\n agent.update(*lastExperience)\n actions = list(\n reduce(lambda a,\n b: set(a).union(b),\n [self.grid.getPossibleActions(state) for state in states]))\n qValues = {}\n weights = agent.getWeights()\n for state in states:\n possibleActions = self.grid.getPossibleActions(state)\n for action in actions:\n if action not in qValues:\n qValues[action] = {}\n if action in possibleActions:\n qValues[action][state] = agent.getQValue(state, action)\n else:\n qValues[action][state] = None\n qValuesPretty = {}\n for action in actions:\n qValuesPretty[action] = self.prettyValues(qValues[action])\n return (qValuesPretty, weights, actions, lastExperience)", "metadata": "root.ApproximateQLearningTest.runAgent", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 361 }, { "content": " def prettyPrint(self, elements, formatString):\n pretty = ''\n states = self.grid.getStates()\n for ybar in range(self.grid.grid.height):\n y = self.grid.grid.height - 1 - ybar\n row = []\n for x in range(self.grid.grid.width):\n if (x, y) in states:\n value = elements[(x, y)]\n if value is None:\n row.append(' illegal')\n else:\n row.append(formatString.format(elements[(x, y)]))\n else:\n row.append('_' * 10)\n pretty += ' %s\\n' % (\" \".join(row), )\n pretty += '\\n'\n return pretty", "metadata": "root.ApproximateQLearningTest.prettyPrint", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 399 }, { "content": " def prettyValues(self, values):\n return self.prettyPrint(values, '{0:10.4f}')", "metadata": "root.ApproximateQLearningTest.prettyValues", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 418 }, { "content": " def prettyPolicy(self, policy):\n return self.prettyPrint(policy, '{0:10s}')", "metadata": "root.ApproximateQLearningTest.prettyPolicy", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 421 }, { "content": " def prettyValueSolutionString(self, name, pretty):\n return '%s: \"\"\"\\n%s\\n\"\"\"\\n\\n' % (name, pretty.rstrip())", "metadata": "root.ApproximateQLearningTest.prettyValueSolutionString", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 424 }, { "content": " def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01):\n aList = self.parsePrettyValues(aPretty)\n bList = self.parsePrettyValues(bPretty)\n if len(aList) != len(bList):\n return False\n for a, b in zip(aList, bList):\n try:\n aNum = float(a)\n bNum = float(b)\n # error = abs((aNum - bNum) / ((aNum + bNum) / 2.0))\n error = abs(aNum - bNum)\n if error > tolerance:\n return False\n except ValueError:\n if a.strip() != b.strip():\n return False\n return True", "metadata": "root.ApproximateQLearningTest.comparePrettyValues", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 427 }, { "content": " def parsePrettyValues(self, pretty):\n values = pretty.split()\n return values", "metadata": "root.ApproximateQLearningTest.parsePrettyValues", "header": "['class', 'ApproximateQLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 445 }, { "content": "class QLearningTest(testClasses.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.QLearningTest", "header": "['module', '___EOS___']", "index": 450 }, { "content": " def __init__(self, question, testDict):\n super(QLearningTest, self).__init__(question, testDict)\n self.discount = float(testDict['discount'])\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n if 'noise' in testDict:\n self.grid.setNoise(float(testDict['noise']))\n if 'livingReward' in testDict:\n self.grid.setLivingReward(float(testDict['livingReward']))\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n self.env = gridworld.GridworldEnvironment(self.grid)\n self.epsilon = float(testDict['epsilon'])\n self.learningRate = float(testDict['learningRate'])\n self.opts = {\n 'actionFn': self.env.getPossibleActions,\n 'epsilon': self.epsilon,\n 'gamma': self.discount,\n 'alpha': self.learningRate}\n numExperiences = int(testDict['numExperiences'])\n maxPreExperiences = 10\n self.numsExperiencesForDisplay = range(\n min(numExperiences, maxPreExperiences))\n self.testOutFile = testDict['test_out_file']\n if maxPreExperiences < numExperiences:\n self.numsExperiencesForDisplay.append(numExperiences)", "metadata": "root.QLearningTest.__init__", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 452 }, { "content": " def writeFailureFile(self, string):\n with open(self.testOutFile, 'w') as handle:\n handle.write(string)", "metadata": "root.QLearningTest.writeFailureFile", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 477 }, { "content": " def removeFailureFileIfExists(self):\n if os.path.exists(self.testOutFile):\n os.remove(self.testOutFile)", "metadata": "root.QLearningTest.removeFailureFileIfExists", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 481 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n failureOutputFileString = ''\n failureOutputStdString = ''\n for n in self.numsExperiencesForDisplay:\n checkValuesAndPolicy = (n == self.numsExperiencesForDisplay[-1])\n testPass, stdOutString, fileOutString = self.executeNExperiences(\n grades, moduleDict, solutionDict, n, checkValuesAndPolicy)\n failureOutputStdString += stdOutString\n failureOutputFileString += fileOutString\n if not testPass:\n self.addMessage(failureOutputStdString)\n self.addMessage(\n 'For more details to help you debug, see test output file %s\\n\\n' %\n self.testOutFile)\n self.writeFailureFile(failureOutputFileString)\n return self.testFail(grades)\n self.removeFailureFileIfExists()\n return self.testPass(grades)", "metadata": "root.QLearningTest.execute", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 485 }, { "content": " def executeNExperiences(self, grades, moduleDict,\n solutionDict, n, checkValuesAndPolicy):\n testPass = True\n valuesPretty, qValuesPretty, actions, policyPretty, lastExperience = self.runAgent(\n moduleDict, n)\n stdOutString = ''\n fileOutString = \"==================== Iteration %d ====================\\n\" % n\n if lastExperience is not None:\n fileOutString += \"Agent observed the transition (startState = %s, action = %s, endState = %s, reward = %f)\\n\\n\\n\" % lastExperience\n for action in actions:\n qValuesKey = 'q_values_k_%d_action_%s' % (n, action)\n qValues = qValuesPretty[action]\n if self.comparePrettyValues(qValues, solutionDict[qValuesKey]):\n fileOutString += \"Q-Values at iteration %d for action '%s' are correct.\" % (\n n,\n action)\n fileOutString += \" Student/correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n else:\n testPass = False\n outString = \"Q-Values at iteration %d for action '%s' are NOT correct.\" % (\n n,\n action)\n outString += \" Student solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n qValues)\n outString += \" Correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n qValuesKey,\n solutionDict[qValuesKey])\n stdOutString += outString\n fileOutString += outString\n if checkValuesAndPolicy:\n if not self.comparePrettyValues(valuesPretty, solutionDict['values']):\n testPass = False\n outString = \"Values are NOT correct.\"\n outString += \" Student solution:\\n\\t%s\" % self.prettyValueSolutionString(\n 'values',\n valuesPretty)\n outString += \" Correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n 'values',\n solutionDict['values'])\n stdOutString += outString\n fileOutString += outString\n if not self.comparePrettyValues(policyPretty, solutionDict['policy']):\n testPass = False\n outString = \"Policy is NOT correct.\"\n outString += \" Student solution:\\n\\t%s\" % self.prettyValueSolutionString(\n 'policy',\n policyPretty)\n outString += \" Correct solution:\\n\\t%s\" % self.prettyValueSolutionString(\n 'policy',\n solutionDict['policy'])\n stdOutString += outString\n fileOutString += outString\n return testPass, stdOutString, fileOutString", "metadata": "root.QLearningTest.executeNExperiences", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 504 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n valuesPretty = ''\n policyPretty = ''\n for n in self.numsExperiencesForDisplay:\n valuesPretty, qValuesPretty, actions, policyPretty, _ = self.runAgent(\n moduleDict, n)\n for action in actions:\n handle.write(\n self.prettyValueSolutionString(\n 'q_values_k_%d_action_%s' %\n (n, action), qValuesPretty[action]))\n handle.write(\n self.prettyValueSolutionString(\n 'values',\n valuesPretty))\n handle.write(\n self.prettyValueSolutionString(\n 'policy',\n policyPretty))\n return True", "metadata": "root.QLearningTest.writeSolution", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 561 }, { "content": " def runAgent(self, moduleDict, numExperiences):\n agent = moduleDict['qlearningAgents'].QLearningAgent(**self.opts)\n states = sorted(\n filter(lambda state: len(self.grid.getPossibleActions(state)) > 0,\n self.grid.getStates()))\n randObj = FixedRandom().random\n # choose a random start state and a random possible action from that state\n # get the next state and reward from the transition function\n lastExperience = None\n for i in range(numExperiences):\n startState = randObj.choice(states)\n action = randObj.choice(self.grid.getPossibleActions(startState))\n (endState, reward) = self.env.getRandomNextState(\n startState, action, randObj=randObj)\n lastExperience = (startState, action, endState, reward)\n agent.update(*lastExperience)\n actions = list(\n reduce(lambda a,\n b: set(a).union(b),\n [self.grid.getPossibleActions(state) for state in states]))\n values = {}\n qValues = {}\n policy = {}\n for state in states:\n values[state] = agent.computeValueFromQValues(state)\n policy[state] = agent.computeActionFromQValues(state)\n possibleActions = self.grid.getPossibleActions(state)\n for action in actions:\n if action not in qValues:\n qValues[action] = {}\n if action in possibleActions:\n qValues[action][state] = agent.getQValue(state, action)\n else:\n qValues[action][state] = None\n valuesPretty = self.prettyValues(values)\n policyPretty = self.prettyPolicy(policy)\n qValuesPretty = {}\n for action in actions:\n qValuesPretty[action] = self.prettyValues(qValues[action])\n return (\n (valuesPretty, qValuesPretty, actions,\n policyPretty, lastExperience)\n )", "metadata": "root.QLearningTest.runAgent", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 583 }, { "content": " def prettyPrint(self, elements, formatString):\n pretty = ''\n states = self.grid.getStates()\n for ybar in range(self.grid.grid.height):\n y = self.grid.grid.height - 1 - ybar\n row = []\n for x in range(self.grid.grid.width):\n if (x, y) in states:\n value = elements[(x, y)]\n if value is None:\n row.append(' illegal')\n else:\n row.append(formatString.format(elements[(x, y)]))\n else:\n row.append('_' * 10)\n pretty += ' %s\\n' % (\" \".join(row), )\n pretty += '\\n'\n return pretty", "metadata": "root.QLearningTest.prettyPrint", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 627 }, { "content": " def prettyValues(self, values):\n return self.prettyPrint(values, '{0:10.4f}')", "metadata": "root.QLearningTest.prettyValues", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 646 }, { "content": " def prettyPolicy(self, policy):\n return self.prettyPrint(policy, '{0:10s}')", "metadata": "root.QLearningTest.prettyPolicy", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 649 }, { "content": " def prettyValueSolutionString(self, name, pretty):\n return '%s: \"\"\"\\n%s\\n\"\"\"\\n\\n' % (name, pretty.rstrip())", "metadata": "root.QLearningTest.prettyValueSolutionString", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 652 }, { "content": " def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01):\n aList = self.parsePrettyValues(aPretty)\n bList = self.parsePrettyValues(bPretty)\n if len(aList) != len(bList):\n return False\n for a, b in zip(aList, bList):\n try:\n aNum = float(a)\n bNum = float(b)\n # error = abs((aNum - bNum) / ((aNum + bNum) / 2.0))\n error = abs(aNum - bNum)\n if error > tolerance:\n return False\n except ValueError:\n if a.strip() != b.strip():\n return False\n return True", "metadata": "root.QLearningTest.comparePrettyValues", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 655 }, { "content": " def parsePrettyValues(self, pretty):\n values = pretty.split()\n return values", "metadata": "root.QLearningTest.parsePrettyValues", "header": "['class', 'QLearningTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 673 }, { "content": "class EpsilonGreedyTest(testClasses.TestCase):\n\n\n\n\n", "metadata": "root.EpsilonGreedyTest", "header": "['module', '___EOS___']", "index": 678 }, { "content": " def __init__(self, question, testDict):\n super(EpsilonGreedyTest, self).__init__(question, testDict)\n self.discount = float(testDict['discount'])\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n if 'noise' in testDict:\n self.grid.setNoise(float(testDict['noise']))\n if 'livingReward' in testDict:\n self.grid.setLivingReward(float(testDict['livingReward']))\n\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n self.env = gridworld.GridworldEnvironment(self.grid)\n self.epsilon = float(testDict['epsilon'])\n self.learningRate = float(testDict['learningRate'])\n self.numExperiences = int(testDict['numExperiences'])\n self.numIterations = int(testDict['iterations'])\n self.opts = {\n 'actionFn': self.env.getPossibleActions,\n 'epsilon': self.epsilon,\n 'gamma': self.discount,\n 'alpha': self.learningRate}", "metadata": "root.EpsilonGreedyTest.__init__", "header": "['class', 'EpsilonGreedyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 680 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n if self.testEpsilonGreedy(moduleDict):\n return self.testPass(grades)\n else:\n return self.testFail(grades)", "metadata": "root.EpsilonGreedyTest.execute", "header": "['class', 'EpsilonGreedyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 701 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n handle.write('# This is the solution file for %s.\\n' % self.path)\n handle.write('# File intentionally blank.\\n')\n return True", "metadata": "root.EpsilonGreedyTest.writeSolution", "header": "['class', 'EpsilonGreedyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 707 }, { "content": " def runAgent(self, moduleDict):\n agent = moduleDict['qlearningAgents'].QLearningAgent(**self.opts)\n states = sorted(\n filter(lambda state: len(self.grid.getPossibleActions(state)) > 0,\n self.grid.getStates()))\n randObj = FixedRandom().random\n # choose a random start state and a random possible action from that state\n # get the next state and reward from the transition function\n for i in range(self.numExperiences):\n startState = randObj.choice(states)\n action = randObj.choice(self.grid.getPossibleActions(startState))\n (endState, reward) = self.env.getRandomNextState(\n startState, action, randObj=randObj)\n agent.update(startState, action, endState, reward)\n return agent", "metadata": "root.EpsilonGreedyTest.runAgent", "header": "['class', 'EpsilonGreedyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 713 }, { "content": " def testEpsilonGreedy(self, moduleDict, tolerance=0.025):\n agent = self.runAgent(moduleDict)\n for state in self.grid.getStates():\n numLegalActions = len(agent.getLegalActions(state))\n if numLegalActions <= 1:\n continue\n numGreedyChoices = 0\n optimalAction = agent.computeActionFromQValues(state)\n for iteration in range(self.numIterations):\n # assume that their computeActionFromQValues implementation is\n # correct (q4 tests this)\n if agent.getAction(state) == optimalAction:\n numGreedyChoices += 1\n # e = epsilon, g = # greedy actions, n = numIterations, k = numLegalActions\n # g = n * [(1-e) + e/k] -> e = (n - g) / (n - n/k)\n empiricalEpsilonNumerator = self.numIterations - numGreedyChoices\n empiricalEpsilonDenominator = self.numIterations - \\\n self.numIterations / float(numLegalActions)\n empiricalEpsilon = empiricalEpsilonNumerator / \\\n empiricalEpsilonDenominator\n error = abs(empiricalEpsilon - self.epsilon)\n if error > tolerance:\n self.addMessage(\n \"Epsilon-greedy action selection is not correct.\")\n self.addMessage(\n \"Actual epsilon = %f; student empirical epsilon = %f; error = %f > tolerance = %f\" %\n (self.epsilon, empiricalEpsilon, error, tolerance))\n return False\n return True", "metadata": "root.EpsilonGreedyTest.testEpsilonGreedy", "header": "['class', 'EpsilonGreedyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 729 }, { "content": "class Question6Test(testClasses.TestCase):\n\n\n", "metadata": "root.Question6Test", "header": "['module', '___EOS___']", "index": 761 }, { "content": " def __init__(self, question, testDict):\n super(Question6Test, self).__init__(question, testDict)", "metadata": "root.Question6Test.__init__", "header": "['class', 'Question6Test', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 763 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n studentSolution = moduleDict['analysis'].question6()\n studentSolution = str(studentSolution).strip().lower()\n hashedSolution = sha1(studentSolution).hexdigest()\n if hashedSolution == '46729c96bb1e4081fdc81a8ff74b3e5db8fba415':\n return self.testPass(grades)\n else:\n self.addMessage(\"Solution is not correct.\")\n self.addMessage(\" Student solution: %s\" % (studentSolution,))\n return self.testFail(grades)", "metadata": "root.Question6Test.execute", "header": "['class', 'Question6Test', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 766 }, { "content": " def writeSolution(self, moduleDict, filePath):\n handle = open(filePath, 'w')\n handle.write('# This is the solution file for %s.\\n' % self.path)\n handle.write('# File intentionally blank.\\n')\n handle.close()\n return True", "metadata": "root.Question6Test.writeSolution", "header": "['class', 'Question6Test', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 777 }, { "content": "class EvalAgentTest(testClasses.TestCase):\n\n\n", "metadata": "root.EvalAgentTest", "header": "['module', '___EOS___']", "index": 789 }, { "content": " def __init__(self, question, testDict):\n super(EvalAgentTest, self).__init__(question, testDict)\n self.pacmanParams = testDict['pacmanParams']\n\n self.scoreMinimum = int(\n testDict['scoreMinimum']) if 'scoreMinimum' in testDict else None\n self.nonTimeoutMinimum = int(\n testDict['nonTimeoutMinimum']) if 'nonTimeoutMinimum' in testDict else None\n self.winsMinimum = int(\n testDict['winsMinimum']) if 'winsMinimum' in testDict else None\n\n self.scoreThresholds = [int(s)\n for s in testDict.get('scoreThresholds', '').split()]\n self.nonTimeoutThresholds = [int(s)\n for s in testDict.get('nonTimeoutThresholds', '').split()]\n self.winsThresholds = [int(s)\n for s in testDict.get('winsThresholds', '').split()]\n\n self.maxPoints = sum(\n [len(t) for t in [self.scoreThresholds,\n self.nonTimeoutThresholds,\n self.winsThresholds]])", "metadata": "root.EvalAgentTest.__init__", "header": "['class', 'EvalAgentTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 791 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n self.addMessage(\n 'Grading agent using command: python pacman.py %s' %\n (self.pacmanParams,))\n\n startTime = time.time()\n games = pacman.runGames(\n ** pacman.readCommand(self.pacmanParams.split(' ')))\n totalTime = time.time() - startTime\n numGames = len(games)\n\n stats = {\n 'time': totalTime, 'wins':\n [g.state.isWin() for g in games].count(True),\n 'games': games, 'scores': [g.state.getScore() for g in games],\n 'timeouts': [g.agentTimeout for g in games].count(True), 'crashes': [g.agentCrashed for g in games].count(True)}\n\n averageScore = sum(stats['scores']) / float(len(stats['scores']))\n nonTimeouts = numGames - stats['timeouts']\n wins = stats['wins']\n\n def gradeThreshold(value, minimum, thresholds, name):\n points = 0\n passed = (minimum is None) or (value >= minimum)\n if passed:\n for t in thresholds:\n if value >= t:\n points += 1\n return (passed, points, value, minimum, thresholds, name)\n\n results = [gradeThreshold(\n averageScore, self.scoreMinimum, self.scoreThresholds, \"average score\"),\n gradeThreshold(\n nonTimeouts,\n self.nonTimeoutMinimum,\n self.nonTimeoutThresholds,\n \"games not timed out\"),\n gradeThreshold(wins, self.winsMinimum, self.winsThresholds, \"wins\")]\n\n totalPoints = 0\n for passed, points, value, minimum, thresholds, name in results:\n if minimum is None and len(thresholds) == 0:\n continue\n\n # print passed, points, value, minimum, thresholds, name\n totalPoints += points\n if not passed:\n assert points == 0\n self.addMessage(\n \"%s %s (fail: below minimum value %s)\" %\n (value, name, minimum))\n else:\n self.addMessage(\n \"%s %s (%s of %s points)\" %\n (value, name, points, len(thresholds)))\n\n if minimum is not None:\n self.addMessage(\" Grading scheme:\")\n self.addMessage(\" < %s: fail\" % (minimum,))\n if len(thresholds) == 0 or minimum != thresholds[0]:\n self.addMessage(\" >= %s: 0 points\" % (minimum,))\n for idx, threshold in enumerate(thresholds):\n self.addMessage(\n \" >= %s: %s points\" %\n (threshold, idx + 1))\n elif len(thresholds) > 0:\n self.addMessage(\" Grading scheme:\")\n self.addMessage(\" < %s: 0 points\" % (thresholds[0],))\n for idx, threshold in enumerate(thresholds):\n self.addMessage(\n \" >= %s: %s points\" %\n (threshold, idx + 1))\n\n if any([not passed for passed, _, _, _, _, _ in results]):\n totalPoints = 0\n\n return self.testPartial(grades, totalPoints, self.maxPoints)", "metadata": "root.EvalAgentTest.execute", "header": "['class', 'EvalAgentTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 814 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n handle.write('# This is the solution file for %s.\\n' % self.path)\n handle.write('# File intentionally blank.\\n')\n return True", "metadata": "root.EvalAgentTest.writeSolution", "header": "['class', 'EvalAgentTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 892 }, { "content": "def followPath(policy, start, numSteps=100):\n state = start\n path = []\n for i in range(numSteps):\n if state not in policy:\n break\n action = policy[state]\n path.append(\"(%s,%s)\" % state)\n if action == 'north':\n nextState = state[0], state[1] + 1\n if action == 'south':\n nextState = state[0], state[1] - 1\n if action == 'east':\n nextState = state[0] + 1, state[1]\n if action == 'west':\n nextState = state[0] - 1, state[1]\n if action == 'exit' or action is None:\n path.append('TERMINAL_STATE')\n break\n state = nextState\n\n return path", "metadata": "root.followPath", "header": "['module', '___EOS___']", "index": 903 }, { "content": "def parseGrid(string):\n grid = [[entry.strip() for entry in line.split()]\n for line in string.split('\\n')]\n for row in grid:\n for x, col in enumerate(row):\n try:\n col = int(col)\n except:\n pass\n if col == \"_\":\n col = ' '\n row[x] = col\n return gridworld.makeGrid(grid)", "metadata": "root.parseGrid", "header": "['module', '___EOS___']", "index": 927 }, { "content": "def computePolicy(moduleDict, grid, discount):\n valueIterator = moduleDict[\n 'valueIterationAgents'].ValueIterationAgent(\n grid,\n discount=discount)\n policy = {}\n for state in grid.getStates():\n policy[state] = valueIterator.computeActionFromValues(state)\n return policy", "metadata": "root.computePolicy", "header": "['module', '___EOS___']", "index": 942 }, { "content": "class GridPolicyTest(testClasses.TestCase):\n\n\n\n\n", "metadata": "root.GridPolicyTest", "header": "['module', '___EOS___']", "index": 953 }, { "content": " def __init__(self, question, testDict):\n super(GridPolicyTest, self).__init__(question, testDict)\n\n # Function in module in analysis that returns (discount, noise)\n self.parameterFn = testDict['parameterFn']\n self.question2 = testDict.get('question2', 'false').lower() == 'true'\n\n # GridWorld specification\n # _ is empty space\n # numbers are terminal states with that value\n # is a wall\n # S is a start state\n #\n self.gridText = testDict['grid']\n self.grid = gridworld.Gridworld(parseGrid(testDict['grid']))\n self.gridName = testDict['gridName']\n\n # Policy specification\n # _ policy choice not checked\n # N, E, S, W policy action must be north, east, south, west\n #\n self.policy = parseGrid(testDict['policy'])\n\n # State the most probable path must visit\n # (x,y) for a particular location; (0,0) is bottom left\n # terminal for the terminal state\n self.pathVisits = testDict.get('pathVisits', None)\n\n # State the most probable path must not visit\n # (x,y) for a particular location; (0,0) is bottom left\n # terminal for the terminal state\n self.pathNotVisits = testDict.get('pathNotVisits', None)", "metadata": "root.GridPolicyTest.__init__", "header": "['class', 'GridPolicyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 955 }, { "content": " def execute(self, grades, moduleDict, solutionDict):\n if not hasattr(moduleDict['analysis'], self.parameterFn):\n self.addMessage(\n 'Method not implemented: analysis.%s' %\n (self.parameterFn,))\n return self.testFail(grades)\n\n result = getattr(moduleDict['analysis'], self.parameterFn)()\n\n if isinstance(result, str) and result.lower()[0:3] == \"not\":\n self.addMessage('Actually, it is possible!')\n return self.testFail(grades)\n\n if self.question2:\n livingReward = None\n try:\n discount, noise = result\n discount = float(discount)\n noise = float(noise)\n except:\n self.addMessage(\n 'Did not return a (discount, noise) pair; instead analysis.%s returned: %s' %\n (self.parameterFn, result))\n return self.testFail(grades)\n if discount != 0.9 and noise != 0.2:\n self.addMessage(\n 'Must change either the discount or the noise, not both. Returned (discount, noise) = %s' %\n (result,))\n return self.testFail(grades)\n else:\n try:\n discount, noise, livingReward = result\n discount = float(discount)\n noise = float(noise)\n livingReward = float(livingReward)\n except:\n self.addMessage(\n 'Did not return a (discount, noise, living reward) triple; instead analysis.%s returned: %s' %\n (self.parameterFn, result))\n return self.testFail(grades)\n\n self.grid.setNoise(noise)\n if livingReward is not None:\n self.grid.setLivingReward(livingReward)\n\n start = self.grid.getStartState()\n policy = computePolicy(moduleDict, self.grid, discount)\n\n # check policy\n actionMap = {\n 'N': 'north',\n 'E': 'east',\n 'S': 'south',\n 'W': 'west',\n 'X': 'exit'}\n width, height = self.policy.width, self.policy.height\n policyPassed = True\n for x in range(width):\n for y in range(height):\n if self.policy[x][y] in actionMap and policy[(x, y)] != actionMap[self.policy[x][y]]:\n differPoint = (x, y)\n policyPassed = False\n\n if not policyPassed:\n self.addMessage('Policy not correct.')\n self.addMessage(\n ' Student policy at %s: %s' %\n (differPoint, policy[differPoint]))\n self.addMessage(\n ' Correct policy at %s: %s' %\n (differPoint, actionMap[self.policy[differPoint[0]][differPoint[1]]]))\n self.addMessage(' Student policy:')\n self.printPolicy(policy, False)\n self.addMessage(\n \" Legend: N,S,E,W at states which move north etc, X at states which exit,\")\n self.addMessage(\n \" . at states where the policy is not defined (e.g. walls)\")\n self.addMessage(' Correct policy specification:')\n self.printPolicy(self.policy, True)\n self.addMessage(\n \" Legend: N,S,E,W for states in which the student policy must move north etc,\")\n self.addMessage(\n \" _ for states where it doesn't matter what the student policy does.\")\n self.printGridworld()\n return self.testFail(grades)\n\n # check path\n path = followPath(policy, self.grid.getStartState())\n\n if self.pathVisits is not None and self.pathVisits not in path:\n self.addMessage(\n 'Policy does not visit state %s when moving without noise.' %\n (self.pathVisits,))\n self.addMessage(' States visited: %s' % (path,))\n self.addMessage(' Student policy:')\n self.printPolicy(policy, False)\n self.addMessage(\n \" Legend: N,S,E,W at states which move north etc, X at states which exit,\")\n self.addMessage(\n \" . at states where policy not defined\")\n self.printGridworld()\n return self.testFail(grades)\n\n if self.pathNotVisits is not None and self.pathNotVisits in path:\n self.addMessage(\n 'Policy visits state %s when moving without noise.' %\n (self.pathNotVisits,))\n self.addMessage(' States visited: %s' % (path,))\n self.addMessage(' Student policy:')\n self.printPolicy(policy, False)\n self.addMessage(\n \" Legend: N,S,E,W at states which move north etc, X at states which exit,\")\n self.addMessage(\n \" . at states where policy not defined\")\n self.printGridworld()\n return self.testFail(grades)\n\n return self.testPass(grades)", "metadata": "root.GridPolicyTest.execute", "header": "['class', 'GridPolicyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 988 }, { "content": " def printGridworld(self):\n self.addMessage(' Gridworld:')\n for line in self.gridText.split('\\n'):\n self.addMessage(' ' + line)\n self.addMessage(\n ' Legend: # wall, _ empty, S start, numbers terminal states with that reward.')", "metadata": "root.GridPolicyTest.printGridworld", "header": "['class', 'GridPolicyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1107 }, { "content": " def printPolicy(self, policy, policyTypeIsGrid):\n if policyTypeIsGrid:\n legend = {'N': 'N', 'E': 'E', 'S': 'S', 'W': 'W', ' ': '_'}\n else:\n legend = {\n 'north': 'N',\n 'east': 'E',\n 'south': 'S',\n 'west': 'W',\n 'exit': 'X',\n '.': '.',\n ' ': '_'}\n\n for ybar in range(self.grid.grid.height):\n y = self.grid.grid.height - 1 - ybar\n if policyTypeIsGrid:\n self.addMessage(\n \" %s\" %\n (\" \".join([legend[policy[x][y]] for x in range(self.grid.grid.width)]),))\n else:\n self.addMessage(\n \" %s\" %\n (\" \".join([legend[policy.get((x, y), '.')] for x in range(self.grid.grid.width)]),))\n # for state in sorted(self.grid.getStates()):\n # if state != 'TERMINAL_STATE':\n # self.addMessage(' (%s,%s) %s' % (state[0], state[1], policy[state]))", "metadata": "root.GridPolicyTest.printPolicy", "header": "['class', 'GridPolicyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1114 }, { "content": " def writeSolution(self, moduleDict, filePath):\n with open(filePath, 'w') as handle:\n handle.write('# This is the solution file for %s.\\n' % self.path)\n handle.write('# File intentionally blank.\\n')\n return True", "metadata": "root.GridPolicyTest.writeSolution", "header": "['class', 'GridPolicyTest', '(', 'testClasses', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1141 } ]
[ { "span": "import random", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 13 }, { "span": "import math", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 11 }, { "span": "import traceback", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 16 }, { "span": "import sys", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 10 }, { "span": "import layout", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 13 }, { "span": "import textDisplay", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 18 }, { "span": "from util import Counter, TimeoutFunction, FixedRandom", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 54 }, { "span": "from collections import defaultdict", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "rein", "force", "ment", "Test", "Class", "es", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Licen", "sing", " ", "Information", ":", " ", "Ple", "ase", " ", "do", " ", "not", " ", "distribute", " ", "or", " ", "publi", "sh", " ", "solut", "ion", "s", " ", "to", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "project", ".", " ", "You", " ", "are", " ", "free", " ", "to", " ", "use", " ", "and", " ", "extend", " ", "these", " ", "project", "s", " ", "for", " ", "educa", "tion", "al_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "purpose", "s", ".", " ", "The", " ", "Pac", "man", " ", "AI", " ", "project", "s", " ", "wer", "e", " ", "develop", "ed", " ", "at", " ", "UC", " ", "Ber", "kel", "ey", ",", " ", "prima", "ri", "ly", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Joh", "n", " ", "De", "Ne", "ro", " ", "(", "den", "ero", "@", "cs", ".", "ber", "kel", "ey", ".", "edu", ")", " ", "and", " ", "Dan", " ", "Kl", "ein", " ", "(", "kle", "in", "@", "cs", ".", "ber", "kel", "ey", ".", "edu", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stud", "ent", " ", "side", " ", "autograd", "ing", " ", "was", " ", "adde", "d", " ", "by", " ", "Bra", "d", " ", "Mill", "er", ",", " ", "Nick", " ", "Ha", "y", ",", " ", "and", " ", "Pie", "ter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ab", "bee", "l", " ", "in", " ", "Sprin", "g", " ", "2013", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "more", " ", "info", ",", " ", "see", " ", "http", "://", "inst", ".", "eec", "s", ".", "ber", "kel", "ey", ".", "edu", "/", "~", "cs", "188", "/", "pac", "man", "/", "pac", "man", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "test", "Classes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "text", "Display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pac", "man_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "grid", "world_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "util_", "import_", "Counter_", ",_", "Time", "out", "Function_", ",_", "Fix", "ed", "Random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "Pret", "ty", "Printer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hashlib_", "import_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "=_", "Pret", "ty", "Printer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VERBOSE_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "grid", "world_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LI", "VING", "RE", "WARD", "_", "=_", "-_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NO", "ISE", "_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "q", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "q", "7", "/", "q", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=====", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Average", " ", "wins", " ", "of", " ", "a", " ", "pac", "man", " ", "agent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "q2", "/", "q3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "=====", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "parameter", " ", "setti", "ng", ",", " ", "compute", " ", "the", " ", "optim", "al", " ", "policy", ",", " ", "see", " ", "if", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "satisf", "ies", " ", "some", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Value", "Iterat", "ion", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discount_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "discou", "nt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iterations_", "=_", "int_", "(_", "test", "Dict_", "[_", "'", "value", "Iterations", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "noise", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Noise_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "noise", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "living", "Reward", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Liv", "ing", "Reward", "_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "living", "Reward", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "Pre", "Iterations", "_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nums", "Iterations", "For", "Display_", "=_", "range_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "(_", "iterations_", ",_", "max", "Pre", "Iterations", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test", "Out", "File_", "=_", "test", "Dict_", "[_", "'", "test\\u", "out", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "Pre", "Iterations", "_", "<_", "iterations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nums", "Iterations", "For", "Display_", "._", "append_", "(_", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "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_", "write", "Fail", "ure", "File_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "test", "Out", "File_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "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_", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "test", "Out", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "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_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "Output", "File", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "nums", "Iterations", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Policy_", "=_", "(_", "n_", "==_", "self_", "._", "nums", "Iterations", "For", "Display_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "=_", "self_", "._", "execute", "NI", "tera", "tions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ",_", "n_", ",_", "check", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "+=_", "std", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "File", "String_", "+=_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "test", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "fail", "ure", "Output", "Std", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "For", " ", "more", " ", "deta", "il", "s", " ", "to", " ", "help", " ", "you", " ", "debug", ",", " ", "see", " ", "test", " ", "output", " ", "file", " ", "%", "s", "\\\\", "n", "\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "Fail", "ure", "File_", "(_", "fail", "ure", "Output", "File", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "NI", "tera", "tions_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", ",_", "n_", ",_", "check", "Policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "policy", "Pret", "ty_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values", "Key_", "=_", "\"", "values", "\\u", "k", "\\u", "%", "d", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "values", "Pret", "ty_", ",_", "solut", "ion", "Dict_", "[_", "values", "Key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "are", " ", "correct", ".\\\\", "n", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", "/", "correct", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "are", " ", "NOT", " ", "correct", ".\\\\", "n", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "values", "Key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Key_", "=_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "(_", "n_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "q", "Values_", ",_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "%", "s", " ", "are", " ", "correct", ".\\\\", "n", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", "/", "correct", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "%", "s", " ", "are", " ", "NOT", " ", "correct", ".\\\\", "n", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "check", "Policy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "policy", "Pret", "ty_", ",_", "solut", "ion", "Dict_", "[_", "'", "policy", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Polic", "y", " ", "is", " ", "NOT", " ", "correct", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", " ", "%", "s", "\\\\", "n", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "'", "policy", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "Pret", "ty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "nums", "Iterations", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "policy", "Pret", "ty_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "\\u", "k", "\\u", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Pret", "ty_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n_", ",_", "action_", ")_", ",_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "Pret", "ty_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "'", "action", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "'_", "._", "join_", "(_", "actions_", ")_", "+_", "'\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Agent_", "(_", "self_", ",_", "module", "Dict_", ",_", "num", "Iterations", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "module", "Dict_", "[_", "'", "value", "Iterat", "ion", "Agent", "s", "'_", "]_", "._", "Value", "Iterat", "ion", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "discount_", "=_", "self_", "._", "discount_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iterations_", "=_", "num", "Iterations", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "lambda_", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b_", ":_", "set_", "(_", "a_", ")_", "._", "union_", "(_", "b_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "for_", "state_", "in_", "states_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "state_", "]_", "=_", "agent_", "._", "get", "Value_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "[_", "state_", "]_", "=_", "agent_", "._", "compute", "Action", "Fro", "m", "Values_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "Actions_", "=_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "not_", "in_", "q", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "in_", "possib", "le", "Actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "]_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "]_", "=_", "agent_", "._", "compute", "QV", "alu", "e", "Fro", "m", "Values_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "[_", "state_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values", "Pret", "ty_", "=_", "self_", "._", "pretty", "Values_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "Pret", "ty_", "=_", "self_", "._", "pretty", "Policy_", "(_", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Value", "s", "Pret", "ty_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "=_", "self_", "._", "pretty", "Values_", "(_", "q", "Values_", "[_", "action_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "policy", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Print_", "(_", "self_", ",_", "elements_", ",_", "format", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pretty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "yb", "ar_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "self_", "._", "grid_", "._", "grid_", "._", "height_", "-_", "1_", "-_", "yb", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "x_", ",_", "y_", ")_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "'", " ", " ", " ", "ille", "gal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "format", "String_", "._", "format_", "(_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", ")_", ")_", "\\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 ", " ", "_", "row_", "._", "append_", "(_", "'\\u'_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'", " ", " ", " ", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\"", " ", " ", " ", "\"_", "._", "join_", "(_", "row_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "values_", ",_", "'{", "0", ":", "10.", "4f", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Policy_", "(_", "self_", ",_", "policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "policy_", ",_", "'{", "0", ":", "10", "s", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Value", "Solut", "ion", "String_", "(_", "self_", ",_", "name_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", ":", " ", "\"\"\"", "\\\\", "n", "%", "s", "\\\\", "n", "\"\"\"", "\\\\", "n", "\\\\", "n", "'_", "%_", "(_", "name_", ",_", "pretty_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "Pret", "ty", "Values_", "(_", "self_", ",_", "a", "Pret", "ty_", ",_", "b", "Pret", "ty_", ",_", "tolerance_", "=_", "0.01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "a", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "b", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "a", "List_", ")_", "!=_", "len_", "(_", "b", "List_", ")_", ":_", "\\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_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "a", "List_", ",_", "b", "List_", ")_", ":_", "\\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 ", " _", "a", "Num_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "Num_", "=_", "float_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "error", " ", "=", " ", "abs", "((", "a", "Num", " ", "-", " ", "b", "Num", ")", " ", "/", " ", "((", "a", "Num", " ", "+", " ", "b", "Num", ")", " ", "/", " ", "2.0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "abs_", "(_", "a", "Num_", "-_", "b", "Num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", ">_", "tolerance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "._", "strip_", "(_", ")_", "!=_", "b_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Value", "Iterat", "ion", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Pret", "ty", "Values_", "(_", "self_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "pretty_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discount_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "discou", "nt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "noise", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Noise_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "noise", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "living", "Reward", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Liv", "ing", "Reward", "_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "living", "Reward", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "=_", "grid", "world_", "._", "Grid", "world", "Environment_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "eps", "ilon", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "learn", "ing", "Rate_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "learn", "ing", "Rat", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "extractor_", "=_", "'", "Ident", "it", "y", "Extract", "or", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "extract", "or", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "extractor_", "=_", "test", "Dict_", "[_", "'", "extract", "or", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "opts_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "Fn", "'_", ":_", "self_", "._", "env_", "._", "get", "Poss", "ibl", "e", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eps", "ilon", "'_", ":_", "self_", "._", "epsilon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gamma", "'_", ":_", "self_", "._", "discount_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alpha", "'_", ":_", "self_", "._", "learn", "ing", "Rate_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Experience", "s_", "=_", "int_", "(_", "test", "Dict_", "[_", "'", "num", "Experience", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Pre", "Experience", "s_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nums", "Experience", "s", "For", "Display_", "=_", "range_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "(_", "num", "Experience", "s_", ",_", "max", "Pre", "Experience", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test", "Out", "File_", "=_", "test", "Dict_", "[_", "'", "test\\u", "out", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "Pre", "Experience", "s_", "<_", "num", "Experience", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nums", "Experience", "s", "For", "Display_", "._", "append_", "(_", "num", "Experience", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "write", "Fail", "ure", "File_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "test", "Out", "File_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "test", "Out", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "Output", "File", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "nums", "Experience", "s", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "=_", "self_", "._", "execute", "NE", "xpe", "rien", "ces_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "+=_", "std", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "File", "String_", "+=_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "test", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "fail", "ure", "Output", "Std", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "For", " ", "more", " ", "deta", "il", "s", " ", "to", " ", "help", " ", "you", " ", "debug", ",", " ", "see", " ", "test", " ", "output", " ", "file", " ", "%", "s", "\\\\", "n", "\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "Fail", "ure", "File_", "(_", "fail", "ure", "Output", "File", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "NE", "xpe", "rien", "ces_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Value", "s", "Pret", "ty_", ",_", "weights_", ",_", "actions_", ",_", "last", "Experience", "_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "=_", "\"====", "==============", "==", " ", "Iterat", "ion", " ", "%", "d", " ", "==============", "=====", "=\\\\", "n", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "Experience", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Agent", " ", "observe", "d", " ", "the", " ", "transiti", "on", " ", "(", "start", "State", " ", "=", " ", "%", "s", ",", " ", "action", " ", "=", " ", "%", "s", ",", " ", "end", "State", " ", "=", " ", "%", "s", ",", " ", "reward", " ", "=", " ", "%", "f", ")\\\\", "n", "\\\\", "n", "\"_", "%_", "last", "Experience", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "weight", "s", "Key_", "=_", "'", "weight", "s", "\\u", "k", "\\u", "%", "d", "'_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "weights_", "==_", "eval_", "(_", "solut", "ion", "Dict_", "[_", "weight", "s", "Key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Weig", "hts", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "are", " ", "correct", ".\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", "/", "correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "pp_", "._", "pformat_", "(_", "weights_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Key_", "=_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "(_", "n_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "q", "Values_", ",_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "'%", "s", "'", " ", "are", " ", "correct", ".\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", "/", "correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "'%", "s", "'", " ", "are", " ", "NOT", " ", "correct", ".\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "self_", "._", "nums", "Experience", "s", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Pret", "ty_", ",_", "weights_", ",_", "actions_", ",_", "\\u_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "'", "weight", "s", "\\u", "k", "\\u", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "pp_", "._", "pformat_", "(_", "weights_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n_", ",_", "action_", ")_", ",_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", ")_", ")_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Agent_", "(_", "self_", ",_", "module", "Dict_", ",_", "num", "Experience", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "module", "Dict_", "[_", "'", "ql", "earn", "ing", "Agent", "s", "'_", "]_", "._", "Approx", "imat", "e", "QA", "gent", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extractor_", "=_", "self_", "._", "extractor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "sorted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "(_", "lambda_", "state_", ":_", "len_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", ")_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "Obj_", "=_", "Fix", "ed", "Random_", "(_", ")_", "._", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "choose", " ", "a", " ", "random", " ", "start", " ", "state", " ", "and", " ", "a", " ", "random", " ", "possib", "le", " ", "action", " ", "from", " ", "tha", "t", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "next", " ", "state", " ", "and", " ", "reward", " ", "from", " ", "the", " ", "transiti", "on", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "last", "Experience", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Experience", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "State_", "=_", "rand", "Obj_", "._", "choice_", "(_", "states_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "rand", "Obj_", "._", "choice_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "start", "State_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "end", "State_", ",_", "reward_", ")_", "=_", "self_", "._", "env_", "._", "get", "Random", "Ne", "xt", "State_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "start", "State_", ",_", "action_", ",_", "rand", "Obj_", "=_", "rand", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Experience", "_", "=_", "(_", "start", "State_", ",_", "action_", ",_", "end", "State_", ",_", "reward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agent_", "._", "update_", "(_", "*_", "last", "Experience", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actions_", "=_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "lambda_", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b_", ":_", "set_", "(_", "a_", ")_", "._", "union_", "(_", "b_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "for_", "state_", "in_", "states_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weights_", "=_", "agent_", "._", "get", "Weights_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possib", "le", "Actions_", "=_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "not_", "in_", "q", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "in_", "possib", "le", "Actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "[_", "state_", "]_", "=_", "agent_", "._", "get", "QV", "alue_", "(_", "state_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "[_", "state_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q", "Value", "s", "Pret", "ty_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "=_", "self_", "._", "pretty", "Values_", "(_", "q", "Values_", "[_", "action_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "q", "Value", "s", "Pret", "ty_", ",_", "weights_", ",_", "actions_", ",_", "last", "Experience", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Print_", "(_", "self_", ",_", "elements_", ",_", "format", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pretty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "yb", "ar_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "self_", "._", "grid_", "._", "grid_", "._", "height_", "-_", "1_", "-_", "yb", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "x_", ",_", "y_", ")_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "'", " ", " ", " ", "ille", "gal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "format", "String_", "._", "format_", "(_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", ")_", ")_", "\\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 ", " ", "_", "row_", "._", "append_", "(_", "'\\u'_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'", " ", " ", " ", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\"", " ", " ", " ", "\"_", "._", "join_", "(_", "row_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "values_", ",_", "'{", "0", ":", "10.", "4f", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Policy_", "(_", "self_", ",_", "policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "policy_", ",_", "'{", "0", ":", "10", "s", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Value", "Solut", "ion", "String_", "(_", "self_", ",_", "name_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", ":", " ", "\"\"\"", "\\\\", "n", "%", "s", "\\\\", "n", "\"\"\"", "\\\\", "n", "\\\\", "n", "'_", "%_", "(_", "name_", ",_", "pretty_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "Pret", "ty", "Values_", "(_", "self_", ",_", "a", "Pret", "ty_", ",_", "b", "Pret", "ty_", ",_", "tolerance_", "=_", "0.01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "a", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "b", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "a", "List_", ")_", "!=_", "len_", "(_", "b", "List_", ")_", ":_", "\\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_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "a", "List_", ",_", "b", "List_", ")_", ":_", "\\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 ", " _", "a", "Num_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "Num_", "=_", "float_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "error", " ", "=", " ", "abs", "((", "a", "Num", " ", "-", " ", "b", "Num", ")", " ", "/", " ", "((", "a", "Num", " ", "+", " ", "b", "Num", ")", " ", "/", " ", "2.0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "abs_", "(_", "a", "Num_", "-_", "b", "Num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", ">_", "tolerance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "._", "strip_", "(_", ")_", "!=_", "b_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Approx", "imat", "e", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Pret", "ty", "Values_", "(_", "self_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "pretty_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "QL", "earn", "ing", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discount_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "discou", "nt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "noise", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Noise_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "noise", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "living", "Reward", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Liv", "ing", "Reward", "_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "living", "Reward", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "=_", "grid", "world_", "._", "Grid", "world", "Environment_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "eps", "ilon", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "learn", "ing", "Rate_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "learn", "ing", "Rat", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opts_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "Fn", "'_", ":_", "self_", "._", "env_", "._", "get", "Poss", "ibl", "e", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eps", "ilon", "'_", ":_", "self_", "._", "epsilon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gamma", "'_", ":_", "self_", "._", "discount_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alpha", "'_", ":_", "self_", "._", "learn", "ing", "Rate_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Experience", "s_", "=_", "int_", "(_", "test", "Dict_", "[_", "'", "num", "Experience", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Pre", "Experience", "s_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nums", "Experience", "s", "For", "Display_", "=_", "range_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "(_", "num", "Experience", "s_", ",_", "max", "Pre", "Experience", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test", "Out", "File_", "=_", "test", "Dict_", "[_", "'", "test\\u", "out", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "Pre", "Experience", "s_", "<_", "num", "Experience", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nums", "Experience", "s", "For", "Display_", "._", "append_", "(_", "num", "Experience", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "write", "Fail", "ure", "File_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "test", "Out", "File_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "test", "Out", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "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_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "Output", "File", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "nums", "Experience", "s", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Value", "s", "And", "Policy_", "=_", "(_", "n_", "==_", "self_", "._", "nums", "Experience", "s", "For", "Display_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "=_", "self_", "._", "execute", "NE", "xpe", "rien", "ces_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ",_", "n_", ",_", "check", "Value", "s", "And", "Policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "Std", "String_", "+=_", "std", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "Output", "File", "String_", "+=_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "test", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "fail", "ure", "Output", "Std", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "For", " ", "more", " ", "deta", "il", "s", " ", "to", " ", "help", " ", "you", " ", "debug", ",", " ", "see", " ", "test", " ", "output", " ", "file", " ", "%", "s", "\\\\", "n", "\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "test", "Out", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "Fail", "ure", "File_", "(_", "fail", "ure", "Output", "File", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "remove", "Fail", "ure", "File", "If", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "NE", "xpe", "rien", "ces_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", ",_", "n_", ",_", "check", "Value", "s", "And", "Policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "policy", "Pret", "ty_", ",_", "last", "Experience", "_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "=_", "\"====", "==============", "==", " ", "Iterat", "ion", " ", "%", "d", " ", "==============", "=====", "=\\\\", "n", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "Experience", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Agent", " ", "observe", "d", " ", "the", " ", "transiti", "on", " ", "(", "start", "State", " ", "=", " ", "%", "s", ",", " ", "action", " ", "=", " ", "%", "s", ",", " ", "end", "State", " ", "=", " ", "%", "s", ",", " ", "reward", " ", "=", " ", "%", "f", ")\\\\", "n", "\\\\", "n", "\\\\", "n", "\"_", "%_", "last", "Experience", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Key_", "=_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "(_", "n_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "q", "Values_", ",_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Out", "String_", "+=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "'%", "s", "'", " ", "are", " ", "correct", ".\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", "/", "correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Q", "-", "Value", "s", " ", "at", " ", "iterati", "on", " ", "%", "d", " ", "for", " ", "action", " ", "'%", "s", "'", " ", "are", " ", "NOT", " ", "correct", ".\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "q", "Value", "s", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "q", "Value", "s", "Key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "check", "Value", "s", "And", "Policy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "values", "Pret", "ty_", ",_", "solut", "ion", "Dict_", "[_", "'", "values", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Value", "s", " ", "are", " ", "NOT", " ", "correct", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "'", "values", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "compare", "Pret", "ty", "Values_", "(_", "policy", "Pret", "ty_", ",_", "solut", "ion", "Dict_", "[_", "'", "policy", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "=_", "\"", "Polic", "y", " ", "is", " ", "NOT", " ", "correct", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "String_", "+=_", "\"", " ", " ", " ", "Correct", " ", "solut", "ion", ":\\\\", "n", "\\\\", "t", "%", "s", "\"_", "%_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solut", "ion", "Dict_", "[_", "'", "policy", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Out", "String_", "+=_", "out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "test", "Pass_", ",_", "std", "Out", "String_", ",_", "file", "Out", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values", "Pret", "ty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "Pret", "ty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "self_", "._", "nums", "Experience", "s", "For", "Display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "policy", "Pret", "ty_", ",_", "\\u_", "=_", "self_", "._", "run", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module", "Dict_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "q", "\\u", "values", "\\u", "k", "\\u", "%", "d\\u", "action", "\\u", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n_", ",_", "action_", ")_", ",_", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values", "Pret", "ty_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pretty", "Value", "Solut", "ion", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "Pret", "ty_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Agent_", "(_", "self_", ",_", "module", "Dict_", ",_", "num", "Experience", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "module", "Dict_", "[_", "'", "ql", "earn", "ing", "Agent", "s", "'_", "]_", "._", "QL", "earn", "ing", "Agent_", "(_", "**_", "self_", "._", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "sorted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "(_", "lambda_", "state_", ":_", "len_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", ")_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "Obj_", "=_", "Fix", "ed", "Random_", "(_", ")_", "._", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "choose", " ", "a", " ", "random", " ", "start", " ", "state", " ", "and", " ", "a", " ", "random", " ", "possib", "le", " ", "action", " ", "from", " ", "tha", "t", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "next", " ", "state", " ", "and", " ", "reward", " ", "from", " ", "the", " ", "transiti", "on", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "last", "Experience", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Experience", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "State_", "=_", "rand", "Obj_", "._", "choice_", "(_", "states_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "rand", "Obj_", "._", "choice_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "start", "State_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "end", "State_", ",_", "reward_", ")_", "=_", "self_", "._", "env_", "._", "get", "Random", "Ne", "xt", "State_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "start", "State_", ",_", "action_", ",_", "rand", "Obj_", "=_", "rand", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "Experience", "_", "=_", "(_", "start", "State_", ",_", "action_", ",_", "end", "State_", ",_", "reward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agent_", "._", "update_", "(_", "*_", "last", "Experience", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actions_", "=_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce_", "(_", "lambda_", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b_", ":_", "set_", "(_", "a_", ")_", "._", "union_", "(_", "b_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "for_", "state_", "in_", "states_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "state_", "]_", "=_", "agent_", "._", "compute", "Value", "Fro", "m", "QV", "alues", "_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "[_", "state_", "]_", "=_", "agent_", "._", "compute", "Action", "Fro", "m", "QV", "alues", "_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "Actions_", "=_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "not_", "in_", "q", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "in_", "possib", "le", "Actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "[_", "state_", "]_", "=_", "agent_", "._", "get", "QV", "alue_", "(_", "state_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q", "Values_", "[_", "action_", "]_", "[_", "state_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values", "Pret", "ty_", "=_", "self_", "._", "pretty", "Values_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "Pret", "ty_", "=_", "self_", "._", "pretty", "Policy_", "(_", "policy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q", "Value", "s", "Pret", "ty_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q", "Value", "s", "Pret", "ty_", "[_", "action_", "]_", "=_", "self_", "._", "pretty", "Values_", "(_", "q", "Values_", "[_", "action_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "values", "Pret", "ty_", ",_", "q", "Value", "s", "Pret", "ty_", ",_", "actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "Pret", "ty_", ",_", "last", "Experience", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Print_", "(_", "self_", ",_", "elements_", ",_", "format", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pretty_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "yb", "ar_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "self_", "._", "grid_", "._", "grid_", "._", "height_", "-_", "1_", "-_", "yb", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "x_", ",_", "y_", ")_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "'", " ", " ", " ", "ille", "gal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "._", "append_", "(_", "format", "String_", "._", "format_", "(_", "elements_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", ")_", ")_", "\\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 ", " ", "_", "row_", "._", "append_", "(_", "'\\u'_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'", " ", " ", " ", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\"", " ", " ", " ", "\"_", "._", "join_", "(_", "row_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pretty_", "+=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Values_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "values_", ",_", "'{", "0", ":", "10.", "4f", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Policy_", "(_", "self_", ",_", "policy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "pretty", "Print_", "(_", "policy_", ",_", "'{", "0", ":", "10", "s", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pretty", "Value", "Solut", "ion", "String_", "(_", "self_", ",_", "name_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", ":", " ", "\"\"\"", "\\\\", "n", "%", "s", "\\\\", "n", "\"\"\"", "\\\\", "n", "\\\\", "n", "'_", "%_", "(_", "name_", ",_", "pretty_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "Pret", "ty", "Values_", "(_", "self_", ",_", "a", "Pret", "ty_", ",_", "b", "Pret", "ty_", ",_", "tolerance_", "=_", "0.01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "a", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "List_", "=_", "self_", "._", "parse", "Pret", "ty", "Values_", "(_", "b", "Pret", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "a", "List_", ")_", "!=_", "len_", "(_", "b", "List_", ")_", ":_", "\\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_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "a", "List_", ",_", "b", "List_", ")_", ":_", "\\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 ", " _", "a", "Num_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "Num_", "=_", "float_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "error", " ", "=", " ", "abs", "((", "a", "Num", " ", "-", " ", "b", "Num", ")", " ", "/", " ", "((", "a", "Num", " ", "+", " ", "b", "Num", ")", " ", "/", " ", "2.0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "abs_", "(_", "a", "Num_", "-_", "b", "Num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", ">_", "tolerance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "._", "strip_", "(_", ")_", "!=_", "b_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QL", "earn", "ing", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Pret", "ty", "Values_", "(_", "self_", ",_", "pretty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "pretty_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "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_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Eps", "ilon", "Gree", "dy", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "discount_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "discou", "nt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "noise", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Noise_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "noise", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "living", "Reward", "'_", "in_", "test", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Liv", "ing", "Reward", "_", "(_", "float_", "(_", "test", "Dict_", "[_", "'", "living", "Reward", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "=_", "grid", "world_", "._", "Grid", "world", "Environment_", "(_", "self_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "eps", "ilon", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "learn", "ing", "Rate_", "=_", "float_", "(_", "test", "Dict_", "[_", "'", "learn", "ing", "Rat", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "Experience", "s_", "=_", "int_", "(_", "test", "Dict_", "[_", "'", "num", "Experience", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "Iterations", "_", "=_", "int_", "(_", "test", "Dict_", "[_", "'", "iterati", "ons", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opts_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "Fn", "'_", ":_", "self_", "._", "env_", "._", "get", "Poss", "ibl", "e", "Actions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eps", "ilon", "'_", ":_", "self_", "._", "epsilon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gamma", "'_", ":_", "self_", "._", "discount_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alpha", "'_", ":_", "self_", "._", "learn", "ing", "Rate_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "test", "Eps", "ilon", "Gree", "dy_", "(_", "module", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\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_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "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_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "'#", " ", "Thi", "s", " ", "is", " ", "the", " ", "solut", "ion", " ", "file", " ", "for", " ", "%", "s", ".\\\\", "n", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "'#", " ", "File", " ", "intent", "ional", "ly", " ", "blank", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Agent_", "(_", "self_", ",_", "module", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "module", "Dict_", "[_", "'", "ql", "earn", "ing", "Agent", "s", "'_", "]_", "._", "QL", "earn", "ing", "Agent_", "(_", "**_", "self_", "._", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "sorted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "(_", "lambda_", "state_", ":_", "len_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "state_", ")_", ")_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rand", "Obj_", "=_", "Fix", "ed", "Random_", "(_", ")_", "._", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "choose", " ", "a", " ", "random", " ", "start", " ", "state", " ", "and", " ", "a", " ", "random", " ", "possib", "le", " ", "action", " ", "from", " ", "tha", "t", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "next", " ", "state", " ", "and", " ", "reward", " ", "from", " ", "the", " ", "transiti", "on", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "num", "Experience", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "State_", "=_", "rand", "Obj_", "._", "choice_", "(_", "states_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "rand", "Obj_", "._", "choice_", "(_", "self_", "._", "grid_", "._", "get", "Poss", "ibl", "e", "Actions_", "(_", "start", "State_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "end", "State_", ",_", "reward_", ")_", "=_", "self_", "._", "env_", "._", "get", "Random", "Ne", "xt", "State_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "start", "State_", ",_", "action_", ",_", "rand", "Obj_", "=_", "rand", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "agent_", "._", "update_", "(_", "start", "State_", ",_", "action_", ",_", "end", "State_", ",_", "reward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eps", "ilon", "Gree", "dy", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Eps", "ilon", "Gree", "dy_", "(_", "self_", ",_", "module", "Dict_", ",_", "tolerance_", "=_", "0.025", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "self_", "._", "run", "Agent_", "(_", "module", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "self_", "._", "grid_", "._", "get", "States_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Legal", "Actions_", "=_", "len_", "(_", "agent_", "._", "get", "Legal", "Actions_", "(_", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "Legal", "Actions_", "<=_", "1_", ":_", "\\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_", "num", "Gree", "dy", "Choices_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "optim", "al", "Action_", "=_", "agent_", "._", "compute", "Action", "Fro", "m", "QV", "alues", "_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iteration_", "in_", "range_", "(_", "self_", "._", "num", "Iterations", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assume", " ", "tha", "t", " ", "thei", "r", " ", "compute", "Action", "Fro", "m", "QV", "alues", " ", "implementation", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", " ", "(", "q", "4", " ", "tests", " ", "this", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "agent_", "._", "get", "Action_", "(_", "state_", ")_", "==_", "optim", "al", "Action_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "num", "Gree", "dy", "Choices_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", " ", "=", " ", "eps", "ilon", ",", " ", "g", " ", "=", " ", "#", " ", "greedy", " ", "action", "s", ",", " ", "n", " ", "=", " ", "num", "Iterations", ",", " ", "k", " ", "=", " ", "num", "Legal", "Actions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", " ", "=", " ", "n", " ", "*", " ", "[(", "1", "-", "e", ")", " ", "+", " ", "e", "/", "k", "]", " ", "->", " ", "e", " ", "=", " ", "(", "n", " ", "-", " ", "g", ")", " ", "/", " ", "(", "n", " ", "-", " ", "n", "/", "k", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "empir", "ical", "Eps", "ilon", "Numer", "ator_", "=_", "self_", "._", "num", "Iterations", "_", "-_", "num", "Gree", "dy", "Choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empir", "ical", "Eps", "ilon", "Den", "omin", "ator_", "=_", "self_", "._", "num", "Iterations", "_", "-_", "self_", "._", "num", "Iterations", "_", "/_", "float_", "(_", "num", "Legal", "Actions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empir", "ical", "Eps", "ilon", "_", "=_", "empir", "ical", "Eps", "ilon", "Numer", "ator_", "/_", "empir", "ical", "Eps", "ilon", "Den", "omin", "ator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "abs_", "(_", "empir", "ical", "Eps", "ilon", "_", "-_", "self_", "._", "epsilon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", ">_", "tolerance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Eps", "ilon", "-", "greedy", " ", "action", " ", "selection", " ", "is", " ", "not", " ", "correct", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Actual", " ", "eps", "ilon", " ", "=", " ", "%", "f", ";", " ", "student", " ", "empir", "ical", " ", "eps", "ilon", " ", "=", " ", "%", "f", ";", " ", "error", " ", "=", " ", "%", "f", " ", ">", " ", "tolera", "nce", " ", "=", " ", "%", "f", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "epsilon_", ",_", "empir", "ical", "Eps", "ilon", "_", ",_", "error_", ",_", "tolerance_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Quest", "ion", "6", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Quest", "ion", "6", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Quest", "ion", "6", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "ion", "6", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "student", "Solution_", "=_", "module", "Dict_", "[_", "'", "analys", "is", "'_", "]_", "._", "question", "6_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student", "Solution_", "=_", "str_", "(_", "student", "Solution_", ")_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hashed", "Solution_", "=_", "sha1_", "(_", "student", "Solution_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hashed", "Solution_", "==_", "'", "467", "2", "9c", "96", "bb", "1e", "408", "1f", "dc", "8", "1a", "8f", "f7", "4b", "3e", "5d", "b8", "fba", "415", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\"", "Solut", "ion", " ", "is", " ", "not", " ", "correct", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\"", " ", " ", " ", "Stud", "ent", " ", "solut", "ion", ":", " ", "%", "s", "\"_", "%_", "(_", "student", "Solution_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quest", "ion", "6", "Test_", "(_", "test", "Classes_", "._", "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_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "=_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "'#", " ", "Thi", "s", " ", "is", " ", "the", " ", "solut", "ion", " ", "file", " ", "for", " ", "%", "s", ".\\\\", "n", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "'#", " ", "File", " ", "intent", "ional", "ly", " ", "blank", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Eval", "Agent", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Eval", "Agent", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Eval", "Agent", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pac", "man", "Params_", "=_", "test", "Dict_", "[_", "'", "pac", "man", "Param", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "score", "Minimum_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Dict_", "[_", "'", "score", "Mini", "mum", "'_", "]_", ")_", "if_", "'", "score", "Mini", "mum", "'_", "in_", "test", "Dict_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "non", "Time", "out", "Minimum_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Dict_", "[_", "'", "non", "Time", "out", "Mini", "mum", "'_", "]_", ")_", "if_", "'", "non", "Time", "out", "Mini", "mum", "'_", "in_", "test", "Dict_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wins", "Minimum_", "=_", "int_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Dict_", "[_", "'", "wins", "Mini", "mum", "'_", "]_", ")_", "if_", "'", "wins", "Mini", "mum", "'_", "in_", "test", "Dict_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "score", "Thresh", "olds", "_", "=_", "[_", "int_", "(_", "s_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "test", "Dict_", "._", "get_", "(_", "'", "score", "Thresh", "olds", "'_", ",_", "''_", ")_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "non", "Time", "out", "Thresh", "olds", "_", "=_", "[_", "int_", "(_", "s_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "test", "Dict_", "._", "get_", "(_", "'", "non", "Time", "out", "Thresh", "olds", "'_", ",_", "''_", ")_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wins", "Thresh", "olds", "_", "=_", "[_", "int_", "(_", "s_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "test", "Dict_", "._", "get_", "(_", "'", "wins", "Thresh", "olds", "'_", ",_", "''_", ")_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "max", "Points_", "=_", "sum_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "len_", "(_", "t_", ")_", "for_", "t_", "in_", "[_", "self_", "._", "score", "Thresh", "olds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "non", "Time", "out", "Thresh", "olds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wins", "Thresh", "olds", "_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eval", "Agent", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Grad", "ing", " ", "agent", " ", "usi", "ng", " ", "command", ":", " ", " ", "python", " ", "pac", "man", ".", "py", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "pac", "man", "Params_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "games_", "=_", "pac", "man_", "._", "run", "Game", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "pac", "man_", "._", "read", "Command_", "(_", "self_", "._", "pac", "man", "Params_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Game", "s_", "=_", "len_", "(_", "games_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "total", "Time_", ",_", "'", "wins", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "g_", "._", "state_", "._", "is", "Win_", "(_", ")_", "for_", "g_", "in_", "games_", "]_", "._", "count_", "(_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "games", "'_", ":_", "games_", ",_", "'", "score", "s", "'_", ":_", "[_", "g_", "._", "state_", "._", "get", "Score_", "(_", ")_", "for_", "g_", "in_", "games_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timeouts", "'_", ":_", "[_", "g_", "._", "agent", "Timeout_", "for_", "g_", "in_", "games_", "]_", "._", "count_", "(_", "True_", ")_", ",_", "'", "crashes", "'_", ":_", "[_", "g_", "._", "agent", "Cra", "shed", "_", "for_", "g_", "in_", "games_", "]_", "._", "count_", "(_", "True_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "averag", "e", "Score_", "=_", "sum_", "(_", "stats_", "[_", "'", "score", "s", "'_", "]_", ")_", "/_", "float_", "(_", "len_", "(_", "stats_", "[_", "'", "score", "s", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "Time", "outs_", "=_", "num", "Game", "s_", "-_", "stats_", "[_", "'", "timeouts", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wins_", "=_", "stats_", "[_", "'", "wins", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "grade", "Threshold_", "(_", "value_", ",_", "minimum_", ",_", "thresholds_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "passed_", "=_", "(_", "minimum_", "is_", "None_", ")_", "or_", "(_", "value_", ">=_", "minimum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "passed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", "in_", "thresholds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "value_", ">=_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "points_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "passed_", ",_", "points_", ",_", "value_", ",_", "minimum_", ",_", "thresholds_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "grade", "Threshold_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "averag", "e", "Score_", ",_", "self_", "._", "score", "Minimum_", ",_", "self_", "._", "score", "Thresh", "olds", "_", ",_", "\"", "averag", "e", " ", "score", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "grade", "Threshold_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "non", "Time", "outs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "non", "Time", "out", "Minimum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "non", "Time", "out", "Thresh", "olds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "games", " ", "not", " ", "timed", " ", "out", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "grade", "Threshold_", "(_", "wins_", ",_", "self_", "._", "wins", "Minimum_", ",_", "self_", "._", "wins", "Thresh", "olds", "_", ",_", "\"", "wins", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total", "Points_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "passed_", ",_", "points_", ",_", "value_", ",_", "minimum_", ",_", "thresholds_", ",_", "name_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "minimum_", "is_", "None_", "and_", "len_", "(_", "thresholds_", ")_", "==_", "0_", ":_", "\\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_", "#", " ", "print", " ", "pass", "ed", ",", " ", "points", ",", " ", "value", ",", " ", "minim", "um", ",", " ", "threshol", "ds", ",", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "Points_", "+=_", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "passed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "points_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "%", "s", " ", "(", "fail", ":", " ", "belo", "w", " ", "minim", "um", " ", "value", " ", "%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "value_", ",_", "name_", ",_", "minimum_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "%", "s", " ", "(%", "s", " ", "of", " ", "%", "s", " ", "points", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "value_", ",_", "name_", ",_", "points_", ",_", "len_", "(_", "thresholds_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "minimum_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\"", " ", " ", " ", " ", "Grad", "ing", " ", "sche", "me", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\"", " ", "<", " ", "%", "s", ":", " ", " ", "fail", "\"_", "%_", "(_", "minimum_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "thresholds_", ")_", "==_", "0_", "or_", "minimum_", "!=_", "thresholds_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "Message_", "(_", "\"", " ", " ", " ", " ", ">=", " ", "%", "s", ":", " ", " ", "0", " ", "points", "\"_", "%_", "(_", "minimum_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "idx_", ",_", "threshold_", "in_", "enumerate_", "(_", "thresholds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", ">=", " ", "%", "s", ":", " ", " ", "%", "s", " ", "points", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "threshold_", ",_", "idx_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "thresholds_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\"", " ", " ", " ", " ", "Grad", "ing", " ", "sche", "me", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\"", " ", "<", " ", "%", "s", ":", " ", " ", "0", " ", "points", "\"_", "%_", "(_", "thresholds_", "[_", "0_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "threshold_", "in_", "enumerate_", "(_", "thresholds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", ">=", " ", "%", "s", ":", " ", " ", "%", "s", " ", "points", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "threshold_", ",_", "idx_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "any_", "(_", "[_", "not_", "passed_", "for_", "passed_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", "in_", "results_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "Points_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "test", "Parti", "al_", "(_", "grades", "_", ",_", "total", "Points_", ",_", "self_", "._", "max", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Eval", "Agent", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "'#", " ", "Thi", "s", " ", "is", " ", "the", " ", "solut", "ion", " ", "file", " ", "for", " ", "%", "s", ".\\\\", "n", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "'#", " ", "File", " ", "intent", "ional", "ly", " ", "blank", ".\\\\", "n", "'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "follow", "Path_", "(_", "policy_", ",_", "start_", ",_", "num", "Steps_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "not_", "in_", "policy_", ":_", "\\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_", "action_", "=_", "policy_", "[_", "state_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "._", "append_", "(_", "\"(", "%", "s", ",%", "s", ")\"_", "%_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "==_", "'", "north", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", ",_", "state_", "[_", "1_", "]_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "south", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", ",_", "state_", "[_", "1_", "]_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "east", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", "+_", "1_", ",_", "state_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "west", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "State_", "=_", "state_", "[_", "0_", "]_", "-_", "1_", ",_", "state_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "'", "exit", "'_", "or_", "action_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "._", "append_", "(_", "'", "TERM", "INAL", "\\u", "STATE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "=_", "next", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "def_", "parse", "Grid_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "[_", "[_", "entry_", "._", "strip_", "(_", ")_", "for_", "entry_", "in_", "line_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "string_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", ",_", "col_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\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 ", " _", "col_", "=_", "int_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "\"\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "[_", "x_", "]_", "=_", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "grid", "world_", "._", "make", "Grid_", "(_", "grid_", ")_", "\\u\\u\\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_", "compute", "Policy_", "(_", "module", "Dict_", ",_", "grid_", ",_", "discount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "Iterator_", "=_", "module", "Dict_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "Iterat", "ion", "Agent", "s", "'_", "]_", "._", "Value", "Iterat", "ion", "Agent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "discount_", "=_", "discount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "grid_", "._", "get", "States_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy_", "[_", "state_", "]_", "=_", "value", "Iterator_", "._", "compute", "Action", "Fro", "m", "Values_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "policy_", "\\u\\u\\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_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\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_", ",_", "question_", ",_", "test", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Grid", "Polic", "y", "Test_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "question_", ",_", "test", "Dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Function", " ", "in", " ", "module", " ", "in", " ", "analys", "is", " ", "tha", "t", " ", "return", "s", " ", "(", "discou", "nt", ",", " ", "noise", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parameter", "Fn_", "=_", "test", "Dict_", "[_", "'", "parameter", "Fn", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "question", "2_", "=_", "test", "Dict_", "._", "get_", "(_", "'", "question", "2", "'_", ",_", "'", "fal", "se", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grid", "Wor", "ld", " ", "specification_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", " ", "is", " ", "empty", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "numbers", " ", "are", " ", "termina", "l", " ", "state", "s", " ", "with", " ", "tha", "t", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "a", " ", "wall_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "S", " ", "is", " ", "a", " ", "start", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid", "Text_", "=_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "grid", "world_", "._", "Grid", "world_", "(_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "grid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid", "Name_", "=_", "test", "Dict_", "[_", "'", "grid", "Name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Polic", "y", " ", "specification_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", " ", " ", " ", " ", " ", " ", "policy", " ", "choice", " ", "not", " ", "checked_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "N", ",", " ", "E", ",", " ", "S", ",", " ", "W", " ", "policy", " ", "action", " ", "must", " ", "be", " ", "north", ",", " ", "east", ",", " ", "south", ",", " ", "west", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "policy_", "=_", "parse", "Grid_", "(_", "test", "Dict_", "[_", "'", "policy", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "State", " ", "the", " ", "most", " ", "probab", "le", " ", "path", " ", "must", " ", "visit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "x", ",", "y", ")", " ", "for", " ", "a", " ", "partic", "ular", " ", "location", ";", " ", "(", "0", ",", "0", ")", " ", "is", " ", "bottom", " ", "left_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "termina", "l", " ", "for", " ", "the", " ", "termina", "l", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "path", "Visit", "s_", "=_", "test", "Dict_", "._", "get_", "(_", "'", "path", "Visit", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "State", " ", "the", " ", "most", " ", "probab", "le", " ", "path", " ", "must", " ", "not", " ", "visit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "x", ",", "y", ")", " ", "for", " ", "a", " ", "partic", "ular", " ", "location", ";", " ", "(", "0", ",", "0", ")", " ", "is", " ", "bottom", " ", "left_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "termina", "l", " ", "for", " ", "the", " ", "termina", "l", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "path", "Not", "Visit", "s_", "=_", "test", "Dict_", "._", "get_", "(_", "'", "path", "Not", "Visit", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "grades", "_", ",_", "module", "Dict_", ",_", "solut", "ion", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "module", "Dict_", "[_", "'", "analys", "is", "'_", "]_", ",_", "self_", "._", "parameter", "Fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meth", "od", " ", "not", " ", "implemented", ":", " ", "analys", "is", ".", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parameter", "Fn_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "getattr_", "(_", "module", "Dict_", "[_", "'", "analys", "is", "'_", "]_", ",_", "self_", "._", "parameter", "Fn_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "str_", ")_", "and_", "result_", "._", "lower_", "(_", ")_", "[_", "0_", ":_", "3_", "]_", "==_", "\"", "not", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "'", "Actual", "ly", ",", " ", "it", " ", "is", " ", "possib", "le", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "question", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "living", "Reward", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "discount_", ",_", "noise_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "discount_", "=_", "float_", "(_", "discount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noise_", "=_", "float_", "(_", "noise_", ")_", "\\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_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Di", "d", " ", "not", " ", "return", " ", "a", " ", "(", "discou", "nt", ",", " ", "noise", ")", " ", "pair", ";", " ", "inst", "ead", " ", "analys", "is", ".", "%", "s", " ", "return", "ed", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parameter", "Fn_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "discount_", "!=_", "0.9_", "and_", "noise_", "!=_", "0.2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mus", "t", " ", "change", " ", "eit", "her", " ", "the", " ", "discou", "nt", " ", "or", " ", "the", " ", "noise", ",", " ", "not", " ", "bot", "h", ".", " ", "Return", "ed", " ", "(", "discou", "nt", ",", " ", "noise", ")", " ", "=", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "result_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\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 ", " _", "discount_", ",_", "noise_", ",_", "living", "Reward", "_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "discount_", "=_", "float_", "(_", "discount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noise_", "=_", "float_", "(_", "noise_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "living", "Reward", "_", "=_", "float_", "(_", "living", "Reward", "_", ")_", "\\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_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Di", "d", " ", "not", " ", "return", " ", "a", " ", "(", "discou", "nt", ",", " ", "noise", ",", " ", "living", " ", "reward", ")", " ", "triple", ";", " ", "inst", "ead", " ", "analys", "is", ".", "%", "s", " ", "return", "ed", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "parameter", "Fn_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\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_", "._", "grid_", "._", "set", "Noise_", "(_", "noise_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "living", "Reward", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "Liv", "ing", "Reward", "_", "(_", "living", "Reward", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "=_", "self_", "._", "grid_", "._", "get", "Start", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "compute", "Policy_", "(_", "module", "Dict_", ",_", "self_", "._", "grid_", ",_", "discount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "policy_", "\\u\\u\\uNL\\u\\u\\u_", "action", "Map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "N", "'_", ":_", "'", "north", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "E", "'_", ":_", "'", "east", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "S", "'_", ":_", "'", "south", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "W", "'_", ":_", "'", "west", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "'_", ":_", "'", "exit", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", ",_", "height_", "=_", "self_", "._", "policy_", "._", "width_", ",_", "self_", "._", "policy_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "Passe", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "range_", "(_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "policy_", "[_", "x_", "]_", "[_", "y_", "]_", "in_", "action", "Map_", "and_", "policy_", "[_", "(_", "x_", ",_", "y_", ")_", "]_", "!=_", "action", "Map_", "[_", "self_", "._", "policy_", "[_", "x_", "]_", "[_", "y_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "differ", "Point_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "Passe", "d_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "policy", "Passe", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "'", "Polic", "y", " ", "not", " ", "correct", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "Stud", "ent", " ", "policy", " ", "at", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "differ", "Point_", ",_", "policy_", "[_", "differ", "Point_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "Correct", " ", "policy", " ", "at", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "differ", "Point_", ",_", "action", "Map_", "[_", "self_", "._", "policy_", "[_", "differ", "Point_", "[_", "0_", "]_", "]_", "[_", "differ", "Point_", "[_", "1_", "]_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "Stud", "ent", " ", "policy", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Policy_", "(_", "policy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "Legend", ":", " ", " ", "N", ",", "S", ",", "E", ",", "W", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "move", " ", "north", " ", "etc", ",", " ", "X", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "exit", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", " ", ".", " ", "at", " ", "state", "s", " ", "where", " ", "the", " ", "policy", " ", "is", " ", "not", " ", "defin", "ed", " ", "(", "e", ".", "g", ".", " ", "walls", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "Correct", " ", "policy", " ", "specifica", "tion", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Policy_", "(_", "self_", "._", "policy_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "Legend", ":", " ", " ", "N", ",", "S", ",", "E", ",", "W", " ", "for", " ", "state", "s", " ", "in", " ", "whi", "ch", " ", "the", " ", "student", " ", "policy", " ", "must", " ", "move", " ", "north", " ", "etc", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", " ", "\\u", " ", "for", " ", "state", "s", " ", "where", " ", "it", " ", "doe", "sn", "'", "t", " ", "matte", "r", " ", "what", " ", "the", " ", "student", " ", "policy", " ", "doe", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Grid", "world_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "follow", "Path_", "(_", "policy_", ",_", "self_", "._", "grid_", "._", "get", "Start", "State_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "path", "Visit", "s_", "is_", "not_", "None_", "and_", "self_", "._", "path", "Visit", "s_", "not_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Polic", "y", " ", "doe", "s", " ", "not", " ", "visit", " ", "state", " ", "%", "s", " ", "whe", "n", " ", "movin", "g", " ", "with", "out", " ", "noise", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "path", "Visit", "s_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "State", "s", " ", "visit", "ed", ":", " ", "%", "s", "'_", "%_", "(_", "path_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "Stud", "ent", " ", "policy", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Policy_", "(_", "policy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "Legend", ":", " ", " ", "N", ",", "S", ",", "E", ",", "W", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "move", " ", "north", " ", "etc", ",", " ", "X", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "exit", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", " ", ".", " ", "at", " ", "state", "s", " ", "where", " ", "policy", " ", "not", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Grid", "world_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "path", "Not", "Visit", "s_", "is_", "not_", "None_", "and_", "self_", "._", "path", "Not", "Visit", "s_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Polic", "y", " ", "visits", " ", "state", " ", "%", "s", " ", "whe", "n", " ", "movin", "g", " ", "with", "out", " ", "noise", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "path", "Not", "Visit", "s_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "State", "s", " ", "visit", "ed", ":", " ", "%", "s", "'_", "%_", "(_", "path_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "Stud", "ent", " ", "policy", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Policy_", "(_", "policy_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "Legend", ":", " ", " ", "N", ",", "S", ",", "E", ",", "W", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "move", " ", "north", " ", "etc", ",", " ", "X", " ", "at", " ", "state", "s", " ", "whi", "ch", " ", "exit", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", " ", ".", " ", "at", " ", "state", "s", " ", "where", " ", "policy", " ", "not", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "print", "Grid", "world_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "test", "Fail_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "test", "Pass_", "(_", "grades", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "Grid", "world_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "'", " ", " ", " ", " ", "Grid", "world", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "self_", "._", "grid", "Text_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "'", " ", "'_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", " ", "Legend", ":", " ", "#", " ", "wall", ",", " ", "\\u", " ", "empty", ",", " ", "S", " ", "start", ",", " ", "numbers", " ", "termina", "l", " ", "state", "s", " ", "with", " ", "tha", "t", " ", "reward", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "Policy_", "(_", "self_", ",_", "policy_", ",_", "policy", "Type", "Is", "Grid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "policy", "Type", "Is", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "legend_", "=_", "{_", "'", "N", "'_", ":_", "'", "N", "'_", ",_", "'", "E", "'_", ":_", "'", "E", "'_", ",_", "'", "S", "'_", ":_", "'", "S", "'_", ",_", "'", "W", "'_", ":_", "'", "W", "'_", ",_", "'", " ", "'_", ":_", "'\\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 ", " _", "legend_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "north", "'_", ":_", "'", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "east", "'_", ":_", "'", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "south", "'_", ":_", "'", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "west", "'_", ":_", "'", "W", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exit", "'_", ":_", "'", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.'_", ":_", "'.'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", ":_", "'\\u'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "yb", "ar_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "self_", "._", "grid_", "._", "grid_", "._", "height_", "-_", "1_", "-_", "yb", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "policy", "Type", "Is", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", " ", " ", " ", " ", "\"_", "._", "join_", "(_", "[_", "legend_", "[_", "policy_", "[_", "x_", "]_", "[_", "y_", "]_", "]_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "width_", ")_", "]_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", " ", " ", " ", " ", "\"_", "._", "join_", "(_", "[_", "legend_", "[_", "policy_", "._", "get_", "(_", "(_", "x_", ",_", "y_", ")_", ",_", "'.'_", ")_", "]_", "for_", "x_", "in_", "range_", "(_", "self_", "._", "grid_", "._", "grid_", "._", "width_", ")_", "]_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "state", " ", "in", " ", "sorte", "d", "(", "self", ".", "grid", ".", "get", "State", "s", "())", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "state", " ", "!=", " ", "'", "TERM", "INAL", "\\u", "STATE", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "add", "Messag", "e", "('", " ", " ", "(%", "s", ",%", "s", ")", " ", "%", "s", "'", " ", "%", " ", "(", "state", "[", "0", "],", " ", "state", "[", "1", "],", " ", "policy", "[", "state", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Grid", "Polic", "y", "Test_", "(_", "test", "Classes_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Solution_", "(_", "self_", ",_", "module", "Dict_", ",_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Path_", ",_", "'", "w", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "write_", "(_", "'#", " ", "Thi", "s", " ", "is", " ", "the", " ", "solut", "ion", " ", "file", " ", "for", " ", "%", "s", ".\\\\", "n", "'_", "%_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "write_", "(_", "'#", " ", "File", " ", "intent", "ional", "ly", " ", "blank", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_" ]
[ 4, 4, 4, 4, 4, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fp7-ofelia/ocf/optin_manager/src/python/openflow/optin_manager/sfa/util/config.py
[ { "content": "#!/usr/bin/python\nimport sys\nimport os\nimport time\nimport ConfigParser\nimport tempfile\nimport codecs\nfrom StringIO import StringIO\nfrom openflow.optin_manager.sfa.util.xml import XML\ndefault_config = \\\n\"\"\"\n\"\"\"\n\n\n\n\nif __name__ == '__main__':\n filename = None\n print 'ahora'\n if len(sys.argv) > 1:\n\tprint 'entra'\n filename = sys.argv[1]\n config = Config(filename)\n else: \n\tprint 'no entra'\n config = Config()\n config.dump()\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def isbool(v):\n return v.lower() in (\"true\", \"false\")", "metadata": "root.isbool", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def str2bool(v):\n return v.lower() in (\"true\", \"1\") ", "metadata": "root.str2bool", "header": "['module', '___EOS___']", "index": 16 }, { "content": "class Config:\n \n# def __init__(self, config_file='/etc/sfa/sfa_config'):\n \n\n\n \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.Config", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self, config_file='/opt/ofelia/vt_manager/src/python/openflow.optin_manager/sfa/configs/config'):\n self._files = []\n self.config_path = os.path.dirname(config_file)\n self.config = ConfigParser.ConfigParser() \n self.filename = config_file\n if not os.path.isfile(self.filename):\n self.create(self.filename)\n self.load(self.filename)", "metadata": "root.Config.__init__", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 22 }, { "content": " def _header(self):\n header = \"\"\"\nDO NOT EDIT. This file was automatically generated at\n%s from:\n\n%s\n\"\"\" % (time.asctime(), os.linesep.join(self._files))\n\n # Get rid of the surrounding newlines\n return header.strip().split(os.linesep)", "metadata": "root.Config._header", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 32 }, { "content": " def create(self, filename):\n if not os.path.exists(os.path.dirname(filename)):\n os.makedirs(os.path.dirname(filename))\n configfile = open(filename, 'w')\n configfile.write(default_config)\n configfile.close()", "metadata": "root.Config.create", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 43 }, { "content": " def load(self, filename):\n if filename:\n try:\n self.config.read(filename)\n except ConfigParser.MissingSectionHeaderError:\n if filename.endswith('.xml'):\n self.load_xml(filename)\n else:\n self.load_shell(filename)\n self._files.append(filename)\n self.set_attributes()", "metadata": "root.Config.load", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 51 }, { "content": " def load_xml(self, filename):\n xml = XML(filename)\n categories = xml.xpath('//configuration/variables/category')\n for category in categories:\n section_name = category.get('id')\n if not self.config.has_section(section_name):\n self.config.add_section(section_name)\n options = category.xpath('./variablelist/variable')\n for option in options:\n option_name = option.get('id')\n value = option.xpath('./value')[0].text\n if not value:\n value = \"\"\n self.config.set(section_name, option_name, value)", "metadata": "root.Config.load_xml", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 63 }, { "content": " def load_shell(self, filename):\n f = open(filename, 'r')\n for line in f:\n try:\n if line.startswith('#'):\n continue\n parts = line.strip().split(\"=\")\n if len(parts) < 2:\n continue\n option = parts[0]\n value = parts[1].replace('\"', '').replace(\"'\",\"\")\n section, var = self.locate_varname(option, strict=False)\n if section and var:\n self.set(section, var, value)\n except:\n pass\n f.close() ", "metadata": "root.Config.load_shell", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 78 }, { "content": " def locate_varname(self, varname, strict=True):\n varname = varname.lower()\n sections = self.config.sections()\n section_name = \"\"\n var_name = \"\"\n for section in sections:\n if varname.startswith(section.lower()) and len(section) > len(section_name):\n section_name = section.lower()\n var_name = varname.replace(section_name, \"\")[1:]\n if strict and not self.config.has_option(section_name, var_name):\n raise ConfigParser.NoOptionError(var_name, section_name)\n return (section_name, var_name) ", "metadata": "root.Config.locate_varname", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 96 }, { "content": " def set_attributes(self):\n sections = self.config.sections()\n for section in sections:\n for item in self.config.items(section):\n name = \"%s_%s\" % (section, item[0])\n value = item[1]\n if isbool(value):\n value = str2bool(value)\n elif value.isdigit():\n value = int(value) \n setattr(self, name, value)\n setattr(self, name.upper(), value)", "metadata": "root.Config.set_attributes", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 109 }, { "content": " def variables(self):\n \"\"\"\n Return all variables.\n\n Returns:\n\n variables = { 'category_id': (category, variablelist) }\n\n category = { 'id': \"category_identifier\",\n 'name': \"Category name\",\n 'description': \"Category description\" }\n\n variablelist = { 'variable_id': variable }\n\n variable = { 'id': \"variable_identifier\",\n 'type': \"variable_type\",\n 'value': \"variable_value\",\n 'name': \"Variable name\",\n 'description': \"Variable description\" }\n \"\"\"\n\n variables = {}\n for section in self.config.sections():\n category = {\n 'id': section,\n 'name': section,\n 'description': section,\n }\n variable_list = {}\n for item in self.config.items(section):\n var_name = item[0] \n name = \"%s_%s\" % (section, var_name)\n value = item[1]\n if isbool(value):\n value_type = bool\n elif value.isdigit():\n value_type = int\n else:\n value_type = str\n variable = {\n 'id': var_name,\n 'type': value_type,\n 'value': value,\n 'name': name,\n 'description': name,\n }\n variable_list[name] = variable\n variables[section] = (category, variable_list)\n return variables ", "metadata": "root.Config.variables", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 122 }, { "content": " def verify(self, config1, config2, validate_method):\n return True", "metadata": "root.Config.verify", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 172 }, { "content": " def validate_type(self, var_type, value):\n return True", "metadata": "root.Config.validate_type", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 175 }, { "content": " @staticmethod\n def is_xml(config_file):\n try:\n x = Xml(config_file)\n return True \n except:\n return False", "metadata": "root.Config.is_xml", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 178 }, { "content": " @staticmethod\n def is_ini(config_file):\n try:\n c = ConfigParser.ConfigParser()\n c.read(config_file)\n return True\n except ConfigParser.MissingSectionHeaderError:\n return False", "metadata": "root.Config.is_ini", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 186 }, { "content": " def dump(self, sections = []):\n sys.stdout.write(output_python())", "metadata": "root.Config.dump", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 196 }, { "content": " def output_python(self, encoding = \"utf-8\"):\n buf = codecs.lookup(encoding)[3](StringIO())\n buf.writelines([\"# \" + line + os.linesep for line in self._header()]) \n \n for section in self.sections():\n buf.write(\"[%s]%s\" % (section, os.linesep))\n for (name,value) in self.items(section):\n buf.write(\"%s=%s%s\" % (name,value,os.linesep))\n buf.write(os.linesep)\n return buf.getvalue()", "metadata": "root.Config.output_python", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 199 }, { "content": " def output_shell(self, show_comments = True, encoding = \"utf-8\"):\n \"\"\"\n Return variables as a shell script.\n \"\"\"\n\n buf = codecs.lookup(encoding)[3](StringIO())\n buf.writelines([\"# \" + line + os.linesep for line in self._header()])\n\n for section in self.sections():\n for (name,value) in self.items(section):\n # bash does not have the concept of NULL\n if value:\n option = \"%s_%s\" % (section.upper(), name.upper())\n if isbool(value):\n value = str(str2bool(value))\n elif not value.isdigit():\n value = '\"%s\"' % value \n buf.write(option + \"=\" + value + os.linesep)\n return buf.getvalue() ", "metadata": "root.Config.output_shell", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 210 }, { "content": " def output_php(selfi, encoding = \"utf-8\"):\n \"\"\"\n Return variables as a PHP script.\n \"\"\"\n\n buf = codecs.lookup(encoding)[3](StringIO())\n buf.write(\"<?php\" + os.linesep)\n buf.writelines([\"// \" + line + os.linesep for line in self._header()])\n\n for section in self.sections():\n for (name,value) in self.items(section):\n option = \"%s_%s\" % (section, name)\n buf.write(os.linesep)\n buf.write(\"// \" + option + os.linesep)\n if value is None:\n value = 'NULL'\n buf.write(\"define('%s', %s);\" % (option, value) + os.linesep)\n\n buf.write(\"?>\" + os.linesep)\n\n return buf.getvalue() ", "metadata": "root.Config.output_php", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 230 }, { "content": " def output_xml(self, encoding = \"utf-8\"):\n pass", "metadata": "root.Config.output_xml", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 252 }, { "content": " def output_variables(self, encoding=\"utf-8\"):\n \"\"\"\n Return list of all variable names.\n \"\"\"\n\n buf = codecs.lookup(encoding)[3](StringIO())\n for section in self.sections():\n for (name,value) in self.items(section):\n option = \"%s_%s\" % (section,name) \n buf.write(option + os.linesep)\n\n return buf.getvalue()\n pass ", "metadata": "root.Config.output_variables", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 255 }, { "content": " def write(self, filename=None):\n if not filename:\n filename = self.filename\n configfile = open(filename, 'w') \n self.config.write(configfile)", "metadata": "root.Config.write", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 269 }, { "content": " def save(self, filename=None):\n self.write(filename)", "metadata": "root.Config.save", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 275 }, { "content": " def get_trustedroots_dir(self):\n return self.config_path + os.sep + 'trusted_roots'", "metadata": "root.Config.get_trustedroots_dir", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 279 }, { "content": " def get_openflow_aggrMgr_info(self):\n aggr_mgr_ip = 'localhost'\n if (hasattr(self,'openflow_aggregate_manager_ip')):\n aggr_mgr_ip = self.OPENFLOW_AGGREGATE_MANAGER_IP\n\n aggr_mgr_port = 2603\n if (hasattr(self,'openflow_aggregate_manager_port')):\n aggr_mgr_port = self.OPENFLOW_AGGREGATE_MANAGER_PORT\n\n return (aggr_mgr_ip,aggr_mgr_port)", "metadata": "root.Config.get_openflow_aggrMgr_info", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 282 }, { "content": " def get_interface_hrn(self):\n if (hasattr(self,'sfa_interface_hrn')):\n return self.SFA_INTERFACE_HRN\n else:\n return \"plc\"", "metadata": "root.Config.get_interface_hrn", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 293 }, { "content": " def __getattr__(self, attr):\n\tprint self.config.__dict__.keys()\n return getattr(self.config, attr)\n\t#print '----------------------------------------------------------------------------------------------------------',attr\n\t#return \"/var/lib/sfa\"", "metadata": "root.Config.__getattr__", "header": "['class', 'Config', ':', '___NEWLINE___', '___NL___', \"# def __init__(self, config_file='/etc/sfa/sfa_config'):\", '___NL___', '___EOS___']", "index": 299 } ]
[ { "span": "import tempfile", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openf", "low_", "._", "opti", "n", "\\u", "manager_", "._", "sfa", "_", "._", "util_", "._", "xml_", "import_", "XML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "config_", "=_", "\"\"\"", "\\", "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\\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 ", " _", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ah", "ora", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "print_", "'", "entr", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Config_", "(_", "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\t", "_", "print_", "'", "no", " ", "entr", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "dump_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "isb", "ool_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "._", "lower_", "(_", ")_", "in_", "(_", "\"", "true", "\"_", ",_", "\"", "fal", "se", "\"_", ")_", "\\u\\u\\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_", "str2", "bool_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "._", "lower_", "(_", ")_", "in_", "(_", "\"", "true", "\"_", ",_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config", "\\u", "file_", "=_", "'/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "openf", "low", ".", "opti", "n", "\\u", "manage", "r", "/", "sfa", "/", "configs", "/", "config", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "self_", "._", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "load_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "\"\"\"", "\\", "10", ";", "DO", " ", "NOT", " ", "EDIT", ".", " ", "Thi", "s", " ", "file", " ", "was", " ", "automati", "call", "y", " ", "generat", "ed", " ", "at", "\\", "10", ";", "%", "s", " ", "from", ":", "\\", "10", ";", "\\", "10", ";", "%", "s", "\\", "10", ";\"\"\"_", "%_", "(_", "time_", "._", "asc", "time_", "(_", ")_", ",_", "os_", "._", "linesep_", "._", "join_", "(_", "self_", "._", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "rid", " ", "of", " ", "the", " ", "surround", "ing", " ", "newlines_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "header_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "create_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "filename_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "configfile_", "=_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configfile_", "._", "write_", "(_", "default", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "load_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", ":_", "\\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_", "._", "config_", "._", "read_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Parser_", "._", "Missing", "Sect", "ion", "Head", "er", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filename_", "._", "endswith_", "(_", "'.", "xml", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "load", "\\u", "xml_", "(_", "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 ", " ", "_", "self_", "._", "load", "\\u", "shell_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "files_", "._", "append_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "load", "\\u", "xml_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "=_", "XML_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "categories_", "=_", "xml_", "._", "xpath_", "(_", "'//", "configura", "tion", "/", "variab", "les", "/", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "category_", "in_", "categories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "section", "\\u", "name_", "=_", "category_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "config_", "._", "has", "\\u", "section_", "(_", "section", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "add", "\\u", "section_", "(_", "section", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "=_", "category_", "._", "xpath_", "(_", "'./", "variab", "le", "list", "/", "variab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "option_", "in_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "\\u", "name_", "=_", "option_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "option_", "._", "xpath_", "(_", "'./", "value", "'_", ")_", "[_", "0_", "]_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "config_", "._", "set_", "(_", "section", "\\u", "name_", ",_", "option", "\\u", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "shell_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "f_", ":_", "\\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_", "line_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\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_", "parts_", "=_", "line_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"=\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "<_", "2_", ":_", "\\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_", "option_", "=_", "parts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "parts_", "[_", "1_", "]_", "._", "replace_", "(_", "'\"'_", ",_", "''_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", ",_", "var_", "=_", "self_", "._", "locat", "e\\u", "varname_", "(_", "option_", ",_", "strict_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "section_", "and_", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "set_", "(_", "section_", ",_", "var_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "locat", "e\\u", "varname_", "(_", "self_", ",_", "varname_", ",_", "strict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "varname_", "=_", "varname_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sections_", "=_", "self_", "._", "config_", "._", "sections_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "\\u", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "sections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "varname_", "._", "startswith_", "(_", "section_", "._", "lower_", "(_", ")_", ")_", "and_", "len_", "(_", "section_", ")_", ">_", "len_", "(_", "section", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "section", "\\u", "name_", "=_", "section_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "name_", "=_", "varname_", "._", "replace_", "(_", "section", "\\u", "name_", ",_", "\"\"_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "strict_", "and_", "not_", "self_", "._", "config_", "._", "has", "\\u", "option_", "(_", "section", "\\u", "name_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Config", "Parser_", "._", "No", "Optio", "n", "Error_", "(_", "var", "\\u", "name_", ",_", "section", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "section", "\\u", "name_", ",_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "set\\u", "attributes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sections_", "=_", "self_", "._", "config_", "._", "sections_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "sections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "self_", "._", "config_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "section_", ",_", "item_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "item_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isb", "ool_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "str2", "bool_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "name_", "._", "upper_", "(_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "variables_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "all", " ", "variab", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", " ", "=", " ", "{", " ", "'", "category", "\\u", "id", "':", " ", "(", "category", ",", " ", "variab", "le", "list", ")", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "category", " ", "=", " ", "{", " ", "'", "id", "':", " ", "\"", "category", "\\u", "identifi", "er", "\",", "\\", "10", ";", " ", " ", " ", "'", "name", "':", " ", "\"", "Cate", "gory", " ", "name", "\",", "\\", "10", ";", " ", " ", " ", "'", "description", "':", " ", "\"", "Cate", "gory", " ", "description", "\"", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "variab", "le", "list", " ", "=", " ", "{", " ", "'", "variab", "le", "\\u", "id", "':", " ", "variab", "le", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "variab", "le", " ", "=", " ", "{", " ", "'", "id", "':", " ", "\"", "variab", "le", "\\u", "identifi", "er", "\",", "\\", "10", ";", " ", " ", " ", "'", "type", "':", " ", "\"", "variab", "le", "\\u", "type", "\",", "\\", "10", ";", " ", " ", " ", "'", "value", "':", " ", "\"", "variab", "le", "\\u", "value", "\",", "\\", "10", ";", " ", " ", " ", "'", "name", "':", " ", "\"", "Varia", "ble", " ", "name", "\",", "\\", "10", ";", " ", " ", " ", "'", "description", "':", " ", "\"", "Varia", "ble", " ", "description", "\"", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "variables_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "config_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "section_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "section_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "section_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "list_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "config_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "\\u", "name_", "=_", "item_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "section_", ",_", "var", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "item_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isb", "ool_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value", "\\u", "type_", "=_", "bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value", "\\u", "type_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "variable_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "var", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "value", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "list_", "[_", "name_", "]_", "=_", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "variables_", "[_", "section_", "]_", "=_", "(_", "category_", ",_", "variab", "le", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "variables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "verify_", "(_", "self_", ",_", "config", "1_", ",_", "config", "2_", ",_", "validat", "e\\u", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "validat", "e\\u", "type_", "(_", "self_", ",_", "var", "\\u", "type_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "is", "\\u", "xml_", "(_", "config", "\\u", "file_", ")_", ":_", "\\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 ", " _", "x_", "=_", "Xml_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "ini_", "(_", "config", "\\u", "file_", ")_", ":_", "\\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 ", " _", "c_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "read_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Parser_", "._", "Missing", "Sect", "ion", "Head", "er", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "dump_", "(_", "self_", ",_", "sections_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "output", "\\u", "python_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "output", "\\u", "python_", "(_", "self_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "codecs_", "._", "lookup_", "(_", "encoding_", ")_", "[_", "3_", "]_", "(_", "String", "IO_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "writelines_", "(_", "[_", "\"#", " ", "\"_", "+_", "line_", "+_", "os_", "._", "linesep_", "for_", "line_", "in_", "self_", "._", "\\u", "header_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "write_", "(_", "\"[", "%", "s", "]%", "s", "\"_", "%_", "(_", "section_", ",_", "os_", "._", "linesep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "name_", ",_", "value_", ")_", "in_", "self_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "write_", "(_", "\"%", "s", "=", "%", "s", "%", "s", "\"_", "%_", "(_", "name_", ",_", "value_", ",_", "os_", "._", "linesep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "write_", "(_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "output", "\\u", "shell_", "(_", "self_", ",_", "show", "\\u", "comments_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "variab", "les", " ", "as", " ", "a", " ", "shell", " ", "script", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "=_", "codecs_", "._", "lookup_", "(_", "encoding_", ")_", "[_", "3_", "]_", "(_", "String", "IO_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "writelines_", "(_", "[_", "\"#", " ", "\"_", "+_", "line_", "+_", "os_", "._", "linesep_", "for_", "line_", "in_", "self_", "._", "\\u", "header_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "name_", ",_", "value_", ")_", "in_", "self_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bash", " ", "doe", "s", " ", "not", " ", "have", " ", "the", " ", "concept", " ", "of", " ", "NULL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "option_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "section_", "._", "upper_", "(_", ")_", ",_", "name_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isb", "ool_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "str_", "(_", "str2", "bool_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "value_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "'\"", "%", "s", "\"'_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "write_", "(_", "option_", "+_", "\"=\"_", "+_", "value_", "+_", "os_", "._", "linesep_", ")_", "\\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_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "output", "\\u", "php", "_", "(_", "self", "i_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "variab", "les", " ", "as", " ", "a", " ", "PH", "P", " ", "script", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "=_", "codecs_", "._", "lookup_", "(_", "encoding_", ")_", "[_", "3_", "]_", "(_", "String", "IO_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"<", "?", "php", "\"_", "+_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "writelines_", "(_", "[_", "\"//", " ", "\"_", "+_", "line_", "+_", "os_", "._", "linesep_", "for_", "line_", "in_", "self_", "._", "\\u", "header_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "name_", ",_", "value_", ")_", "in_", "self_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "section_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"//", " ", "\"_", "+_", "option_", "+_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "'", "NULL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"", "defin", "e", "('", "%", "s", "',", " ", "%", "s", ");\"_", "%_", "(_", "option_", ",_", "value_", ")_", "+_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"?", ">\"_", "+_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "output", "\\u", "xml_", "(_", "self_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "output", "\\u", "variables_", "(_", "self_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "list", " ", "of", " ", "all", " ", "variab", "le", " ", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "=_", "codecs_", "._", "lookup_", "(_", "encoding_", ")_", "[_", "3_", "]_", "(_", "String", "IO_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "name_", ",_", "value_", ")_", "in_", "self_", "._", "items_", "(_", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "section_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "option_", "+_", "os_", "._", "linesep_", ")_", "\\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_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "write_", "(_", "self_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "configfile_", "=_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "write_", "(_", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "save_", "(_", "self_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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", "trusted", "root", "s", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "config", "\\u", "path_", "+_", "os_", "._", "sep_", "+_", "'", "trusted", "\\u", "root", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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", "openf", "low", "\\u", "aggr", "Mgr", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggr", "\\u", "mgr", "\\u", "ip_", "=_", "'", "local", "host", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "hasattr_", "(_", "self_", ",_", "'", "openf", "low", "\\u", "aggre", "gate", "\\u", "manage", "r", "\\u", "ip", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggr", "\\u", "mgr", "\\u", "ip_", "=_", "self_", "._", "OPEN", "FLOW", "\\u", "AGG", "REG", "ATE", "\\u", "MANAGER", "\\u", "IP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aggr", "\\u", "mgr", "\\u", "port_", "=_", "260", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "hasattr_", "(_", "self_", ",_", "'", "openf", "low", "\\u", "aggre", "gate", "\\u", "manage", "r", "\\u", "port", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggr", "\\u", "mgr", "\\u", "port_", "=_", "self_", "._", "OPEN", "FLOW", "\\u", "AGG", "REG", "ATE", "\\u", "MANAGER", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "aggr", "\\u", "mgr", "\\u", "ip_", ",_", "aggr", "\\u", "mgr", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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", "interface", "\\u", "hr", "n_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "hasattr_", "(_", "self_", ",_", "'", "sfa", "\\u", "interface", "\\u", "hr", "n", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "SF", "A", "\\u", "INTERFACE", "\\u", "HR", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "plc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "config", "\\u", "file", "='", "/", "etc", "/", "sfa", "/", "sfa", "\\u", "config", "')", ":_", "\\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_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "print_", "self_", "._", "config_", "._", "\\u\\u", "dict\\u\\u_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getattr_", "(_", "self_", "._", "config_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "-'", ",", "attr_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "\"/", "var", "/", "lib", "/", "sfa", "\"_", "\\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, 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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
platformio/platformio/platformio/util.py
[ { "content": "def get_api_result(path, params=None, data=None, skipdns=False):\n import requests\n result = None\n r = None\n\n headers = get_request_defheaders()\n url = __apiurl__\n if skipdns:\n url = \"http://%s\" % __apiip__\n headers['host'] = __apiurl__[__apiurl__.index(\"://\")+3:]\n\n try:\n if data:\n r = requests.post(\n url + path, params=params, data=data, headers=headers)\n else:\n r = requests.get(url + path, params=params, headers=headers)\n r.raise_for_status()\n result = r.json()\n except requests.exceptions.HTTPError as e:\n if result and \"errors\" in result:\n raise exception.APIRequestError(result['errors'][0]['title'])\n else:\n raise exception.APIRequestError(e)\n except (requests.exceptions.ConnectionError,\n requests.exceptions.ConnectTimeout,\n requests.exceptions.ReadTimeout):\n if not skipdns:\n return get_api_result(path, params, data, skipdns=True)\n raise exception.APIRequestError(\n \"Could not connect to PlatformIO Registry Service. \"\n \"Please try later.\")\n except ValueError:\n raise exception.APIRequestError(\n \"Invalid response: %s\" % r.text.encode(\"utf-8\"))\n finally:\n if r:\n r.close()\n return result", "metadata": "root.get_api_result", "header": "['module', '___EOS___']", "index": 336 }, { "content": "def get_frameworks(type_=None):\n frameworks = _lookup_frameworks()\n\n if type_ is None:\n return frameworks\n else:\n if type_ not in frameworks:\n raise exception.UnknownFramework(type_)\n return frameworks[type_]\n\n return frameworks", "metadata": "root.get_frameworks", "header": "['module', '___EOS___']", "index": 429 } ]
[ { "span": "raise exception.APIRequestError(result['errors'][0]['title'])", "start_line": 357, "start_column": 12, "end_line": 357, "end_column": 73 }, { "span": "return frameworks", "start_line": 439, "start_column": 4, "end_line": 439, "end_column": 21 } ]
[]
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", "api", "\\u", "result_", "(_", "path_", ",_", "params_", "=_", "None_", ",_", "data_", "=_", "None_", ",_", "skip", "dns_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "get", "\\u", "request", "\\u", "def", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\\u\\u", "api", "url", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "skip", "dns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "%", "s", "\"_", "%_", "\\u\\u", "api", "ip", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "'", "host", "'_", "]_", "=_", "\\u\\u", "api", "url", "\\u\\u_", "[_", "\\u\\u", "api", "url", "\\u\\u_", "._", "index_", "(_", "\":", "//", "\"_", ")_", "+_", "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 ", " _", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "requests_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "+_", "path_", ",_", "params_", "=_", "params_", ",_", "data_", "=_", "data_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "requests_", "._", "get_", "(_", "url_", "+_", "path_", ",_", "params_", "=_", "params_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "._", "raise", "\\u", "for", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "r_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "requests_", "._", "exceptions_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "and_", "\"", "error", "s", "\"_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "API", "Request", "Error_", "(_", "result_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\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_", "._", "API", "Request", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "requests_", "._", "exceptions_", "._", "Connect", "ion", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "._", "exceptions_", "._", "Connect", "Timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "._", "exceptions_", "._", "Read", "Timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "skip", "dns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "api", "\\u", "result_", "(_", "path_", ",_", "params_", ",_", "data_", ",_", "skip", "dns_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "exception_", "._", "API", "Request", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "connect", " ", "to", " ", "Plat", "form", "IO", " ", "Regi", "stry", " ", "Service", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ple", "ase", " ", "try", " ", "late", "r", ".\"_", ")_", "\\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_", "exception_", "._", "API", "Request", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inva", "lid", " ", "response", ":", " ", "%", "s", "\"_", "%_", "r_", "._", "text_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "._", "close_", "(_", ")_", "\\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_", "def_", "get", "\\u", "frameworks", "_", "(_", "type\\u_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frameworks", "_", "=_", "\\u", "look", "up", "\\u", "frameworks", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type\\u_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "frameworks", "_", "\\u\\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_", "type\\u_", "not_", "in_", "frameworks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Un", "know", "n", "Framework_", "(_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "frameworks", "_", "[_", "type\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "frameworks", "_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2 ]
Unused import
numba/numba/numba/tests/__init__.py
[ { "content": "from numba import unittest_support as unittest\n\nimport gc\nfrom os.path import dirname, join\nimport multiprocessing\nimport sys\nimport time\nimport warnings\n\nfrom unittest.suite import TestSuite\nfrom numba.testing import load_testsuite\nfrom numba.testing import ddt # for backward compatibility\n\n\ntry:\n import faulthandler\nexcept ImportError:\n faulthandler = None\nelse:\n try:\n # May fail in IPython Notebook with UnsupportedOperation\n faulthandler.enable()\n except BaseException as e:\n msg = \"Failed to enable faulthandler due to:\\n{err}\"\n warnings.warn(msg.format(err=e))\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def load_tests(loader, tests, pattern):\n suite = TestSuite()\n suite.addTests(load_testsuite(loader, dirname(__file__)))\n # Numba CUDA tests are located in a separate directory:\n cuda_dir = join(dirname(dirname(__file__)), 'cuda/tests')\n suite.addTests(loader.discover(cuda_dir))\n return suite", "metadata": "root.load_tests", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "from numba import unittest_support as unittest", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 46 }, { "span": "import gc", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import multiprocessing", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 22 }, { "span": "import sys", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 }, { "span": "import time", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 }, { "span": "from numba.testing import ddt ", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "numba_", "import_", "unittest", "\\u", "support_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", ",_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "unittest_", "._", "suite_", "import_", "Test", "Suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "testing_", "import_", "load", "\\u", "testsuite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "testing_", "import_", "ddt_", "#", " ", "for", " ", "back", "ward", " ", "compatibility", "_", "\\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_", "fault", "handler_", "\\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 ", " _", "fault", "handler_", "=_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ma", "y", " ", "fail", " ", "in", " ", "IP", "yth", "on", " ", "Notebook", " ", "with", " ", "Unsu", "ppo", "rted", "Operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fault", "handler_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Fail", "ed", " ", "to", " ", "enable", " ", "fault", "handler", " ", "due", " ", "to", ":\\\\", "n", "{", "err", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "msg_", "._", "format_", "(_", "err_", "=_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "tests_", "(_", "loader_", ",_", "tests_", ",_", "pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Tests_", "(_", "load", "\\u", "testsuite_", "(_", "loader_", ",_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Num", "ba", " ", "CU", "DA", " ", "tests", " ", "are", " ", "located", " ", "in", " ", "a", " ", "separate", " ", "director", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "cud", "a", "\\u", "dir_", "=_", "join_", "(_", "dirname_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "cud", "a", "/", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Tests_", "(_", "loader_", "._", "discover_", "(_", "cud", "a", "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locals):\n \"\"\"Scan one logical line of Python and look up values of variables used.\"\"\"\n vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__\n for ttype, token, start, end, line in tokenize.generate_tokens(reader):\n if ttype == tokenize.NEWLINE: break\n if ttype == tokenize.NAME and token not in keyword.kwlist:\n if lasttoken == '.':\n if parent is not __UNDEF__:\n value = getattr(parent, token, __UNDEF__)\n vars.append((prefix + token, prefix, value))\n else:\n where, value = lookup(token, frame, locals)\n vars.append((token, where, value))\n elif token == '.':\n prefix += lasttoken + '.'\n parent = value\n else:\n parent, prefix = None, ''\n lasttoken = token\n return vars", "metadata": "root.scanvars", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def html(einfo, context=5):\n \"\"\"Return a nice HTML document describing a given traceback.\"\"\"\n etype, evalue, etb = einfo\n if type(etype) is types.ClassType:\n etype = etype.__name__\n pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable\n date = time.ctime(time.time())\n head = '<body bgcolor=\"#f0f0f8\">' + pydoc.html.heading(\n '<big><big>%s</big></big>' %\n strong(pydoc.html.escape(str(etype))),\n '#ffffff', '#6622aa', pyver + '<br>' + date) + '''\n<p>A problem occurred in a Python script. Here is the sequence of\nfunction calls leading up to the error, in the order they occurred.</p>'''\n\n indent = '<tt>' + small('&nbsp;' * 5) + '&nbsp;</tt>'\n frames = []\n records = inspect.getinnerframes(etb, context)\n for frame, file, lnum, func, lines, index in records:\n if file:\n file = os.path.abspath(file)\n link = '<a href=\"file://%s\">%s</a>' % (file, pydoc.html.escape(file))\n else:\n file = link = '?'\n args, varargs, varkw, locals = inspect.getargvalues(frame)\n call = ''\n if func != '?':\n call = 'in ' + strong(func) + \\\n inspect.formatargvalues(args, varargs, varkw, locals,\n formatvalue=lambda value: '=' + pydoc.html.repr(value))\n\n highlight = {}\n def reader(lnum=[lnum]):\n highlight[lnum[0]] = 1\n try: return linecache.getline(file, lnum[0])\n finally: lnum[0] += 1\n vars = scanvars(reader, frame, locals)\n\n rows = ['<tr><td bgcolor=\"#d8bbff\">%s%s %s</td></tr>' %\n ('<big>&nbsp;</big>', link, call)]\n if index is not None:\n i = lnum - index\n for line in lines:\n num = small('&nbsp;' * (5-len(str(i))) + str(i)) + '&nbsp;'\n if i in highlight:\n line = '<tt>=&gt;%s%s</tt>' % (num, pydoc.html.preformat(line))\n rows.append('<tr><td bgcolor=\"#ffccee\">%s</td></tr>' % line)\n else:\n line = '<tt>&nbsp;&nbsp;%s%s</tt>' % (num, pydoc.html.preformat(line))\n rows.append('<tr><td>%s</td></tr>' % grey(line))\n i += 1\n\n done, dump = {}, []\n for name, where, value in vars:\n if name in done: continue\n done[name] = 1\n if value is not __UNDEF__:\n if where in ('global', 'builtin'):\n name = ('<em>%s</em> ' % where) + strong(name)\n elif where == 'local':\n name = strong(name)\n else:\n name = where + strong(name.split('.')[-1])\n dump.append('%s&nbsp;= %s' % (name, pydoc.html.repr(value)))\n else:\n dump.append(name + ' <em>undefined</em>')\n\n rows.append('<tr><td>%s</td></tr>' % small(grey(', '.join(dump))))\n frames.append('''\n<table width=\"100%%\" cellspacing=0 cellpadding=0 border=0>\n%s</table>''' % '\\n'.join(rows))\n\n exception = ['<p>%s: %s' % (strong(pydoc.html.escape(str(etype))),\n pydoc.html.escape(str(evalue)))]\n if isinstance(evalue, BaseException):\n for name in dir(evalue):\n if name[:1] == '_': continue\n value = pydoc.html.repr(getattr(evalue, name))\n exception.append('\\n<br>%s%s&nbsp;=\\n%s' % (indent, name, value))\n\n return head + ''.join(frames) + ''.join(exception) + '''\n\n\n<!-- The above is a description of an error in a Python program, formatted\n for a Web browser because the 'cgitb' module was enabled. In case you\n are not reading this in a Web browser, here is the original traceback:\n\n%s\n-->\n''' % pydoc.html.escape(\n ''.join(traceback.format_exception(etype, evalue, etb)))", "metadata": "root.html", "header": "['module', '___EOS___']", "index": 101 }, { "content": "def text(einfo, context=5):\n \"\"\"Return a plain text document describing a given traceback.\"\"\"\n etype, evalue, etb = einfo\n if type(etype) is types.ClassType:\n etype = etype.__name__\n pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable\n date = time.ctime(time.time())\n head = \"%s\\n%s\\n%s\\n\" % (str(etype), pyver, date) + '''\nA problem occurred in a Python script. Here is the sequence of\nfunction calls leading up to the error, in the order they occurred.\n'''\n\n frames = []\n records = inspect.getinnerframes(etb, context)\n for frame, file, lnum, func, lines, index in records:\n file = file and os.path.abspath(file) or '?'\n args, varargs, varkw, locals = inspect.getargvalues(frame)\n call = ''\n if func != '?':\n call = 'in ' + func + \\\n inspect.formatargvalues(args, varargs, varkw, locals,\n formatvalue=lambda value: '=' + pydoc.text.repr(value))\n\n highlight = {}\n def reader(lnum=[lnum]):\n highlight[lnum[0]] = 1\n try: return linecache.getline(file, lnum[0])\n finally: lnum[0] += 1\n vars = scanvars(reader, frame, locals)\n\n rows = [' %s %s' % (file, call)]\n if index is not None:\n i = lnum - index\n for line in lines:\n num = '%5d ' % i\n rows.append(num+line.rstrip())\n i += 1\n\n done, dump = {}, []\n for name, where, value in vars:\n if name in done: continue\n done[name] = 1\n if value is not __UNDEF__:\n if where == 'global': name = 'global ' + name\n elif where != 'local': name = where + name.split('.')[-1]\n dump.append('%s = %s' % (name, pydoc.text.repr(value)))\n else:\n dump.append(name + ' undefined')\n\n rows.append('\\n'.join(dump))\n frames.append('\\n%s\\n' % '\\n'.join(rows))\n\n exception = ['%s: %s' % (str(etype), str(evalue))]\n if isinstance(evalue, BaseException):\n for name in dir(evalue):\n value = pydoc.text.repr(getattr(evalue, name))\n exception.append('\\n%s%s = %s' % (\" \"*4, name, value))\n\n return head + ''.join(frames) + ''.join(exception) + '''\n\nThe above is a description of an error in a Python program. Here is\nthe original traceback:\n\n%s\n''' % ''.join(traceback.format_exception(etype, evalue, etb))", "metadata": "root.text", "header": "['module', '___EOS___']", "index": 192 } ]
[ { "span": "parent is not __UNDEF__:", "start_line": 87, "start_column": 19, "end_line": 87, "end_column": 42 }, { "span": "value is not __UNDEF__:", "start_line": 156, "start_column": 15, "end_line": 156, "end_column": 37 }, { "span": "value is not __UNDEF__:", "start_line": 234, "start_column": 15, "end_line": 234, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scan", "vars_", "(_", "reader_", ",_", "frame_", ",_", "locals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sca", "n", " ", "one", " ", "logical", " ", "line", " ", "of", " ", "Pyth", "on", " ", "and", " ", "look", " ", "up", " ", "values", " ", "of", " ", "variab", "les", " ", "used", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", ",_", "last", "token_", ",_", "parent_", ",_", "prefix_", ",_", "value_", "=_", "[_", "]_", ",_", "None_", ",_", "None_", ",_", "''_", ",_", "\\u\\u", "UND", "EF", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ttype_", ",_", "token_", ",_", "start_", ",_", "end_", ",_", "line_", "in_", "tokenize_", "._", "generat", "e\\u", "tokens_", "(_", "reader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ttype_", "==_", "tokenize_", "._", "NEWLINE", "_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ttype_", "==_", "tokenize_", "._", "NAME_", "and_", "token_", "not_", "in_", "keyword_", "._", "kw", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "token_", "==_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parent_", "is_", "not_", "\\u\\u", "UND", "EF", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "getattr_", "(_", "parent_", ",_", "token_", ",_", "\\u\\u", "UND", "EF", "\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "._", "append_", "(_", "(_", "prefix_", "+_", "token_", ",_", "prefix_", ",_", "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 ", " _", "where_", ",_", "value_", "=_", "lookup_", "(_", "token_", ",_", "frame_", ",_", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "._", "append_", "(_", "(_", "token_", ",_", "where_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "token_", "==_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "+=_", "last", "token_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "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 ", " _", "parent_", ",_", "prefix_", "=_", "None_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "html_", "(_", "ein", "fo_", ",_", "context_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "nice", " ", "HTM", "L", " ", "document", " ", "descri", "bing", " ", "a", " ", "give", "n", " ", "traceback", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etype_", ",_", "evalue", "_", ",_", "et", "b_", "=_", "ein", "fo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "etype_", ")_", "is_", "types_", "._", "Class", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etype_", "=_", "etype_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyv", "er_", "=_", "'", "Pyth", "on", " ", "'_", "+_", "sys_", "._", "version_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "+_", "':", " ", "'_", "+_", "sys_", "._", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "time_", "._", "ctime_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "=_", "'<", "body", " ", "bg", "color", "=\"", "#", "f0", "f0", "f8", "\">'_", "+_", "pydo", "c_", "._", "html_", "._", "heading_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "big", "><", "big", ">", "%", "s", "</", "big", "><", "/", "big", ">'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "strong", "_", "(_", "pydo", "c_", "._", "html_", "._", "escape_", "(_", "str_", "(_", "etype_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", "ffffff", "'_", ",_", "'#", "662", "2a", "a", "'_", ",_", "pyv", "er_", "+_", "'<", "br", ">'_", "+_", "date_", ")_", "+_", "'''", "\\", "10", ";<", "p", ">", "A", " ", "problem", " ", "occur", "red", " ", "in", " ", "a", " ", "Pyth", "on", " ", "script", ".", " ", " ", "Her", "e", " ", "is", " ", "the", " ", "sequence", " ", "of", "\\", "10", ";", "function", " ", "calls", " ", "lead", "ing", " ", "up", " ", "to", " ", "the", " ", "error", ",", " ", "in", " ", "the", " ", "order", " ", "the", "y", " ", "occur", "red", ".", "</", "p", ">'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "indent_", "=_", "'<", "tt", ">'_", "+_", "small_", "(_", "'&", "nb", "sp", ";'_", "*_", "5_", ")_", "+_", "'&", "nb", "sp", ";<", "/", "tt", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "inspect_", "._", "getin", "ner", "frames_", "(_", "et", "b_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", ",_", "file_", ",_", "ln", "um_", ",_", "func_", ",_", "lines_", ",_", "index_", "in_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "'<", "a", " ", "href", "=\"", "file", "://", "%", "s", "\">", "%", "s", "</", "a", ">'_", "%_", "(_", "file_", ",_", "pydo", "c_", "._", "html_", "._", "escape_", "(_", "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 ", " _", "file_", "=_", "link_", "=_", "'?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", ",_", "varargs", "_", ",_", "var", "kw_", ",_", "locals_", "=_", "inspect_", "._", "geta", "rg", "values_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", "!=_", "'?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call_", "=_", "'", "in", " ", "'_", "+_", "strong", "_", "(_", "func_", ")_", "+_", "inspect_", "._", "format", "argv", "alues", "_", "(_", "args_", ",_", "varargs", "_", ",_", "var", "kw_", ",_", "locals_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format", "value_", "=_", "lambda_", "value_", ":_", "'='_", "+_", "pydo", "c_", "._", "html_", "._", "repr_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "highlight_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reader_", "(_", "ln", "um_", "=_", "[_", "ln", "um_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "highlight_", "[_", "ln", "um_", "[_", "0_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "return_", "linec", "ache_", "._", "getl", "ine_", "(_", "file_", ",_", "ln", "um_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "finally_", ":_", "ln", "um_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vars_", "=_", "scan", "vars_", "(_", "reader_", ",_", "frame_", ",_", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "[_", "'<", "tr", "><", "td", " ", "bg", "color", "=\"", "#", "d8", "bb", "ff", "\">", "%", "s", "%", "s", " ", "%", "s", "</", "td", "><", "/", "tr", ">'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'<", "big", ">", "&", "nb", "sp", ";<", "/", "big", ">'_", ",_", "link_", ",_", "call_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "ln", "um_", "-_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "small_", "(_", "'&", "nb", "sp", ";'_", "*_", "(_", "5_", "-_", "len_", "(_", "str_", "(_", "i_", ")_", ")_", ")_", "+_", "str_", "(_", "i_", ")_", ")_", "+_", "'&", "nb", "sp", ";'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "in_", "highlight_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "line_", "=_", "'<", "tt", ">=", "&", "gt", ";", "%", "s", "%", "s", "</", "tt", ">'_", "%_", "(_", "num_", ",_", "pydo", "c_", "._", "html_", "._", "pref", "ormat_", "(_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "'<", "tr", "><", "td", " ", "bg", "color", "=\"", "#", "ffc", "cee", "\">", "%", "s", "</", "td", "><", "/", "tr", ">'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "line_", "=_", "'<", "tt", ">", "&", "nb", "sp", ";", "&", "nb", "sp", ";", "%", "s", "%", "s", "</", "tt", ">'_", "%_", "(_", "num_", ",_", "pydo", "c_", "._", "html_", "._", "pref", "ormat_", "(_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "'<", "tr", "><", "td", ">", "%", "s", "</", "td", "><", "/", "tr", ">'_", "%_", "grey", "_", "(_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "done_", ",_", "dump_", "=_", "{_", "}_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "where_", ",_", "value_", "in_", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "done_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "done_", "[_", "name_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "\\u\\u", "UND", "EF", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "where_", "in_", "(_", "'", "global", "'_", ",_", "'", "bui", "lti", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "(_", "'<", "em", ">", "%", "s", "</", "em", ">", " ", "'_", "%_", "where_", ")_", "+_", "strong", "_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "where_", "==_", "'", "local", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "strong", "_", "(_", "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 ", " ", "_", "name_", "=_", "where_", "+_", "strong", "_", "(_", "name_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dump_", "._", "append_", "(_", "'%", "s", "&", "nb", "sp", ";", "=", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "pydo", "c_", "._", "html_", "._", "repr_", "(_", "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 ", " _", "dump_", "._", "append_", "(_", "name_", "+_", "'", " ", "<", "em", ">", "undefined", "</", "em", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rows_", "._", "append_", "(_", "'<", "tr", "><", "td", ">", "%", "s", "</", "td", "><", "/", "tr", ">'_", "%_", "small_", "(_", "grey", "_", "(_", "',", " ", "'_", "._", "join_", "(_", "dump_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frames_", "._", "append_", "(_", "'''", "\\", "10", ";<", "table", " ", "widt", "h", "=\"", "100", "%%", "\"", " ", "cells", "pacing", "=", "0", " ", "cellp", "addin", "g", "=", "0", " ", "border", "=", "0", ">", "\\", "10", ";", "%", "s", "</", "table", ">'''_", "%_", "'\\\\", "n", "'_", "._", "join_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exception_", "=_", "[_", "'<", "p", ">", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "strong", "_", "(_", "pydo", "c_", "._", "html_", "._", "escape_", "(_", "str_", "(_", "etype_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pydo", "c_", "._", "html_", "._", "escape_", "(_", "str_", "(_", "evalue", "_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "evalue", "_", ",_", "Base", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "dir_", "(_", "evalue", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "[_", ":_", "1_", "]_", "==_", "'\\u'_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "pydo", "c_", "._", "html_", "._", "repr_", "(_", "getattr_", "(_", "evalue", "_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exception_", "._", "append_", "(_", "'\\\\", "n", "<", "br", ">", "%", "s", "%", "s", "&", "nb", "sp", ";", "=\\\\", "n", "%", "s", "'_", "%_", "(_", "indent_", ",_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "head_", "+_", "''_", "._", "join_", "(_", "frames_", ")_", "+_", "''_", "._", "join_", "(_", "exception_", ")_", "+_", "'''", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";<", "!-", "-", " ", "The", " ", "above", " ", "is", " ", "a", " ", "description", " ", "of", " ", "an", " ", "error", " ", "in", " ", "a", " ", "Pyth", "on", " ", "program", ",", " ", "format", "ted", "\\", "10", ";", " ", "for", " ", "a", " ", "Web", " ", "browse", "r", " ", "bec", "aus", "e", " ", "the", " ", "'", "cgi", "tb", "'", " ", "module", " ", "was", " ", "enable", "d", ".", " ", " ", "In", " ", "case", " ", "you", "\\", "10", ";", " ", "are", " ", "not", " ", "readi", "ng", " ", "this", " ", "in", " ", "a", " ", "Web", " ", "browse", "r", ",", " ", "here", " ", "is", " ", "the", " ", "original", " ", "traceback", ":", "\\", "10", ";", "\\", "10", ";", "%", "s", "\\", "10", ";", "-->", "\\", "10", ";'", "''_", "%_", "pydo", "c_", "._", "html_", "._", "escape_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception_", "(_", "etype_", ",_", "evalue", "_", ",_", "et", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "text_", "(_", "ein", "fo_", ",_", "context_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "plain", " ", "text", " ", "document", " ", "descri", "bing", " ", "a", " ", "give", "n", " ", "traceback", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etype_", ",_", "evalue", "_", ",_", "et", "b_", "=_", "ein", "fo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "etype_", ")_", "is_", "types_", "._", "Class", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etype_", "=_", "etype_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyv", "er_", "=_", "'", "Pyth", "on", " ", "'_", "+_", "sys_", "._", "version_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "+_", "':", " ", "'_", "+_", "sys_", "._", "executable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "time_", "._", "ctime_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "=_", "\"%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "str_", "(_", "etype_", ")_", ",_", "pyv", "er_", ",_", "date_", ")_", "+_", "'''", "\\", "10", ";", "A", " ", "problem", " ", "occur", "red", " ", "in", " ", "a", " ", "Pyth", "on", " ", "script", ".", " ", " ", "Her", "e", " ", "is", " ", "the", " ", "sequence", " ", "of", "\\", "10", ";", "function", " ", "calls", " ", "lead", "ing", " ", "up", " ", "to", " ", "the", " ", "error", ",", " ", "in", " ", "the", " ", "order", " ", "the", "y", " ", "occur", "red", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "inspect_", "._", "getin", "ner", "frames_", "(_", "et", "b_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", ",_", "file_", ",_", "ln", "um_", ",_", "func_", ",_", "lines_", ",_", "index_", "in_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "file_", "and_", "os_", "._", "path_", "._", "abspath_", "(_", "file_", ")_", "or_", "'?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", ",_", "varargs", "_", ",_", "var", "kw_", ",_", "locals_", "=_", "inspect_", "._", "geta", "rg", "values_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", "!=_", "'?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call_", "=_", "'", "in", " ", "'_", "+_", "func_", "+_", "inspect_", "._", "format", "argv", "alues", "_", "(_", "args_", ",_", "varargs", "_", ",_", "var", "kw_", ",_", "locals_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format", "value_", "=_", "lambda_", "value_", ":_", "'='_", "+_", "pydo", "c_", "._", "text_", "._", "repr_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "highlight_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reader_", "(_", "ln", "um_", "=_", "[_", "ln", "um_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "highlight_", "[_", "ln", "um_", "[_", "0_", "]_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "return_", "linec", "ache_", "._", "getl", "ine_", "(_", "file_", ",_", "ln", "um_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "finally_", ":_", "ln", "um_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vars_", "=_", "scan", "vars_", "(_", "reader_", ",_", "frame_", ",_", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "[_", "'", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "file_", ",_", "call_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "ln", "um_", "-_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "'%", "5d", " ", "'_", "%_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "num_", "+_", "line_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "done_", ",_", "dump_", "=_", "{_", "}_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "where_", ",_", "value_", "in_", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "done_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "done_", "[_", "name_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "\\u\\u", "UND", "EF", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "where_", "==_", "'", "global", "'_", ":_", "name_", "=_", "'", "global", " ", "'_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "where_", "!=_", "'", "local", "'_", ":_", "name_", "=_", "where_", "+_", "name_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump_", "._", "append_", "(_", "'%", "s", " ", "=", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "pydo", "c_", "._", "text_", "._", "repr_", "(_", "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 ", " _", "dump_", "._", "append_", "(_", "name_", "+_", "'", " ", "undefined", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rows_", "._", "append_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "dump_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frames_", "._", "append_", "(_", "'\\\\", "n", "%", "s", "\\\\", "n", "'_", "%_", "'\\\\", "n", "'_", "._", "join_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exception_", "=_", "[_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "str_", "(_", "etype_", ")_", ",_", "str_", "(_", "evalue", "_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "evalue", "_", ",_", "Base", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "dir_", "(_", "evalue", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "pydo", "c_", "._", "text_", "._", "repr_", "(_", "getattr_", "(_", "evalue", "_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exception_", "._", "append_", "(_", "'\\\\", "n", "%", "s", "%", "s", " ", "=", " ", "%", "s", "'_", "%_", "(_", "\"", " ", "\"_", "*_", "4_", ",_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "head_", "+_", "''_", "._", "join_", "(_", "frames_", ")_", "+_", "''_", "._", "join_", "(_", "exception_", ")_", "+_", "'''", "\\", "10", ";", "\\", "10", ";", "The", " ", "above", " ", "is", " ", "a", " ", "description", " ", "of", " ", "an", " ", "error", " ", "in", " ", "a", " ", "Pyth", "on", " ", "program", ".", " ", " ", "Her", "e", " ", "is", "\\", "10", ";", "the", " ", "original", " ", "traceback", ":", "\\", "10", ";", "\\", "10", ";", "%", "s", "\\", "10", ";'", "''_", "%_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception_", "(_", "etype_", ",_", "evalue", "_", ",_", "et", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
pandaproject/panda/panda/tasks/import_xls.py
[ { "content": " def run(self, dataset_slug, upload_id, external_id_field_index=None, *args, **kwargs):\n \"\"\"\n Execute import.\n \"\"\"\n from panda.models import Dataset, DataUpload\n \n log = logging.getLogger(self.name)\n log.info('Beginning import, dataset_slug: %s' % dataset_slug)\n \n try:\n dataset = Dataset.objects.get(slug=dataset_slug)\n except Dataset.DoesNotExist:\n log.warning('Import failed due to Dataset being deleted, dataset_slug: %s' % dataset_slug)\n\n return\n\n upload = DataUpload.objects.get(id=upload_id)\n\n task_status = dataset.current_task\n task_status.begin(ugettext('Preparing to import'))\n\n book = xlrd.open_workbook(upload.get_path(), on_demand=True)\n sheet = book.sheet_by_index(0)\n row_count = sheet.nrows\n \n add_buffer = []\n data_typer = DataTyper(dataset.column_schema)\n throttle = config_value('PERF', 'TASK_THROTTLE')\n\n for i in range(1, row_count):\n values = sheet.row_values(i)\n types = sheet.row_types(i)\n\n normal_values = []\n\n for v, t in zip(values, types):\n if t == xlrd.biffh.XL_CELL_DATE:\n v = utils.xls.normalize_date(v, book.datemode)\n elif t == xlrd.biffh.XL_CELL_NUMBER:\n if v % 1 == 0:\n v = int(v)\n\n normal_values.append(unicode(v))\n\n external_id = None\n\n if external_id_field_index is not None:\n external_id = values[external_id_field_index]\n\n data = utils.solr.make_data_row(dataset, normal_values, data_upload=upload, external_id=external_id)\n data = data_typer(data, normal_values)\n\n add_buffer.append(data)\n\n if i % SOLR_ADD_BUFFER_SIZE == 0:\n solr.add(settings.SOLR_DATA_CORE, add_buffer)\n add_buffer = []\n\n task_status.update(ugettext('%.0f%% complete') % floor(float(i) / float(row_count) * 100))\n\n if self.is_aborted():\n task_status.abort(ugettext('Aborted after importing %.0f%%') % floor(float(i) / float(row_count) * 100))\n\n log.warning('Import aborted, dataset_slug: %s' % dataset_slug)\n\n return\n \n time.sleep(throttle)\n\n if add_buffer:\n solr.add(settings.SOLR_DATA_CORE, add_buffer)\n add_buffer = []\n\n solr.commit(settings.SOLR_DATA_CORE)\n\n task_status.update(ugettext('100% complete'))\n\n # Refresh dataset from database so there is no chance of crushing changes made since the task started\n try:\n dataset = Dataset.objects.get(slug=dataset_slug)\n except Dataset.DoesNotExist:\n log.warning('Import could not be completed due to Dataset being deleted, dataset_slug: %s' % dataset_slug)\n\n return\n\n if not dataset.row_count:\n dataset.row_count = i\n else:\n dataset.row_count += i\n\n dataset.column_schema = data_typer.schema\n\n dataset.save()\n\n # Refres\n upload = DataUpload.objects.get(id=upload_id)\n\n upload.imported = True\n upload.save()\n\n log.info('Finished import, dataset_slug: %s' % dataset_slug)\n \n return data_typer", "metadata": "root.ImportXLSTask.run", "header": "['class', 'ImportXLSTask', '(', 'ImportFileTask', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "add_buffer ", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Import", "XL", "ST", "ask_", "(_", "Import", "File", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "dataset", "\\u", "slug_", ",_", "upload", "\\u", "id_", ",_", "external", "\\u", "id", "\\u", "field", "\\u", "index_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Execut", "e", " ", "import", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "panda", "_", "._", "models_", "import_", "Dataset_", ",_", "Data", "Upload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Begin", "ning", " ", "import", ",", " ", "dataset", "\\u", "slug", ":", " ", "%", "s", "'_", "%_", "dataset", "\\u", "slug_", ")_", "\\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 ", " _", "dataset_", "=_", "Dataset_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Dataset_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "'", "Import", " ", "fail", "ed", " ", "due", " ", "to", " ", "Datas", "et", " ", "bei", "ng", " ", "delete", "d", ",", " ", "dataset", "\\u", "slug", ":", " ", "%", "s", "'_", "%_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upload_", "=_", "Data", "Upload_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "upload", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "status_", "=_", "dataset_", "._", "current", "\\u", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "status_", "._", "begin_", "(_", "ugettext_", "(_", "'", "Prepar", "ing", " ", "to", " ", "import", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "book_", "=_", "xlr", "d_", "._", "open", "\\u", "workbook_", "(_", "upload_", "._", "get", "\\u", "path_", "(_", ")_", ",_", "on", "\\u", "demand_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sheet_", "=_", "book_", "._", "sheet", "\\u", "by", "\\u", "index_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "count_", "=_", "sheet_", "._", "nrows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type", "r_", "=_", "Data", "Type", "r_", "(_", "dataset_", "._", "column", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "throttle_", "=_", "config", "\\u", "value_", "(_", "'", "PERF", "'_", ",_", "'", "TASK", "\\u", "THRO", "TTL", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "row", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "sheet_", "._", "row", "\\u", "values_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "=_", "sheet_", "._", "row", "\\u", "types_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal", "\\u", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", ",_", "t_", "in_", "zip_", "(_", "values_", ",_", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "==_", "xlr", "d_", "._", "bi", "ff", "h_", "._", "XL", "\\u", "CELL", "\\u", "DATE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "utils_", "._", "xls", "_", "._", "normali", "ze", "\\u", "date_", "(_", "v_", ",_", "book_", "._", "date", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "==_", "xlr", "d_", "._", "bi", "ff", "h_", "._", "XL", "\\u", "CELL", "\\u", "NUMBER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "v_", "%_", "1_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "int_", "(_", "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_", "normal", "\\u", "values_", "._", "append_", "(_", "unicode_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "external", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "external", "\\u", "id", "\\u", "field", "\\u", "index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "external", "\\u", "id_", "=_", "values_", "[_", "external", "\\u", "id", "\\u", "field", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "utils_", "._", "sol", "r_", "._", "make", "\\u", "data\\u", "row_", "(_", "dataset_", ",_", "normal", "\\u", "values_", ",_", "data\\u", "upload_", "=_", "upload_", ",_", "external", "\\u", "id_", "=_", "external", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data\\u", "type", "r_", "(_", "data_", ",_", "normal", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "buffer_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "%_", "SOL", "R", "\\u", "ADD", "\\u", "BUFF", "ER", "\\u", "SIZE_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sol", "r_", "._", "add_", "(_", "settings_", "._", "SOL", "R", "\\u", "DATA", "\\u", "CORE", "_", ",_", "add", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "status_", "._", "update_", "(_", "ugettext_", "(_", "'%", ".0", "f", "%%", " ", "complete", "'_", ")_", "%_", "floor_", "(_", "float_", "(_", "i_", ")_", "/_", "float_", "(_", "row", "\\u", "count_", ")_", "*_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "abort", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "task", "\\u", "status_", "._", "abort_", "(_", "ugettext_", "(_", "'", "Abo", "rted", " ", "after", " ", "import", "ing", " ", "%", ".0", "f", "%%'", "_", ")_", "%_", "floor_", "(_", "float_", "(_", "i_", ")_", "/_", "float_", "(_", "row", "\\u", "count_", ")_", "*_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "warning_", "(_", "'", "Import", " ", "abort", "ed", ",", " ", "dataset", "\\u", "slug", ":", " ", "%", "s", "'_", "%_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "throttle_", ")_", "\\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_", "add", "\\u", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sol", "r_", "._", "add_", "(_", "settings_", "._", "SOL", "R", "\\u", "DATA", "\\u", "CORE", "_", ",_", "add", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sol", "r_", "._", "commit_", "(_", "settings_", "._", "SOL", "R", "\\u", "DATA", "\\u", "CORE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "status_", "._", "update_", "(_", "ugettext_", "(_", "'", "100", "%", " ", "complete", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Refr", "esh", " ", "dataset", " ", "from", " ", "databa", "se", " ", "so", " ", "there", " ", "is", " ", "no", " ", "chan", "ce", " ", "of", " ", "cru", "shing", " ", "change", "s", " ", "made", " ", "sinc", "e", " ", "the", " ", "task", " ", "started_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "Dataset_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Dataset_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "'", "Import", " ", "coul", "d", " ", "not", " ", "be", " ", "complete", "d", " ", "due", " ", "to", " ", "Datas", "et", " ", "bei", "ng", " ", "delete", "d", ",", " ", "dataset", "\\u", "slug", ":", " ", "%", "s", "'_", "%_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dataset_", "._", "row", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "._", "row", "\\u", "count_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "._", "row", "\\u", "count_", "+=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dataset_", "._", "column", "\\u", "schema_", "=_", "data\\u", "type", "r_", "._", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Refr", "es_", "\\u\\u\\uNL\\u\\u\\u_", "upload_", "=_", "Data", "Upload_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "upload", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "upload_", "._", "imported_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Finish", "ed", " ", "import", ",", " ", "dataset", "\\u", "slug", ":", " ", "%", "s", "'_", "%_", "dataset", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data\\u", "type", "r_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
sightmachine/SimpleCV/SimpleCV/Features/Detection.py
[ { "content": " def _standardize(self,x,y=None,w=None,h=None):\n if(isinstance(x,np.ndarray)):\n x = x.tolist()\n if(isinstance(y,np.ndarray)):\n y = y.tolist()\n\n # make the common case fast\n if( isinstance(x,(int,float)) and isinstance(y,(int,float)) and\n isinstance(w,(int,float)) and isinstance(h,(int,float)) ):\n if( self.image is not None ):\n x = np.clip(x,0,self.image.width)\n y = np.clip(y,0,self.image.height)\n w = np.clip(w,0,self.image.width-x)\n h = np.clip(h,0,self.image.height-y)\n\n return [x,y,w,h]\n elif(isinstance(x,ROI)):\n x,y,w,h = x.toXYWH()\n #If it's a feature extract what we need \n elif(isinstance(x,FeatureSet) and len(x) > 0 ):\n #double check that everything in the list is a feature\n features = [feat for feat in x if isinstance(feat,Feature)]\n xmax = np.max([feat.maxX() for feat in features])\n xmin = np.min([feat.minX() for feat in features])\n ymax = np.max([feat.maxY() for feat in features])\n ymin = np.min([feat.minY() for feat in features])\n x = xmin\n y = ymin\n w = xmax-xmin\n h = ymax-ymin\n \n elif(isinstance(x, Feature)):\n theFeature = x\n x = theFeature.points[0][0]\n y = theFeature.points[0][1]\n w = theFeature.width()\n h = theFeature.height()\n\n # [x,y,w,h] (x,y,w,h)\n elif(isinstance(x, (tuple,list)) and len(x) == 4 and isinstance(x[0],(int, long, float))\n and y == None and w == None and h == None):\n x,y,w,h = x\n # x of the form [(x,y),(x1,y1),(x2,y2),(x3,y3)]\n # x of the form [[x,y],[x1,y1],[x2,y2],[x3,y3]]\n # x of the form ([x,y],[x1,y1],[x2,y2],[x3,y3])\n # x of the form ((x,y),(x1,y1),(x2,y2),(x3,y3))\n elif( isinstance(x, (list,tuple)) and\n isinstance(x[0],(list,tuple)) and\n (len(x) == 4 and len(x[0]) == 2 ) and\n y == None and w == None and h == None):\n if (len(x[0])==2 and len(x[1])==2 and len(x[2])==2 and len(x[3])==2):\n xmax = np.max([x[0][0],x[1][0],x[2][0],x[3][0]])\n ymax = np.max([x[0][1],x[1][1],x[2][1],x[3][1]])\n xmin = np.min([x[0][0],x[1][0],x[2][0],x[3][0]])\n ymin = np.min([x[0][1],x[1][1],x[2][1],x[3][1]])\n x = xmin\n y = ymin\n w = xmax-xmin\n h = ymax-ymin\n else:\n logger.warning(\"x should be in the form ((x,y),(x1,y1),(x2,y2),(x3,y3))\")\n return None\n \n # x,y of the form [x1,x2,x3,x4,x5....] and y similar\n elif(isinstance(x, (tuple,list)) and\n isinstance(y, (tuple,list)) and\n len(x) > 4 and len(y) > 4 ):\n if(isinstance(x[0],(int, long, float)) and isinstance(y[0],(int, long, float))):\n xmax = np.max(x)\n ymax = np.max(y)\n xmin = np.min(x)\n ymin = np.min(y)\n x = xmin\n y = ymin\n w = xmax-xmin\n h = ymax-ymin\n else:\n logger.warning(\"x should be in the form x = [1,2,3,4,5] y =[0,2,4,6,8]\")\n return None\n\n # x of the form [(x,y),(x,y),(x,y),(x,y),(x,y),(x,y)]\n elif(isinstance(x, (list,tuple)) and\n len(x) > 4 and len(x[0]) == 2 and y == None and w == None and h == None):\n if(isinstance(x[0][0],(int, long, float))):\n xs = [pt[0] for pt in x]\n ys = [pt[1] for pt in x]\n xmax = np.max(xs)\n ymax = np.max(ys)\n xmin = np.min(xs)\n ymin = np.min(ys)\n x = xmin\n y = ymin\n w = xmax-xmin\n h = ymax-ymin\n else:\n logger.warning(\"x should be in the form [(x,y),(x,y),(x,y),(x,y),(x,y),(x,y)]\")\n return None\n\n # x of the form [(x,y),(x1,y1)]\n elif(isinstance(x,(list,tuple)) and len(x) == 2 and isinstance(x[0],(list,tuple)) and isinstance(x[1],(list,tuple)) and y == None and w == None and h == None):\n if (len(x[0])==2 and len(x[1])==2):\n xt = np.min([x[0][0],x[1][0]])\n yt = np.min([x[0][0],x[1][0]])\n w = np.abs(x[0][0]-x[1][0])\n h = np.abs(x[0][1]-x[1][1])\n x = xt\n y = yt\n else:\n logger.warning(\"x should be in the form [(x1,y1),(x2,y2)]\")\n return None\n\n # x and y of the form (x,y),(x1,y2)\n elif(isinstance(x, (tuple,list)) and isinstance(y,(tuple,list)) and w == None and h == None):\n if (len(x)==2 and len(y)==2):\n xt = np.min([x[0],y[0]])\n yt = np.min([x[1],y[1]])\n w = np.abs(y[0]-x[0])\n h = np.abs(y[1]-x[1])\n x = xt\n y = yt\n \n else:\n logger.warning(\"if x and y are tuple it should be in the form (x1,y1) and (x2,y2)\")\n return None\n\n if(y == None or w == None or h == None):\n logger.warning('Not a valid roi')\n elif( w <= 0 or h <= 0 ):\n logger.warning(\"ROI can't have a negative dimension\")\n return None\n\n if( self.image is not None ):\n x = np.clip(x,0,self.image.width)\n y = np.clip(y,0,self.image.height)\n w = np.clip(w,0,self.image.width-x)\n h = np.clip(h,0,self.image.height-y)\n\n return [x,y,w,h]", "metadata": "root.ROI._standardize", "header": "['class', 'ROI', '(', 'Feature', ')', ':', '___EOS___']", "index": 2579 } ]
[ { "span": "y == None ", "start_line": 2619, "start_column": 17, "end_line": 2619, "end_column": 26 }, { "span": "w == None ", "start_line": 2619, "start_column": 31, "end_line": 2619, "end_column": 40 }, { "span": "h == None)", "start_line": 2619, "start_column": 45, "end_line": 2619, "end_column": 54 }, { "span": "y == None ", "start_line": 2628, "start_column": 14, "end_line": 2628, "end_column": 23 }, { "span": "w == None ", "start_line": 2628, "start_column": 28, "end_line": 2628, "end_column": 37 }, { "span": "h == None)", "start_line": 2628, "start_column": 42, "end_line": 2628, "end_column": 51 }, { "span": "y == None ", "start_line": 2661, "start_column": 47, "end_line": 2661, "end_column": 56 }, { "span": "w == None ", "start_line": 2661, "start_column": 61, "end_line": 2661, "end_column": 70 }, { "span": "h == None)", "start_line": 2661, "start_column": 75, "end_line": 2661, "end_column": 84 }, { "span": "y == None ", "start_line": 2678, "start_column": 128, "end_line": 2678, "end_column": 137 }, { "span": "w == None ", "start_line": 2678, "start_column": 142, "end_line": 2678, "end_column": 151 }, { "span": "h == None)", "start_line": 2678, "start_column": 156, "end_line": 2678, "end_column": 165 }, { "span": "w == None ", "start_line": 2691, "start_column": 76, "end_line": 2691, "end_column": 85 }, { "span": "h == None)", "start_line": 2691, "start_column": 90, "end_line": 2691, "end_column": 99 }, { "span": "y == None ", "start_line": 2704, "start_column": 11, "end_line": 2704, "end_column": 20 }, { "span": "w == None ", "start_line": 2704, "start_column": 24, "end_line": 2704, "end_column": 33 }, { "span": "h == None)", "start_line": 2704, "start_column": 37, "end_line": 2704, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "ROI", "_", "(_", "Feature_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "standardize", "_", "(_", "self_", ",_", "x_", ",_", "y_", "=_", "None_", ",_", "w_", "=_", "None_", ",_", "h_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "isinstance_", "(_", "x_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "x_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "y_", ",_", "np_", "._", "ndarray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "y_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "common", " ", "case", " ", "fast_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", "and_", "isinstance_", "(_", "y_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "w_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", "and_", "isinstance_", "(_", "h_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "image_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "np_", "._", "clip_", "(_", "x_", ",_", "0_", ",_", "self_", "._", "image_", "._", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "clip_", "(_", "y_", ",_", "0_", ",_", "self_", "._", "image_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "np_", "._", "clip_", "(_", "w_", ",_", "0_", ",_", "self_", "._", "image_", "._", "width_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "np_", "._", "clip_", "(_", "h_", ",_", "0_", ",_", "self_", "._", "image_", "._", "height_", "-_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "ROI", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "=_", "x_", "._", "to", "XY", "WH", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "it", "'", "s", " ", "a", " ", "feature", " ", "extract", " ", "what", " ", "we", " ", "need", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "Feature", "Set_", ")_", "and_", "len_", "(_", "x_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "double", " ", "check", " ", "tha", "t", " ", "every", "thing", " ", "in", " ", "the", " ", "list", " ", "is", " ", "a", " ", "feature_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "=_", "[_", "feat_", "for_", "feat_", "in_", "x_", "if_", "isinstance_", "(_", "feat_", ",_", "Feature_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmax_", "=_", "np_", "._", "max_", "(_", "[_", "feat_", "._", "max", "X_", "(_", ")_", "for_", "feat_", "in_", "features_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmin_", "=_", "np_", "._", "min_", "(_", "[_", "feat_", "._", "min", "X_", "(_", ")_", "for_", "feat_", "in_", "features_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "np_", "._", "max_", "(_", "[_", "feat_", "._", "max", "Y_", "(_", ")_", "for_", "feat_", "in_", "features_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "np_", "._", "min_", "(_", "[_", "feat_", "._", "min", "Y_", "(_", ")_", "for_", "feat_", "in_", "features_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "xmax_", "-_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "ymax_", "-_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "Feature_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Feature_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "the", "Feature_", "._", "points_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "the", "Feature_", "._", "points_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "the", "Feature_", "._", "width_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "the", "Feature_", "._", "height_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "x", ",", "y", ",", "w", ",", "h", "]", " ", "(", "x", ",", "y", ",", "w", ",", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", "and_", "len_", "(_", "x_", ")_", "==_", "4_", "and_", "isinstance_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "y_", "==_", "None_", "and_", "w_", "==_", "None_", "and_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "[(", "x", ",", "y", "),", "(", "x1", ",", "y1", "),", "(", "x2", ",", "y2", "),", "(", "x3", ",", "y", "3", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "[[", "x", ",", "y", "],[", "x1", ",", "y1", "],[", "x2", ",", "y2", "],[", "x3", ",", "y", "3", "]]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "([", "x", ",", "y", "],[", "x1", ",", "y1", "],[", "x2", ",", "y2", "],[", "x3", ",", "y", "3", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "((", "x", ",", "y", "),", "(", "x1", ",", "y1", "),", "(", "x2", ",", "y2", "),", "(", "x3", ",", "y", "3", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "len_", "(_", "x_", ")_", "==_", "4_", "and_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", "==_", "2_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "==_", "None_", "and_", "w_", "==_", "None_", "and_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", "==_", "2_", "and_", "len_", "(_", "x_", "[_", "1_", "]_", ")_", "==_", "2_", "and_", "len_", "(_", "x_", "[_", "2_", "]_", ")_", "==_", "2_", "and_", "len_", "(_", "x_", "[_", "3_", "]_", ")_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xmax_", "=_", "np_", "._", "max_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "3_", "]_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "np_", "._", "max_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "3_", "]_", "[_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmin_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "3_", "]_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "3_", "]_", "[_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "xmax_", "-_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "ymax_", "-_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "x", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "form", " ", " ", "((", "x", ",", "y", "),", "(", "x1", ",", "y1", "),", "(", "x2", ",", "y2", "),", "(", "x3", ",", "y", "3", "))\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", ",", "y", " ", "of", " ", "the", " ", "form", " ", "[", "x1", ",", "x2", ",", "x3", ",", "x4", ",", "x5", "....", "]", " ", "and", " ", "y", " ", "similar_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "y_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "x_", ")_", ">_", "4_", "and_", "len_", "(_", "y_", ")_", ">_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "isinstance_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", "and_", "isinstance_", "(_", "y_", "[_", "0_", "]_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xmax_", "=_", "np_", "._", "max_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "np_", "._", "max_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmin_", "=_", "np_", "._", "min_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "np_", "._", "min_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "xmax_", "-_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "ymax_", "-_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "x", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "form", " ", "x", " ", "=", " ", "[", "1", ",", "2", ",", "3", ",", "4", ",", "5", "]", " ", "y", " ", "=[", "0", ",", "2", ",", "4", ",", "6", ",", "8", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "[(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "x_", ")_", ">_", "4_", "and_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", "==_", "2_", "and_", "y_", "==_", "None_", "and_", "w_", "==_", "None_", "and_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "isinstance_", "(_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "(_", "int_", ",_", "long_", ",_", "float_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xs_", "=_", "[_", "pt_", "[_", "0_", "]_", "for_", "pt_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "[_", "pt_", "[_", "1_", "]_", "for_", "pt_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmax_", "=_", "np_", "._", "max_", "(_", "xs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax_", "=_", "np_", "._", "max_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmin_", "=_", "np_", "._", "min_", "(_", "xs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin_", "=_", "np_", "._", "min_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "xmax_", "-_", "xmin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "ymax_", "-_", "ymin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "x", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "form", " ", "[(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", "),", "(", "x", ",", "y", ")]", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "of", " ", "the", " ", "form", " ", "[(", "x", ",", "y", "),", "(", "x1", ",", "y1", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "len_", "(_", "x_", ")_", "==_", "2_", "and_", "isinstance_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "isinstance_", "(_", "x_", "[_", "1_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "y_", "==_", "None_", "and_", "w_", "==_", "None_", "and_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", "==_", "2_", "and_", "len_", "(_", "x_", "[_", "1_", "]_", ")_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xt_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yt_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "np_", "._", "abs_", "(_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", "-_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "np_", "._", "abs_", "(_", "x_", "[_", "0_", "]_", "[_", "1_", "]_", "-_", "x_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "yt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "x", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "form", " ", "[(", "x1", ",", "y1", "),", "(", "x2", ",", "y2", ")]", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "and", " ", "y", " ", "of", " ", "the", " ", "form", " ", "(", "x", ",", "y", "),", "(", "x1", ",", "y2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "x_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", "and_", "isinstance_", "(_", "y_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", "and_", "w_", "==_", "None_", "and_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "x_", ")_", "==_", "2_", "and_", "len_", "(_", "y_", ")_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xt_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "0_", "]_", ",_", "y_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yt_", "=_", "np_", "._", "min_", "(_", "[_", "x_", "[_", "1_", "]_", ",_", "y_", "[_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "np_", "._", "abs_", "(_", "y_", "[_", "0_", "]_", "-_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "np_", "._", "abs_", "(_", "y_", "[_", "1_", "]_", "-_", "x_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "xt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "yt_", "\\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 ", " _", "logger_", "._", "warning_", "(_", "\"", "if", " ", "x", " ", "and", " ", "y", " ", "are", " ", "tuple", " ", "it", " ", "shou", "ld", " ", "be", " ", "in", " ", "the", " ", "form", " ", "(", "x1", ",", "y1", ")", " ", "and", " ", "(", "x2", ",", "y2", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "y_", "==_", "None_", "or_", "w_", "==_", "None_", "or_", "h_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "Not", " ", "a", " ", "valid", " ", "roi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "w_", "<=_", "0_", "or_", "h_", "<=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "ROI", " ", "can", "'", "t", " ", "have", " ", "a", " ", "negati", "ve", " ", "dimension", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "image_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "np_", "._", "clip_", "(_", "x_", ",_", "0_", ",_", "self_", "._", "image_", "._", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "clip_", "(_", "y_", ",_", "0_", ",_", "self_", "._", "image_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "np_", "._", "clip_", "(_", "w_", ",_", "0_", ",_", "self_", "._", "image_", "._", "width_", "-_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "np_", "._", "clip_", "(_", "h_", ",_", "0_", ",_", "self_", "._", "image_", "._", "height_", "-_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "]_", "\\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, 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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 ]
Unused local variable
fatcloud/PyCV-time/opencv-official-samples/earlier/dmtx.py
[ { "content": " def find(self, img):\n started = time.time()\n gray = self.Cached('gray', img.height, img.width, cv.CV_8UC1)\n cv.CvtColor(img, gray, cv.CV_BGR2GRAY)\n\n sobel = self.Cached('sobel', img.height, img.width, cv.CV_16SC1)\n sobely = self.Cached('sobely', img.height, img.width, cv.CV_16SC1)\n\n cv.Sobel(gray, sobel, 1, 0)\n cv.Sobel(gray, sobely, 0, 1)\n cv.Add(sobel, sobely, sobel)\n\n sobel8 = self.Cached('sobel8', sobel.height, sobel.width, cv.CV_8UC1)\n absnorm8(sobel, sobel8)\n cv.Threshold(sobel8, sobel8, 128.0, 255.0, cv.CV_THRESH_BINARY)\n\n sobel_integral = self.Cached('sobel_integral', img.height + 1, img.width + 1, cv.CV_32SC1)\n cv.Integral(sobel8, sobel_integral)\n\n d = 16\n _x1y1 = cv.GetSubRect(sobel_integral, (0, 0, sobel_integral.cols - d, sobel_integral.rows - d))\n _x1y2 = cv.GetSubRect(sobel_integral, (0, d, sobel_integral.cols - d, sobel_integral.rows - d))\n _x2y1 = cv.GetSubRect(sobel_integral, (d, 0, sobel_integral.cols - d, sobel_integral.rows - d))\n _x2y2 = cv.GetSubRect(sobel_integral, (d, d, sobel_integral.cols - d, sobel_integral.rows - d))\n\n summation = cv.CloneMat(_x2y2)\n cv.Sub(summation, _x1y2, summation)\n cv.Sub(summation, _x2y1, summation)\n cv.Add(summation, _x1y1, summation)\n sum8 = self.Cached('sum8', summation.height, summation.width, cv.CV_8UC1)\n absnorm8(summation, sum8)\n cv.Threshold(sum8, sum8, 32.0, 255.0, cv.CV_THRESH_BINARY)\n\n cv.ShowImage(\"sum8\", sum8)\n seq = cv.FindContours(sum8, cv.CreateMemStorage(), cv.CV_RETR_EXTERNAL)\n subimg = cv.GetSubRect(img, (d / 2, d / 2, sum8.cols, sum8.rows))\n t_cull = time.time() - started\n\n seqs = []\n while seq:\n seqs.append(seq)\n seq = seq.h_next()\n\n started = time.time()\n found = {}\n print 'seqs', len(seqs)\n for seq in seqs:\n area = cv.ContourArea(seq)\n if area > 1000:\n rect = cv.BoundingRect(seq)\n edge = int((14 / 14.) * math.sqrt(area) / 2 + 0.5)\n candidate = cv.GetSubRect(subimg, rect)\n sym = self.dm.decode(candidate.width,\n candidate.height,\n buffer(candidate.tostring()),\n max_count = 1,\n #min_edge = 6,\n #max_edge = int(edge) # Units of 2 pixels\n )\n if sym:\n onscreen = [(d / 2 + rect[0] + x, d / 2 + rect[1] + y) for (x, y) in self.dm.stats(1)[1]]\n found[sym] = onscreen\n else:\n print \"FAILED\"\n t_brute = time.time() - started\n print \"cull took\", t_cull, \"brute\", t_brute\n return found", "metadata": "root.DmtxFinder.find", "header": "['class', 'DmtxFinder', ':', '___EOS___']", "index": 53 } ]
[ { "span": "edge ", "start_line": 103, "start_column": 16, "end_line": 103, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Dm", "tx", "Finder_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find_", "(_", "self_", ",_", "img_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "started_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gray_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "gray", "'_", ",_", "img_", "._", "height_", ",_", "img_", "._", "width_", ",_", "cv_", "._", "CV", "\\u", "8", "UC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Cv", "t", "Color_", "(_", "img_", ",_", "gray_", ",_", "cv_", "._", "CV", "\\u", "BG", "R2", "GRAY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sob", "el_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "sob", "el", "'_", ",_", "img_", "._", "height_", ",_", "img_", "._", "width_", ",_", "cv_", "._", "CV", "\\u", "16", "SC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sob", "el", "y_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "sob", "el", "y", "'_", ",_", "img_", "._", "height_", ",_", "img_", "._", "width_", ",_", "cv_", "._", "CV", "\\u", "16", "SC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cv_", "._", "So", "bel_", "(_", "gray_", ",_", "sob", "el_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "So", "bel_", "(_", "gray_", ",_", "sob", "el", "y_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Add_", "(_", "sob", "el_", ",_", "sob", "el", "y_", ",_", "sob", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sob", "el", "8_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "sob", "el", "8", "'_", ",_", "sob", "el_", "._", "height_", ",_", "sob", "el_", "._", "width_", ",_", "cv_", "._", "CV", "\\u", "8", "UC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "norm", "8_", "(_", "sob", "el_", ",_", "sob", "el", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Threshold_", "(_", "sob", "el", "8_", ",_", "sob", "el", "8_", ",_", "128", ".0_", ",_", "255.0_", ",_", "cv_", "._", "CV", "\\u", "THRESH", "\\u", "BINARY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sob", "el", "\\u", "integral_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "sob", "el", "\\u", "integral", "'_", ",_", "img_", "._", "height_", "+_", "1_", ",_", "img_", "._", "width_", "+_", "1_", ",_", "cv_", "._", "CV", "\\u", "32", "SC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Integral_", "(_", "sob", "el", "8_", ",_", "sob", "el", "\\u", "integral_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x1", "y1_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "sob", "el", "\\u", "integral_", ",_", "(_", "0_", ",_", "0_", ",_", "sob", "el", "\\u", "integral_", "._", "cols_", "-_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "rows_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x1", "y2_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "sob", "el", "\\u", "integral_", ",_", "(_", "0_", ",_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "cols_", "-_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "rows_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x2", "y1_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "sob", "el", "\\u", "integral_", ",_", "(_", "d_", ",_", "0_", ",_", "sob", "el", "\\u", "integral_", "._", "cols_", "-_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "rows_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x2", "y2_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "sob", "el", "\\u", "integral_", ",_", "(_", "d_", ",_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "cols_", "-_", "d_", ",_", "sob", "el", "\\u", "integral_", "._", "rows_", "-_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "summa", "tion_", "=_", "cv_", "._", "Clone", "Mat_", "(_", "\\u", "x2", "y2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Sub_", "(_", "summa", "tion_", ",_", "\\u", "x1", "y2_", ",_", "summa", "tion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Sub_", "(_", "summa", "tion_", ",_", "\\u", "x2", "y1_", ",_", "summa", "tion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Add_", "(_", "summa", "tion_", ",_", "\\u", "x1", "y1_", ",_", "summa", "tion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sum", "8_", "=_", "self_", "._", "Cache", "d_", "(_", "'", "sum", "8", "'_", ",_", "summa", "tion_", "._", "height_", ",_", "summa", "tion_", "._", "width_", ",_", "cv_", "._", "CV", "\\u", "8", "UC", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "norm", "8_", "(_", "summa", "tion_", ",_", "sum", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Threshold_", "(_", "sum", "8_", ",_", "sum", "8_", ",_", "32.", "0_", ",_", "255.0_", ",_", "cv_", "._", "CV", "\\u", "THRESH", "\\u", "BINARY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cv_", "._", "Show", "Image_", "(_", "\"", "sum", "8", "\"_", ",_", "sum", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "cv_", "._", "Fin", "d", "Contours", "_", "(_", "sum", "8_", ",_", "cv_", "._", "Creat", "e", "Mem", "Storage_", "(_", ")_", ",_", "cv_", "._", "CV", "\\u", "RET", "R", "\\u", "EXTERNAL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subi", "mg_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "img_", ",_", "(_", "d_", "/_", "2_", ",_", "d_", "/_", "2_", ",_", "sum", "8_", "._", "cols_", ",_", "sum", "8_", "._", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "cul", "l_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seqs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "seq_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seqs_", "._", "append_", "(_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "seq_", "._", "h", "\\u", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "started_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "seqs", "'_", ",_", "len_", "(_", "seqs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "seq_", "in_", "seqs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "area_", "=_", "cv_", "._", "Contour", "Area_", "(_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "area_", ">_", "1000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rect_", "=_", "cv_", "._", "Bound", "ing", "Rect_", "(_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge_", "=_", "int_", "(_", "(_", "14_", "/_", "14.", "_", ")_", "*_", "math_", "._", "sqrt_", "(_", "area_", ")_", "/_", "2_", "+_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidate_", "=_", "cv_", "._", "Get", "Sub", "Rect_", "(_", "subi", "mg_", ",_", "rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym_", "=_", "self_", "._", "dm_", "._", "decode_", "(_", "candidate_", "._", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "candidate_", "._", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", "(_", "candidate_", "._", "tostring_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "count_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "min", "\\u", "edge", " ", "=", " ", "6", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "max", "\\u", "edge", " ", "=", " ", "int", "(", "edge", ")", " ", " ", "#", " ", "Unit", "s", " ", "of", " ", "2", " ", "pixels_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sym_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ons", "creen", "_", "=_", "[_", "(_", "d_", "/_", "2_", "+_", "rect_", "[_", "0_", "]_", "+_", "x_", ",_", "d_", "/_", "2_", "+_", "rect_", "[_", "1_", "]_", "+_", "y_", ")_", "for_", "(_", "x_", ",_", "y_", ")_", "in_", "self_", "._", "dm_", "._", "stats_", "(_", "1_", ")_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "[_", "sym_", "]_", "=_", "ons", "creen", "_", "\\u\\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_", "\"", "FAIL", "ED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t", "\\u", "brute", "_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "cul", "l", " ", "too", "k", "\"_", ",_", "t", "\\u", "cul", "l_", ",_", "\"", "brute", "\"_", ",_", "t", "\\u", "brute", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "found_", "\\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, 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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 ]
Imprecise assert
lsbardel/python-stdnet/tests/all/query/manytomany.py
[ { "content": " def testMeta(self):\n models = self.mapper\n through = Profile.roles.model\n self.assertTrue(through in models)\n objects = models[through]\n name = through.__name__\n self.assertEqual(name, 'profile_role')\n self.assertEqual(objects.backend, models[Profile].backend)\n self.assertEqual(objects.backend, models[Role].backend)\n self.assertEqual(through.role.field.model, through)\n self.assertEqual(through.profile.field.model, through)\n pk = through.pk()\n self.assertTrue(isinstance(pk, odm.CompositeIdField))\n self.assertEqual(pk.fields[0].relmodel, Profile)\n self.assertEqual(pk.fields[1].relmodel, Role)", "metadata": "root.TestRegisteredThroughModel.testMeta", "header": "['class', 'TestRegisteredThroughModel', '(', 'TestManyToManyBase', ',', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": " def testMetaComposite(self):\n meta = Composite._meta\n m2m = None\n for field in meta.fields:\n if field.name == 'elements':\n m2m = field\n self.assertTrue(isinstance(m2m, odm.ManyToManyField))\n self.assertFalse('elements' in meta.dfields)\n self.assertEqual(m2m.through,CompositeElement)\n self.assertTrue('elements' in meta.related)\n manager = Composite.elements\n self.assertEqual(manager.model,CompositeElement)\n self.assertEqual(manager.relmodel,Composite)\n self.assertEqual(manager.formodel,Element)\n self.assertEqual(len(CompositeElement._meta.indices),2)", "metadata": "root.TestManyToManyThrough.testMetaComposite", "header": "['class', 'TestManyToManyThrough', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 212 }, { "content": " def testMetaElement(self):\n meta = Element._meta\n self.assertTrue('composites' in meta.related)\n manager = Element.composites\n self.assertEqual(manager.model,CompositeElement)\n self.assertEqual(manager.relmodel,Element)\n self.assertEqual(manager.formodel,Composite)", "metadata": "root.TestManyToManyThrough.testMetaElement", "header": "['class', 'TestManyToManyThrough', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 228 } ]
[ { "span": "self.assertTrue(through in models)", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 42 }, { "span": "self.assertFalse('elements' in meta.dfields)", "start_line": 219, "start_column": 8, "end_line": 219, "end_column": 52 }, { "span": "self.assertTrue('elements' in meta.related)", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 51 }, { "span": "self.assertTrue('composites' in meta.related)", "start_line": 230, "start_column": 8, "end_line": 230, "end_column": 53 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Register", "ed", "Through", "Model_", "(_", "Test", "Many", "To", "Many", "Base_", ",_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Meta_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "models_", "=_", "self_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "through_", "=_", "Profile_", "._", "roles_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "through_", "in_", "models_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "models_", "[_", "through_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "through_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "'", "profile", "\\u", "role", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "objects_", "._", "backend_", ",_", "models_", "[_", "Profile_", "]_", "._", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "objects_", "._", "backend_", ",_", "models_", "[_", "Role_", "]_", "._", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "through_", "._", "role_", "._", "field_", "._", "model_", ",_", "through_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "through_", "._", "profile_", "._", "field_", "._", "model_", ",_", "through_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk_", "=_", "through_", "._", "pk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "pk_", ",_", "od", "m_", "._", "Composit", "e", "Id", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pk_", "._", "fields_", "[_", "0_", "]_", "._", "rel", "model_", ",_", "Profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pk_", "._", "fields_", "[_", "1_", "]_", "._", "rel", "model_", ",_", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "To", "Many", "Through", "_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Meta", "Composit", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "Composit", "e_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "meta_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "name_", "==_", "'", "element", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2", "m_", "=_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "m2", "m_", ",_", "od", "m_", "._", "Many", "To", "Many", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "element", "s", "'_", "in_", "meta_", "._", "dfi", "elds", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "m2", "m_", "._", "through_", ",_", "Composit", "e", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "element", "s", "'_", "in_", "meta_", "._", "related_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "Composit", "e_", "._", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "model_", ",_", "Composit", "e", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "rel", "model_", ",_", "Composit", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "form", "odel_", ",_", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "Composit", "e", "Element_", "._", "\\u", "meta_", "._", "indices_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Many", "To", "Many", "Through", "_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Meta", "Element_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "Element_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "composi", "tes", "'_", "in_", "meta_", "._", "related_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "Element_", "._", "composi", "tes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "model_", ",_", "Composit", "e", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "rel", "model_", ",_", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "manager_", "._", "form", "odel_", ",_", "Composit", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Wrong number of arguments in a call
LEAF-BoiseState/SPEED/Module05/PenmanMonteithEx.py
[ { "content": "def SurfResist(g0, S, D, Tc, SM, SM0):\n g_c = Gee_C()\n g_R = Gee_R(S)\n g_D = Gee_D(D)\n g_T = Gee_T(Tc + 273.15)\n g_M = Gee_M(SM, SM0)\n g_s = g0*g_c*g_R*g_D*g_T*g_M\n r_s = 1.0/g_s\n return r_s", "metadata": "root.SurfResist", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def Gee_R(S, K_R=200.0):\n g_R = (S*(1000.0 + K_R))/(1000.0*(S+K_R))\n return g_R", "metadata": "root.Gee_R", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def Gee_D(D,K_D1=-0.307, K_D2=0.019):\n g_D = 1.0 + K_D1*D + K_D2*D**2\n return g_D", "metadata": "root.Gee_D", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def Gee_T(TK, TL=273.0, TH=313.0, T0=293.0):\n alpha_T = (TH - T0)/(T0 - TL)\n g_T = ((TK - TL)*(TH - TK)**alpha_T)/((T0 - TL)*(TH - T0)**alpha_T)\n return g_T", "metadata": "root.Gee_T", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def Gee_M(SM, SM0, K_M1, K_M2):\n g_SM = 1.0 - K_M1*exp(K_M2*(SM - SM0))\n return g_SM ", "metadata": "root.Gee_M", "header": "['module', '___EOS___']", "index": 61 } ]
[ { "span": "Gee_M(SM, SM0)", "start_line": 39, "start_column": 10, "end_line": 39, "end_column": 24 } ]
[ { "span": "def Gee_M(SM, SM0, K_M1, K_M2):", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 31 } ]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Surf", "Resist", "_", "(_", "g0", "_", ",_", "S_", ",_", "D_", ",_", "Tc", "_", ",_", "SM_", ",_", "SM", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "c_", "=_", "Ge", "e\\u", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "R_", "=_", "Ge", "e\\u", "R_", "(_", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "D_", "=_", "Ge", "e\\u", "D_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "T_", "=_", "Ge", "e\\u", "T_", "(_", "Tc", "_", "+_", "273", ".15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "M_", "=_", "Ge", "e\\u", "M_", "(_", "SM_", ",_", "SM", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "s_", "=_", "g0", "_", "*_", "g", "\\u", "c_", "*_", "g", "\\u", "R_", "*_", "g", "\\u", "D_", "*_", "g", "\\u", "T_", "*_", "g", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "s_", "=_", "1.0_", "/_", "g", "\\u", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r", "\\u", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ge", "e\\u", "R_", "(_", "S_", ",_", "K", "\\u", "R_", "=_", "200.", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "R_", "=_", "(_", "S_", "*_", "(_", "1000.0_", "+_", "K", "\\u", "R_", ")_", ")_", "/_", "(_", "1000.0_", "*_", "(_", "S_", "+_", "K", "\\u", "R_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "g", "\\u", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ge", "e\\u", "D_", "(_", "D_", ",_", "K", "\\u", "D1_", "=_", "-_", "0.30", "7_", ",_", "K", "\\u", "D2_", "=_", "0.01", "9_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "D_", "=_", "1.0_", "+_", "K", "\\u", "D1_", "*_", "D_", "+_", "K", "\\u", "D2_", "*_", "D_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "g", "\\u", "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_", "Ge", "e\\u", "T_", "(_", "TK", "_", ",_", "TL", "_", "=_", "273", ".0_", ",_", "TH_", "=_", "313", ".0_", ",_", "T0_", "=_", "293", ".0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha", "\\u", "T_", "=_", "(_", "TH_", "-_", "T0_", ")_", "/_", "(_", "T0_", "-_", "TL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "T_", "=_", "(_", "(_", "TK", "_", "-_", "TL", "_", ")_", "*_", "(_", "TH_", "-_", "TK", "_", ")_", "**_", "alpha", "\\u", "T_", ")_", "/_", "(_", "(_", "T0_", "-_", "TL", "_", ")_", "*_", "(_", "TH_", "-_", "T0_", ")_", "**_", "alpha", "\\u", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "g", "\\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_", "Ge", "e\\u", "M_", "(_", "SM_", ",_", "SM", "0_", ",_", "K", "\\u", "M1_", ",_", "K", "\\u", "M2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "SM_", "=_", "1.0_", "-_", "K", "\\u", "M1_", "*_", "exp_", "(_", "K", "\\u", "M2_", "*_", "(_", "SM_", "-_", "SM", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "g", "\\u", "SM_", "\\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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 2, 2, 2, 2, 2 ]
Unused import
sunlightlabs/read_FEC/fecreader/fecreader/urls.py
[ { "content": "from django.conf.urls import patterns, include, url\nfrom django.conf.urls.static import static\nfrom django.views.generic import TemplateView\nfrom django.conf import settings\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'fecreader.views.home', name='home'),\n # url(r'^fecreader/', include('fecreader.foo.urls')),\n\n # Uncomment the admin/doc line below to enable admin documentation:\n # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),\n\n #Uncomment the next line to enable the admin:\n url(r'^admin/', include(admin.site.urls)),\n url(r'^base/$', TemplateView.as_view(template_name=\"dryrub/base.html\")),\n url(r'^styletest/$', TemplateView.as_view(template_name=\"test_templates/styletest.html\")),\n url(r'', include('public_views.datapages.urls')),\n url(r'^api/', include('api.urls')),\n url(r'^feeds/', include('feeds.urls')), \n url(r'^reconcile/', include('reconciliation.urls')),\n url(r'^download/', include('downloads.urls')),\n url(r'', include('django.contrib.flatpages.urls'))\n) ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf.urls.static import static", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 42 }, { "span": "from django.conf import settings", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "include_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "._", "static_", "import_", "static_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Templa", "te", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "the", " ", "next", " ", "two", " ", "lines", " ", "to", " ", "enable", " ", "the", " ", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "autodiscover", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "url", "(", "r", "'", "^", "$", "',", " ", "'", "fec", "reader", ".", "views", ".", "home", "',", " ", "name", "='", "home", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "url", "(", "r", "'", "^", "fec", "reader", "/'", ",", " ", "include", "('", "fec", "reader", ".", "foo", ".", "urls", "'))", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "the", " ", "admin", "/", "doc", " ", "line", " ", "belo", "w", " ", "to", " ", "enable", " ", "admin", " ", "documentation", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "url", "(", "r", "'", "^", "admin", "/", "doc", "/'", ",", " ", "include", "('", "django", ".", "contrib", ".", "admin", "docs", ".", "urls", "'))", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Unco", "mmen", "t", " ", "the", " ", "next", " ", "line", " ", "to", " ", "enable", " ", "the", " ", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "admin", "/'_", ",_", "include_", "(_", "admin_", "._", "site_", "._", "urls_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "base", "/$'_", ",_", "Templa", "te", "View_", "._", "as", "\\u", "view_", "(_", "template", "\\u", "name_", "=_", "\"", "dry", "rub", "/", "base", ".", "html", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "style", "test", "/$'_", ",_", "Templa", "te", "View_", "._", "as", "\\u", "view_", "(_", "template", "\\u", "name_", "=_", "\"", "test\\u", "template", "s", "/", "style", "test", ".", "html", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "''_", ",_", "include_", "(_", "'", "public", "\\u", "views", ".", "datap", "age", "s", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "api", "/'_", ",_", "include_", "(_", "'", "api", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "feed", "s", "/'_", ",_", "include_", "(_", "'", "feed", "s", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "reconcile", "/'_", ",_", "include_", "(_", "'", "recon", "cil", "iation", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "download", "/'_", ",_", "include_", "(_", "'", "download", "s", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "''_", ",_", "include_", "(_", "'", "django", ".", "contrib", ".", "flat", "page", "s", ".", "urls", "'_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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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 ]
Except block handles 'BaseException'
sahana/eden/modules/s3db/budget.py
[ { "content": " @staticmethod\n def budget_budget_onaccept(form):\n \"\"\"\n Calculate totals for the budget\n \"\"\"\n\n try:\n budget_entity_id = form.vars.budget_entity_id\n except:\n return\n budget_budget_totals(budget_entity_id)\n return", "metadata": "root.S3BudgetModel.budget_budget_onaccept", "header": "['class', 'S3BudgetModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 441 }, { "content": " @staticmethod\n def budget_staff_onaccept(form):\n \"\"\"\n Staff type has been updated => update totals of all budgets with\n this staff type\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n linktable = current.s3db.budget_budget_staff\n budget_entity_id = linktable.budget_entity_id\n query = (linktable.staff_id == record_id)\n rows = current.db(query).select(budget_entity_id,\n groupby=budget_entity_id)\n for row in rows:\n budget_budget_totals(row.budget_entity_id)\n return", "metadata": "root.S3BudgetModel.budget_staff_onaccept", "header": "['class', 'S3BudgetModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 455 }, { "content": " @staticmethod\n def budget_location_onaccept(form):\n \"\"\"\n Location has been updated => update totals of all budgets with\n staff at this location\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n linktable = current.s3db.budget_budget_staff\n budget_entity_id = linktable.budget_entity_id\n query = (linktable.location_id == record_id)\n rows = current.db(query).select(budget_entity_id,\n groupby=budget_entity_id)\n for row in rows:\n budget_budget_totals(row.budget_entity_id)\n return", "metadata": "root.S3BudgetModel.budget_location_onaccept", "header": "['class', 'S3BudgetModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 476 }, { "content": " @staticmethod\n def budget_budget_staff_onaccept(form):\n \"\"\"\n Budget staff has been updated => update totals of the budget\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n table = current.s3db.budget_budget_staff\n row = current.db(table.id == record_id).select(table.budget_entity_id,\n limitby=(0, 1)).first()\n if row:\n budget_budget_totals(row.budget_entity_id)\n return", "metadata": "root.S3BudgetModel.budget_budget_staff_onaccept", "header": "['class', 'S3BudgetModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 497 }, { "content": " @staticmethod\n def budget_budget_staff_ondelete(row):\n \"\"\"\n Budget staff has been deleted => update totals of the budget\n \"\"\"\n\n db = current.db\n linktable = current.s3db.budget_budget_staff\n try:\n record_id = row.id\n except:\n return\n link = db(linktable.id == record_id).select(linktable.deleted_fk,\n limitby=(0, 1)).first()\n if link:\n deleted_fk = json.loads(link.deleted_fk)\n budget_entity_id = deleted_fk.get(\"budget_entity_id\")\n if budget_entity_id:\n budget_budget_totals(budget_entity_id)\n return", "metadata": "root.S3BudgetModel.budget_budget_staff_ondelete", "header": "['class', 'S3BudgetModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 515 }, { "content": " @staticmethod\n def budget_kit_onaccept(form):\n \"\"\"\n Calculate totals for the kit\n \"\"\"\n try:\n kit_id = form.vars.id\n except:\n return\n budget_kit_totals(kit_id)\n return", "metadata": "root.S3BudgetKitModel.budget_kit_onaccept", "header": "['class', 'S3BudgetKitModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 807 }, { "content": " @staticmethod\n def budget_item_onaccept(form):\n \"\"\"\n Calculate totals for all kits and bundles with this item\n \"\"\"\n db = current.db\n s3db = current.s3db\n\n try:\n item_id = form.vars.id\n except:\n return\n\n # Update totals of all kits with this item\n linktable = s3db.budget_kit_item\n kit_id = linktable.kit_id\n rows = db(linktable.item_id == item_id).select(kit_id,\n groupby=kit_id)\n kit_ids = set()\n for row in rows:\n kit_id = row.kit_id\n budget_kit_totals(kit_id)\n kit_ids.add(kit_id)\n\n # Find all bundles which have just been updated by budget_kit_totals\n if kit_ids:\n linktable = s3db.budget_bundle_kit\n bundle_id = linktable.bundle_id\n rows = db(linktable.kit_id.belongs(kit_ids)).select(bundle_id,\n groupby=bundle_id)\n already_updated = [row.bundle_id for row in rows]\n else:\n already_updated = None\n\n # Update totals of all remaining bundles with this item\n linktable = s3db.budget_bundle_item\n bundle_id = linktable.bundle_id\n query = (linktable.item_id == item_id)\n if already_updated:\n query &= ~(linktable.bundle_id.belongs(already_updated))\n rows = db(query).select(bundle_id, groupby=bundle_id)\n for row in rows:\n budget_bundle_totals(kit_id)\n return", "metadata": "root.S3BudgetKitModel.budget_item_onaccept", "header": "['class', 'S3BudgetKitModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 820 }, { "content": " @staticmethod\n def budget_kit_item_onaccept(form):\n \"\"\"\n Kit item has been updated => update totals of the kit\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n table = current.s3db.budget_kit_item\n row = current.db(table.id == record_id).select(table.kit_id,\n limitby=(0, 1)).first()\n if row:\n budget_kit_totals(row.kit_id)\n return", "metadata": "root.S3BudgetKitModel.budget_kit_item_onaccept", "header": "['class', 'S3BudgetKitModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 866 }, { "content": " @staticmethod\n def budget_kit_item_ondelete(row):\n \"\"\"\n Kit item has been deleted => update totals of the kit\n \"\"\"\n\n db = current.db\n linktable = current.s3db.budget_kit_item\n try:\n record_id = row.id\n except:\n return\n link = db(linktable.id == record_id).select(linktable.deleted_fk,\n limitby=(0, 1)).first()\n if link:\n deleted_fk = json.loads(link.deleted_fk)\n kit_id = deleted_fk.get(\"kit_id\")\n if kit_id:\n budget_kit_totals(kit_id)\n return", "metadata": "root.S3BudgetKitModel.budget_kit_item_ondelete", "header": "['class', 'S3BudgetKitModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 884 }, { "content": " @staticmethod\n def budget_bundle_onaccept(form):\n \"\"\"\n Calculate totals for the bundle\n \"\"\"\n try:\n bundle_id = form.vars.id\n except:\n return\n budget_bundle_totals(bundle_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_bundle_onaccept", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1162 }, { "content": " @staticmethod\n def budget_bundle_item_onaccept(form):\n \"\"\"\n Bundle item has been updated => update totals of the bundle\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n table = current.s3db.budget_bundle_item\n row = current.db(table.id == record_id).select(table.bundle_id,\n limitby=(0, 1)).first()\n if row:\n budget_bundle_totals(row.bundle_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_bundle_item_onaccept", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1175 }, { "content": " @staticmethod\n def budget_bundle_item_ondelete(row):\n \"\"\"\n Bundle item has been deleted => update totals of the bundle\n \"\"\"\n\n db = current.db\n linktable = current.s3db.budget_bundle_item\n try:\n record_id = row.id\n except:\n return\n link = db(linktable.id == record_id).select(linktable.deleted_fk,\n limitby=(0, 1)).first()\n if link:\n deleted_fk = json.loads(link.deleted_fk)\n bundle_id = deleted_fk.get(\"bundle_id\")\n if bundle_id:\n budget_bundle_totals(bundle_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_bundle_item_ondelete", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1193 }, { "content": " @staticmethod\n def budget_bundle_kit_onaccept(form):\n \"\"\"\n Bundle kit has been updated => update totals of the bundle\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n table = current.s3db.budget_bundle_kit\n row = current.db(table.id == record_id).select(table.bundle_id,\n limitby=(0, 1)).first()\n if row:\n budget_bundle_totals(row.bundle_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_bundle_kit_onaccept", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1215 }, { "content": " @staticmethod\n def budget_bundle_kit_ondelete(row):\n \"\"\"\n Bundle kit has been deleted => update totals of the bundle\n \"\"\"\n\n db = current.db\n linktable = current.s3db.budget_bundle_kit\n try:\n record_id = row.id\n except:\n return\n link = db(linktable.id == record_id).select(linktable.deleted_fk,\n limitby=(0, 1)).first()\n if link:\n deleted_fk = json.loads(link.deleted_fk)\n bundle_id = deleted_fk.get(\"bundle_id\")\n if bundle_id:\n budget_bundle_totals(bundle_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_bundle_kit_ondelete", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1233 }, { "content": " @staticmethod\n def budget_budget_bundle_onaccept(form):\n \"\"\"\n Budget bundle has been updated => update totals of the budget\n \"\"\"\n\n try:\n record_id = form.vars.id\n except:\n return\n table = current.s3db.budget_budget_bundle\n row = current.db(table.id == record_id).select(table.budget_entity_id,\n limitby=(0, 1)).first()\n if row:\n budget_budget_totals(row.budget_entity_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_budget_bundle_onaccept", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1255 }, { "content": " @staticmethod\n def budget_budget_bundle_ondelete(row):\n \"\"\"\n Budget bundle has been deleted => update totals of the budget\n \"\"\"\n\n db = current.db\n linktable = current.s3db.budget_budget_bundle\n try:\n record_id = row.id\n except:\n return\n link = db(linktable.id == record_id).select(linktable.deleted_fk,\n limitby=(0, 1)).first()\n if link:\n deleted_fk = json.loads(link.deleted_fk)\n budget_entity_id = deleted_fk.get(\"budget_entity_id\")\n if budget_entity_id:\n budget_budget_totals(budget_entity_id)\n return", "metadata": "root.S3BudgetBundleModel.budget_budget_bundle_ondelete", "header": "['class', 'S3BudgetBundleModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1273 } ]
[ { "span": "except:", "start_line": 449, "start_column": 8, "end_line": 449, "end_column": 15 }, { "span": "except:", "start_line": 464, "start_column": 8, "end_line": 464, "end_column": 15 }, { "span": "except:", "start_line": 485, "start_column": 8, "end_line": 485, "end_column": 15 }, { "span": "except:", "start_line": 505, "start_column": 8, "end_line": 505, "end_column": 15 }, { "span": "except:", "start_line": 525, "start_column": 8, "end_line": 525, "end_column": 15 }, { "span": "except:", "start_line": 814, "start_column": 8, "end_line": 814, "end_column": 15 }, { "span": "except:", "start_line": 830, "start_column": 8, "end_line": 830, "end_column": 15 }, { "span": "except:", "start_line": 874, "start_column": 8, "end_line": 874, "end_column": 15 }, { "span": "except:", "start_line": 894, "start_column": 8, "end_line": 894, "end_column": 15 }, { "span": "except:", "start_line": 1169, "start_column": 8, "end_line": 1169, "end_column": 15 }, { "span": "except:", "start_line": 1183, "start_column": 8, "end_line": 1183, "end_column": 15 }, { "span": "except:", "start_line": 1203, "start_column": 8, "end_line": 1203, "end_column": 15 }, { "span": "except:", "start_line": 1223, "start_column": 8, "end_line": 1223, "end_column": 15 }, { "span": "except:", "start_line": 1243, "start_column": 8, "end_line": 1243, "end_column": 15 }, { "span": "except:", "start_line": 1263, "start_column": 8, "end_line": 1263, "end_column": 15 }, { "span": "except:", "start_line": 1283, "start_column": 8, "end_line": 1283, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "budget", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "totals", " ", "for", " ", "the", " ", "budget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "entity", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "budget", "\\u", "entity", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "budget", "\\u", "budget", "\\u", "totals_", "(_", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "sta", "ff", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sta", "ff", " ", "type", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "all", " ", "budget", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "sta", "ff", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "staff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "entity", "\\u", "id_", "=_", "linkt", "able_", "._", "budget", "\\u", "entity", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "(_", "linkt", "able_", "._", "sta", "ff", "\\u", "id_", "==_", "record", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "current_", "._", "db_", "(_", "query_", ")_", "._", "select_", "(_", "budget", "\\u", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "groupby_", "=_", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "row_", "._", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "location", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Locat", "ion", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "all", " ", "budget", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "sta", "ff", " ", "at", " ", "this", " ", "location", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "staff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "entity", "\\u", "id_", "=_", "linkt", "able_", "._", "budget", "\\u", "entity", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "(_", "linkt", "able_", "._", "location", "\\u", "id_", "==_", "record", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "current_", "._", "db_", "(_", "query_", ")_", "._", "select_", "(_", "budget", "\\u", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "groupby_", "=_", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "row_", "._", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "budget", "\\u", "sta", "ff", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bud", "get", " ", "sta", "ff", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "budget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "staff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "current_", "._", "db_", "(_", "table_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "table_", "._", "budget", "\\u", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "row_", "._", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "budget", "\\u", "sta", "ff", "\\u", "ondelete_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bud", "get", " ", "sta", "ff", " ", "has", " ", "bee", "n", " ", "delete", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "budget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "staff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "row_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "db_", "(_", "linkt", "able_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "linkt", "able_", "._", "delete", "d\\u", "fk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "d\\u", "fk_", "=_", "json_", "._", "loads_", "(_", "link_", "._", "delete", "d\\u", "fk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "entity", "\\u", "id_", "=_", "delete", "d\\u", "fk_", "._", "get_", "(_", "\"", "budget", "\\u", "entity", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "budget", "\\u", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\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_", "S", "3", "Bud", "get", "Kit", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "kit", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "totals", " ", "for", " ", "the", " ", "kit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kit", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "budget", "\\u", "kit", "\\u", "totals_", "(_", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Kit", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "item", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "totals", " ", "for", " ", "all", " ", "kit", "s", " ", "and", " ", "bundle", "s", " ", "with", " ", "this", " ", "item", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3db_", "=_", "current_", "._", "s3db_", "\\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 ", " _", "item", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "totals", " ", "of", " ", "all", " ", "kit", "s", " ", "with", " ", "this", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linkt", "able_", "=_", "s3db_", "._", "budget", "\\u", "kit", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kit", "\\u", "id_", "=_", "linkt", "able_", "._", "kit", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "db_", "(_", "linkt", "able_", "._", "item", "\\u", "id_", "==_", "item", "\\u", "id_", ")_", "._", "select_", "(_", "kit", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "groupby_", "=_", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kit", "\\u", "ids_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kit", "\\u", "id_", "=_", "row_", "._", "kit", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "kit", "\\u", "totals_", "(_", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kit", "\\u", "ids_", "._", "add_", "(_", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "all", " ", "bundle", "s", " ", "whi", "ch", " ", "have", " ", "just", " ", "bee", "n", " ", "update", "d", " ", "by", " ", "budget", "\\u", "kit", "\\u", "totals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "kit", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linkt", "able_", "=_", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "kit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "id_", "=_", "linkt", "able_", "._", "bundle", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "db_", "(_", "linkt", "able_", "._", "kit", "\\u", "id_", "._", "belo", "ngs_", "(_", "kit", "\\u", "ids_", ")_", ")_", "._", "select_", "(_", "bundle", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "groupby_", "=_", "bundle", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "\\u", "updated_", "=_", "[_", "row_", "._", "bundle", "\\u", "id_", "for_", "row_", "in_", "rows_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alr", "ead", "y", "\\u", "updated_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "totals", " ", "of", " ", "all", " ", "rema", "inin", "g", " ", "bundle", "s", " ", "with", " ", "this", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linkt", "able_", "=_", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "id_", "=_", "linkt", "able_", "._", "bundle", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "(_", "linkt", "able_", "._", "item", "\\u", "id_", "==_", "item", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "alr", "ead", "y", "\\u", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "&=_", "~_", "(_", "linkt", "able_", "._", "bundle", "\\u", "id_", "._", "belo", "ngs_", "(_", "alr", "ead", "y", "\\u", "updated_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rows_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "bundle", "\\u", "id_", ",_", "groupby_", "=_", "bundle", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Kit", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "kit", "\\u", "item", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Kit", " ", "item", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "kit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "kit", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "current_", "._", "db_", "(_", "table_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "table_", "._", "kit", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "kit", "\\u", "totals_", "(_", "row_", "._", "kit", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Kit", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "kit", "\\u", "item", "\\u", "ondelete_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Kit", " ", "item", " ", "has", " ", "bee", "n", " ", "delete", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "kit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "kit", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "row_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "db_", "(_", "linkt", "able_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "linkt", "able_", "._", "delete", "d\\u", "fk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "d\\u", "fk_", "=_", "json_", "._", "loads_", "(_", "link_", "._", "delete", "d\\u", "fk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kit", "\\u", "id_", "=_", "delete", "d\\u", "fk_", "._", "get_", "(_", "\"", "kit", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kit", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "kit", "\\u", "totals_", "(_", "kit", "\\u", "id_", ")_", "\\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_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "bundle", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "totals", " ", "for", " ", "the", " ", "bundle", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bundle", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "bundle", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "bundle", "\\u", "item", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bun", "dle", " ", "item", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "bundle", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "current_", "._", "db_", "(_", "table_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "table_", "._", "bundle", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "row_", "._", "bundle", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "bundle", "\\u", "item", "\\u", "ondelete_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bun", "dle", " ", "item", " ", "has", " ", "bee", "n", " ", "delete", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "bundle", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "row_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "db_", "(_", "linkt", "able_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "linkt", "able_", "._", "delete", "d\\u", "fk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "d\\u", "fk_", "=_", "json_", "._", "loads_", "(_", "link_", "._", "delete", "d\\u", "fk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "id_", "=_", "delete", "d\\u", "fk_", "._", "get_", "(_", "\"", "bundle", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bundle", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "bundle", "\\u", "id_", ")_", "\\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_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "bundle", "\\u", "kit", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bun", "dle", " ", "kit", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "bundle", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "kit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "current_", "._", "db_", "(_", "table_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "table_", "._", "bundle", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "row_", "._", "bundle", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "bundle", "\\u", "kit", "\\u", "ondelete_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bun", "dle", " ", "kit", " ", "has", " ", "bee", "n", " ", "delete", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "bundle", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "bundle", "\\u", "kit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "row_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "db_", "(_", "linkt", "able_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "linkt", "able_", "._", "delete", "d\\u", "fk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "d\\u", "fk_", "=_", "json_", "._", "loads_", "(_", "link_", "._", "delete", "d\\u", "fk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "id_", "=_", "delete", "d\\u", "fk_", "._", "get_", "(_", "\"", "bundle", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bundle", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "bundle", "\\u", "totals_", "(_", "bundle", "\\u", "id_", ")_", "\\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_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "budget", "\\u", "bundle", "\\u", "onac", "cept", "_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bud", "get", " ", "bundle", " ", "has", " ", "bee", "n", " ", "update", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "budget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "form_", "._", "vars_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "bundle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "current_", "._", "db_", "(_", "table_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "table_", "._", "budget", "\\u", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "row_", "._", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Bun", "dle", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "budget", "\\u", "budget", "\\u", "bundle", "\\u", "ondelete_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bud", "get", " ", "bundle", " ", "has", " ", "bee", "n", " ", "delete", "d", " ", "=>", " ", "update", " ", "totals", " ", "of", " ", "the", " ", "budget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linkt", "able_", "=_", "current_", "._", "s3db_", "._", "budget", "\\u", "budget", "\\u", "bundle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "id_", "=_", "row_", "._", "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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "db_", "(_", "linkt", "able_", "._", "id_", "==_", "record", "\\u", "id_", ")_", "._", "select_", "(_", "linkt", "able_", "._", "delete", "d\\u", "fk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "d\\u", "fk_", "=_", "json_", "._", "loads_", "(_", "link_", "._", "delete", "d\\u", "fk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "entity", "\\u", "id_", "=_", "delete", "d\\u", "fk_", "._", "get_", "(_", "\"", "budget", "\\u", "entity", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "budget", "\\u", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "budget", "\\u", "budget", "\\u", "totals_", "(_", "budget", "\\u", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/core/windows.py
[ { "content": "def valueControlGrp(name=None, create=False, dataType=None, slider=True, value=None, numberOfControls=1, **kwargs):\n \"\"\"\n This function allows for a simplified interface for automatically creating UI's to control numeric values.\n\n A dictionary of keywords shared by all controls can be created and passed to this function and settings which don't pertain\n to the element being created will will be ignore. For example, 'precision' will be ignored by all non-float UI and\n 'sliderSteps' will be ignore by all non-slider UIs.\n\n :Parameters:\n dataType : string or class type\n The dataType that the UI should control. It can be a type object or the string name of the type.\n For example for a boolean, you can specify 'bool' or pass in the bool class. Also, if the UI is meant to\n control an array, you can pass the type name as a stirng with a integer suffix representing the array length. ex. 'bool3'\n\n numberOfControls : int\n A parameter for specifying the number of controls per control group. For example, for a checkBoxGrp, numberOfControls\n will map to the 'numberOfCheckBoxes' keyword.\n\n slider : bool\n Specify whether or not sliders should be used for int and float controls. Ignored for other\n types, as well as for int and float arrays\n\n value : int, int list, bool, bool list, float, float list, string, unicode, Path, Vector,\n The value for the control. If the value is for an array type, it should be a list or tuple of the appropriate\n number of elements.\n\n A straightforward example:\n\n .. python::\n\n settings = {}\n settings['step'] = 1\n settings['precision'] = 3\n settings['vertical'] = True # for all checkBoxGrps, lay out vertically\n win = window()\n columnLayout()\n setUITemplate( 'attributeEditorTemplate', pushTemplate=1 )\n boolCtr = valueControlGrp( dataType='bool', label='bool', **settings)\n bool3Ctr = valueControlGrp( dataType='bool', label='bool', numberOfControls=3, **settings)\n intCtr = valueControlGrp( dataType=int, label='int', slider=False, **settings)\n intSldr = valueControlGrp( dataType=int, label='int', slider=True, **settings)\n int3Ctrl= valueControlGrp( dataType=int, label='int', numberOfControls=3, **settings)\n floatCtr = valueControlGrp( dataType=float, label='float', slider=False, **settings)\n floatSldr = valueControlGrp( dataType=float, label='float', slider=True, **settings)\n pathCtrl = valueControlGrp( dataType=Path, label='path', **settings)\n win.show()\n\n\n Here's an example of how this is meant to be used in practice:\n\n .. python::\n\n settings = {}\n settings['step'] = 1\n settings['precision'] = 3\n win = window()\n columnLayout()\n types=[ ( 'donuts?',\n bool,\n True ),\n # bool arrays have a special label syntax that allow them to pass sub-labels\n ( [ 'flavors', ['jelly', 'sprinkles', 'glazed']],\n 'bool3',\n [0,1,0]),\n ( 'quantity',\n int,\n 12 ),\n ( 'delivery time',\n float,\n .69)\n ]\n for label, dt, val in types:\n valueControlGrp( dataType=dt, label=label, value=val, **settings)\n win.show()\n\n \"\"\"\n import uitypes\n\n def makeGetter( ctrl, methodName, num ):\n def getter( ):\n res = []\n for i in range( num ):\n res.append( getattr(ctrl, methodName + str(i+1) )() )\n return res\n return getter\n\n def makeSetter( ctrl, methodName, num ):\n def setter( args ):\n for i in range( num ):\n getattr(ctrl, methodName + str(i+1) )(args[i])\n return setter\n\n # the options below are only valid for certain control types. they can always be passed to valueControlGrp, but\n # they will be ignore if not applicable to the control for this dataType. this allows you to create a\n # preset configuration and pass it to the valueControlGrp for every dataType -- no need for creating switches, afterall\n # that's the point of this function\n\n sliderArgs = [ 'sliderSteps', 'ss', 'dragCommand', 'dc' ]\n fieldArgs = [ 'field', 'f', 'fieldStep', 'fs', 'fieldMinValue', 'fmn', 'fieldMaxValue', 'fmx' ]\n fieldSliderArgs = ['step', 's', 'minValue', 'min', 'maxValue', 'max', 'extraLabel', 'el'] + sliderArgs + fieldArgs\n floatFieldArgs = ['precision', 'pre']\n verticalArgs = ['vertical', 'vr'] #checkBoxGrp and radioButtonGrp only\n\n if uitypes.PyUI._isBeingCreated(name, create, kwargs):\n assert dataType, \"You must pass a dataType when creating a new control\"\n if not isinstance(dataType, basestring):\n try:\n dataType = dataType.__name__\n except AttributeError:\n dataType = str(dataType)\n\n # if a dataType such as float3 or int2 was passed, get the number of ctrls\n try:\n buf = re.split( '(\\d+)', dataType )\n dataType = buf[0]\n numberOfControls = int(buf[1])\n except:\n pass\n else:\n # control command lets us get basic info even when we don't know the ui type\n dataType = control( name, q=1, docTag=1)\n assert dataType\n\n numberOfControls = int(numberOfControls)\n if numberOfControls < 1:\n numberOfControls = 1\n elif numberOfControls > 4:\n numberOfControls = 4\n\n #dataType = dataType.lower()\n kwargs.pop('dt',None)\n kwargs['docTag'] = dataType\n\n if dataType in [\"bool\"]:\n if numberOfControls > 1:\n kwargs.pop('ncb', None)\n kwargs['numberOfCheckBoxes'] = numberOfControls\n\n # remove field/slider and float kwargs\n for arg in fieldSliderArgs + floatFieldArgs:\n kwargs.pop(arg, None)\n\n # special label handling\n label = kwargs.get('label', kwargs.get('l',None) )\n if label is not None:\n # allow label passing with additional sub-labels:\n # ['mainLabel', ['subLabel1', 'subLabel2', 'subLabel3']]\n if _util.isIterable(label):\n label, labelArray = label\n kwargs.pop('l',None)\n kwargs['label'] = label\n kwargs['labelArray' + str(numberOfControls) ] = labelArray\n\n ctrl = uitypes.CheckBoxGrp( name, create, **kwargs )\n\n if numberOfControls > 1:\n getter = makeGetter(ctrl, 'getValue', numberOfControls)\n setter = makeSetter(ctrl, 'setValue', numberOfControls)\n else:\n getter = ctrl.getValue1\n setter = ctrl.setValue1\n #if hasDefault: ctrl.setValue1( int(default) )\n\n elif dataType in [\"int\"]:\n if numberOfControls > 1:\n kwargs.pop('nf', None)\n kwargs['numberOfFields'] = numberOfControls\n slider = False\n\n if slider:\n # remove float kwargs\n for arg in floatFieldArgs + verticalArgs:\n kwargs.pop(arg, None)\n # turn the field on by default\n if 'field' not in kwargs and 'f' not in kwargs:\n kwargs['field'] = True\n\n ctrl = uitypes.IntSliderGrp( name, create, **kwargs )\n getter = ctrl.getValue\n setter = ctrl.setValue\n else:\n # remove field/slider and float kwargs\n for arg in fieldSliderArgs + floatFieldArgs + verticalArgs:\n kwargs.pop(arg, None)\n ctrl = uitypes.IntFieldGrp( name, create, **kwargs )\n\n getter = ctrl.getValue1\n setter = ctrl.setValue1\n #if hasDefault: ctrl.setValue1( int(default) )\n\n elif dataType in [\"float\"]:\n if numberOfControls > 1:\n kwargs.pop('nf', None)\n kwargs['numberOfFields'] = numberOfControls\n slider = False\n\n if slider:\n for arg in verticalArgs:\n kwargs.pop(arg, None)\n\n # turn the field on by default\n if 'field' not in kwargs and 'f' not in kwargs:\n kwargs['field'] = True\n ctrl = uitypes.FloatSliderGrp( name, create, **kwargs )\n getter = ctrl.getValue\n setter = ctrl.setValue\n else:\n # remove field/slider kwargs\n for arg in fieldSliderArgs + verticalArgs:\n kwargs.pop(arg, None)\n ctrl = uitypes.FloatFieldGrp( name, create, **kwargs )\n getter = ctrl.getValue1\n setter = ctrl.setValue1\n #if hasDefault: ctrl.setValue1( float(default) )\n\n elif dataType in [\"vector\", \"Vector\"]:\n # remove field/slider kwargs\n for arg in fieldSliderArgs + floatFieldArgs + verticalArgs:\n kwargs.pop(arg, None)\n ctrl = VectorFieldGrp( name, create, **kwargs )\n getter = ctrl.getVector\n setter = ctrl.setValue1\n #if hasDefault: ctrl.setVector( default )\n\n elif dataType in [\"path\", \"Path\", \"FileReference\"]:# or pathreg.search( argName.lower() ):\n # remove field/slider kwargs\n for arg in fieldSliderArgs + floatFieldArgs + verticalArgs:\n kwargs.pop(arg, None)\n ctrl = PathButtonGrp( name, create, **kwargs )\n getter = ctrl.getPath\n setter = ctrl.setPath\n #if hasDefault: ctrl.setText( default.__repr__() )\n\n elif dataType in [\"string\", \"unicode\", \"str\"]:\n # remove field/slider kwargs\n for arg in fieldSliderArgs + floatFieldArgs + verticalArgs:\n kwargs.pop(arg, None)\n ctrl = uitypes.TextFieldGrp( name, create, **kwargs )\n getter = ctrl.getText\n setter = ctrl.setText\n #if hasDefault: ctrl.setText( str(default) )\n else:\n raise TypeError, \"Unsupported dataType: %s\" % dataType\n# else:\n# ctrl = uitypes.TextFieldGrp( l=labelStr )\n# getter = makeEvalGetter( ctrl.getText )\n# #setter = ctrl.setValue1\n# #if hasDefault: ctrl.setText( default.__repr__() )\n\n #new = ctrl( name, create, **kwargs )\n ctrl.getValue = getter\n ctrl.setValue = setter\n ctrl.dataType = ctrl.getDocTag\n\n if value is not None:\n ctrl.setValue(value)\n\n # TODO : remove setDocTag\n return ctrl", "metadata": "root.valueControlGrp", "header": "['module', '___EOS___']", "index": 653 } ]
[ { "span": "except:", "start_line": 769, "start_column": 8, "end_line": 769, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "value", "Control", "Grp_", "(_", "name_", "=_", "None_", ",_", "create_", "=_", "False_", ",_", "data", "Type_", "=_", "None_", ",_", "slider_", "=_", "True_", ",_", "value_", "=_", "None_", ",_", "number", "Of", "Controls_", "=_", "1_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "allow", "s", " ", "for", " ", "a", " ", "simplified", " ", "interface", " ", "for", " ", "automati", "call", "y", " ", "creati", "ng", " ", "UI", "'", "s", " ", "to", " ", "control", " ", "numeri", "c", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "of", " ", "keywords", " ", "shared", " ", "by", " ", "all", " ", "controls", " ", "can", " ", "be", " ", "created", " ", "and", " ", "pass", "ed", " ", "to", " ", "this", " ", "function", " ", "and", " ", "settings", " ", "whi", "ch", " ", "don", "'", "t", " ", "pert", "ain", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "element", " ", "bei", "ng", " ", "created", " ", "will", " ", "will", " ", "be", " ", "ignore", ".", " ", " ", "For", " ", "example", ",", " ", "'", "preci", "sion", "'", " ", "will", " ", "be", " ", "ignore", "d", " ", "by", " ", "all", " ", "non", "-", "float", " ", "UI", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "'", "slide", "r", "Step", "s", "'", " ", "will", " ", "be", " ", "ignore", " ", "by", " ", "all", " ", "non", "-", "slide", "r", " ", "UI", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "data", "Type", " ", ":", " ", "string", " ", "or", " ", "class", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "data", "Type", " ", "tha", "t", " ", "the", " ", "UI", " ", "shou", "ld", " ", "control", ".", " ", " ", "It", " ", "can", " ", "be", " ", "a", " ", "type", " ", "object", " ", "or", " ", "the", " ", "string", " ", "name", " ", "of", " ", "the", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", " ", "for", " ", "a", " ", "boolean", ",", " ", "you", " ", "can", " ", "speci", "fy", " ", "'", "bool", "'", " ", "or", " ", "pass", " ", "in", " ", "the", " ", "bool", " ", "class", ".", " ", "Al", "so", ",", " ", "if", " ", "the", " ", "UI", " ", "is", " ", "mean", "t", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "control", " ", "an", " ", "array", ",", " ", "you", " ", "can", " ", "pass", " ", "the", " ", "type", " ", "name", " ", "as", " ", "a", " ", "sti", "rng", " ", "with", " ", "a", " ", "integ", "er", " ", "suff", "ix", " ", "represent", "ing", " ", "the", " ", "array", " ", "length", ".", " ", "ex", ".", " ", "'", "bool", "3", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "number", "Of", "Control", "s", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "parameter", " ", "for", " ", "speci", "fy", "ing", " ", "the", " ", "number", " ", "of", " ", "controls", " ", "per", " ", "control", " ", "group", ".", " ", " ", "For", " ", "example", ",", " ", "for", " ", "a", " ", "check", "Box", "Grp", ",", " ", "number", "Of", "Control", "s", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "map", " ", "to", " ", "the", " ", "'", "number", "Of", "Check", "Boxes", "'", " ", "keyw", "ord", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "slide", "r", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", " ", "whe", "ther", " ", "or", " ", "not", " ", "slide", "rs", " ", "shou", "ld", " ", "be", " ", "used", " ", "for", " ", "int", " ", "and", " ", "float", " ", "controls", ".", " ", "Ignor", "ed", " ", "for", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "types", ",", " ", "as", " ", "well", " ", "as", " ", "for", " ", "int", " ", "and", " ", "float", " ", "arrays", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "value", " ", ":", " ", "int", ",", " ", "int", " ", "list", ",", " ", "bool", ",", " ", "bool", " ", "list", ",", " ", "float", ",", " ", "float", " ", "list", ",", " ", "string", ",", " ", "unicode", ",", " ", "Path", ",", " ", "Vector", ",", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "value", " ", "for", " ", "the", " ", "control", ".", " ", "If", " ", "the", " ", "value", " ", "is", " ", "for", " ", "an", " ", "array", " ", "type", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "or", " ", "tuple", " ", "of", " ", "the", " ", "appropr", "iate", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "of", " ", "element", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "straight", "forward", " ", "example", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "python", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "settings", " ", "=", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "settings", "['", "step", "']", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "settings", "['", "preci", "sion", "']", " ", "=", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "settings", "['", "vertical", "']", " ", "=", " ", "Tru", "e", " ", "#", " ", "for", " ", "all", " ", "check", "Box", "Grp", "s", ",", " ", "lay", " ", "out", " ", "vertical", "ly", "\\", "10", ";", " ", " ", " ", " ", "win", " ", "=", " ", "window", "()", "\\", "10", ";", " ", " ", " ", " ", "column", "Lay", "out", "()", "\\", "10", ";", " ", " ", " ", " ", "set", "UI", "Templa", "te", "(", " ", "'", "attribute", "Edit", "or", "Templa", "te", "',", " ", "push", "Templa", "te", "=", "1", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "bool", "Ct", "r", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "='", "bool", "',", " ", "label", "='", "bool", "',", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "bool", "3", "Ct", "r", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "='", "bool", "',", " ", "label", "='", "bool", "',", " ", "number", "Of", "Control", "s", "=", "3", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "int", "Ct", "r", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "int", ",", " ", "label", "='", "int", "',", " ", "slide", "r", "=", "Fal", "se", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "int", "Sl", "dr", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "int", ",", " ", "label", "='", "int", "',", " ", "slide", "r", "=", "Tru", "e", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "int", "3", "Ctrl", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "int", ",", " ", "label", "='", "int", "',", " ", "number", "Of", "Control", "s", "=", "3", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "float", "Ct", "r", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "float", ",", " ", "label", "='", "float", "',", " ", "slide", "r", "=", "Fal", "se", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "float", "Sl", "dr", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "float", ",", " ", "label", "='", "float", "',", " ", "slide", "r", "=", "Tru", "e", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "path", "Ctrl", " ", "=", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "Path", ",", " ", "label", "='", "path", "',", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "win", ".", "show", "()", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Her", "e", "'", "s", " ", "an", " ", "example", " ", "of", " ", "how", " ", "this", " ", "is", " ", "mean", "t", " ", "to", " ", "be", " ", "used", " ", "in", " ", "practic", "e", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "python", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "settings", " ", "=", " ", "{}", "\\", "10", ";", " ", " ", " ", " ", "settings", "['", "step", "']", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "settings", "['", "preci", "sion", "']", " ", "=", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "win", " ", "=", " ", "window", "()", "\\", "10", ";", " ", " ", " ", " ", "column", "Lay", "out", "()", "\\", "10", ";", " ", " ", " ", " ", "types", "=[", " ", "(", " ", "'", "don", "uts", "?'", ",", "\\", "10", ";", " ", " ", "bool", ",", "\\", "10", ";", " ", " ", "Tru", "e", " ", "),", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "bool", " ", "arrays", " ", "have", " ", "a", " ", "special", " ", "label", " ", "synta", "x", " ", "tha", "t", " ", "allow", " ", "them", " ", "to", " ", "pass", " ", "sub", "-", "labels", "\\", "10", ";", " ", " ", " ", " ", "(", " ", "[", " ", "'", "flavor", "s", "',", " ", "['", "jel", "ly", "',", " ", "'", "spri", "nk", "les", "',", " ", "'", "gla", "zed", "']]", ",", "\\", "10", ";", " ", " ", "'", "bool", "3", "',", "\\", "10", ";", " ", " ", "[", "0", ",", "1", ",", "0", "])", ",", "\\", "10", ";", " ", " ", " ", " ", "(", " ", "'", "quanti", "ty", "',", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "int", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "1", "2", " ", "),", "\\", "10", ";", " ", " ", " ", " ", "(", " ", "'", "delivery", " ", "time", "',", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "float", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", ".6", "9", ")", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "label", ",", " ", "dt", ",", " ", "val", " ", "in", " ", "types", ":", "\\", "10", ";", " ", " ", " ", " ", "value", "Control", "Grp", "(", " ", "data", "Type", "=", "dt", ",", " ", "label", "=", "label", ",", " ", "value", "=", "val", ",", " ", "**", "settings", ")", "\\", "10", ";", " ", " ", " ", " ", "win", ".", "show", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uit", "ypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "Getter", "_", "(_", "ctrl_", ",_", "method", "Name_", ",_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "getter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "getattr_", "(_", "ctrl_", ",_", "method", "Name_", "+_", "str_", "(_", "i_", "+_", "1_", ")_", ")_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Setter", "_", "(_", "ctrl_", ",_", "method", "Name_", ",_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setter_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "ctrl_", ",_", "method", "Name_", "+_", "str_", "(_", "i_", "+_", "1_", ")_", ")_", "(_", "args_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "options", " ", "belo", "w", " ", "are", " ", "only", " ", "valid", " ", "for", " ", "cert", "ain", " ", "control", " ", "types", ".", " ", " ", "the", "y", " ", "can", " ", "alw", "ay", "s", " ", "be", " ", "pass", "ed", " ", "to", " ", "value", "Control", "Grp", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "will", " ", "be", " ", "ignore", " ", "if", " ", "not", " ", "applica", "ble", " ", "to", " ", "the", " ", "control", " ", "for", " ", "this", " ", "data", "Type", ".", " ", " ", "this", " ", "allow", "s", " ", "you", " ", "to", " ", "create", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prese", "t", " ", "configura", "tion", " ", "and", " ", "pass", " ", "it", " ", "to", " ", "the", " ", "value", "Control", "Grp", " ", "for", " ", "every", " ", "data", "Type", " ", "--", " ", "no", " ", "need", " ", "for", " ", "creati", "ng", " ", "switche", "s", ",", " ", "after", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", "'", "s", " ", "the", " ", "point", " ", "of", " ", "this", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slide", "r", "Args_", "=_", "[_", "'", "slide", "r", "Step", "s", "'_", ",_", "'", "ss", "'_", ",_", "'", "drag", "Command", "'_", ",_", "'", "dc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "Args_", "=_", "[_", "'", "field", "'_", ",_", "'", "f", "'_", ",_", "'", "field", "Step", "'_", ",_", "'", "fs", "'_", ",_", "'", "field", "Min", "Value", "'_", ",_", "'", "fm", "n", "'_", ",_", "'", "field", "Max", "Value", "'_", ",_", "'", "fm", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "Slide", "r", "Args_", "=_", "[_", "'", "step", "'_", ",_", "'", "s", "'_", ",_", "'", "min", "Value", "'_", ",_", "'", "min", "'_", ",_", "'", "max", "Value", "'_", ",_", "'", "max", "'_", ",_", "'", "extra", "Label", "'_", ",_", "'", "el", "'_", "]_", "+_", "slide", "r", "Args_", "+_", "field", "Args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "Field", "Args_", "=_", "[_", "'", "preci", "sion", "'_", ",_", "'", "pre", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertical", "Args_", "=_", "[_", "'", "vertical", "'_", ",_", "'", "vr", "'_", "]_", "#", "check", "Box", "Grp", " ", "and", " ", "radio", "Butt", "on", "Grp", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "uit", "ypes_", "._", "Py", "UI_", "._", "\\u", "is", "Bei", "ng", "Created_", "(_", "name_", ",_", "create_", ",_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "data", "Type_", ",_", "\"", "You", " ", "must", " ", "pass", " ", "a", " ", "data", "Type", " ", "whe", "n", " ", "creati", "ng", " ", "a", " ", "new", " ", "control", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "data", "Type_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Type_", "=_", "data", "Type_", "._", "\\u\\u", "name\\u\\u_", "\\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 ", " _", "data", "Type_", "=_", "str_", "(_", "data", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "a", " ", "data", "Type", " ", "suc", "h", " ", "as", " ", "float", "3", " ", "or", " ", "int2", " ", "was", " ", "pass", "ed", ",", " ", "get", " ", "the", " ", "number", " ", "of", " ", "ctrl", "s_", "\\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 ", " _", "buf_", "=_", "re_", "._", "split_", "(_", "'(\\\\", "d", "+)'_", ",_", "data", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Type_", "=_", "buf_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "Of", "Controls_", "=_", "int_", "(_", "buf_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "control", " ", "command", " ", "lets", " ", "us", " ", "get", " ", "basic", " ", "info", " ", "even", " ", "whe", "n", " ", "we", " ", "don", "'", "t", " ", "know", " ", "the", " ", "ui", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Type_", "=_", "control_", "(_", "name_", ",_", "q_", "=_", "1_", ",_", "doc", "Tag_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "number", "Of", "Controls_", "=_", "int_", "(_", "number", "Of", "Controls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "number", "Of", "Controls_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number", "Of", "Controls_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "number", "Of", "Controls_", ">_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number", "Of", "Controls_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", "Type", " ", "=", " ", "data", "Type", ".", "lower", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "._", "pop_", "(_", "'", "dt", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "doc", "Ta", "g", "'_", "]_", "=_", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data", "Type_", "in_", "[_", "\"", "bool", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "number", "Of", "Controls_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "'", "nc", "b", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "number", "Of", "Check", "Boxes", "'_", "]_", "=_", "number", "Of", "Controls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "and", " ", "float", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "float", "Field", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "label", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label_", "=_", "kwargs_", "._", "get_", "(_", "'", "label", "'_", ",_", "kwargs_", "._", "get_", "(_", "'", "l", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "allow", " ", "label", " ", "passi", "ng", " ", "with", " ", "addition", "al", " ", "sub", "-", "labels", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "['", "main", "Label", "',", " ", "['", "sub", "Label", "1", "',", " ", "'", "sub", "Label", "2", "',", " ", "'", "sub", "Label", "3", "']]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "util_", "._", "is", "Iterable_", "(_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", ",_", "label", "Array_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "pop_", "(_", "'", "l", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "label", "'_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "label", "Array", "'_", "+_", "str_", "(_", "number", "Of", "Controls_", ")_", "]_", "=_", "label", "Array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Check", "Box", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "number", "Of", "Controls_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter_", "=_", "make", "Getter", "_", "(_", "ctrl_", ",_", "'", "get", "Value", "'_", ",_", "number", "Of", "Controls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "make", "Setter", "_", "(_", "ctrl_", ",_", "'", "set", "Value", "'_", ",_", "number", "Of", "Controls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter_", "=_", "ctrl_", "._", "get", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Value", "1", "(", " ", "int", "(", "default", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "in_", "[_", "\"", "int", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "number", "Of", "Controls_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "'", "nf", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "number", "Of", "Field", "s", "'_", "]_", "=_", "number", "Of", "Controls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slider_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "float", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "float", "Field", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "turn", " ", "the", " ", "field", " ", "on", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "field", "'_", "not_", "in_", "kwargs_", "and_", "'", "f", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "field", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Int", "Slide", "r", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "and", " ", "float", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "float", "Field", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Int", "Field", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Value", "1", "(", " ", "int", "(", "default", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "in_", "[_", "\"", "float", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "number", "Of", "Controls_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "'", "nf", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "number", "Of", "Field", "s", "'_", "]_", "=_", "number", "Of", "Controls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slider_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "turn", " ", "the", " ", "field", " ", "on", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "field", "'_", "not_", "in_", "kwargs_", "and_", "'", "f", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "field", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Float", "Slide", "r", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Float", "Field", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Value", "1", "(", " ", "float", "(", "default", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "in_", "[_", "\"", "vector", "\"_", ",_", "\"", "Vector", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "float", "Field", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "Vector", "Field", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Vector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Value", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Vector", "(", " ", "default", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "in_", "[_", "\"", "path", "\"_", ",_", "\"", "Path", "\"_", ",_", "\"", "File", "Reference", "\"_", "]_", ":_", "#", " ", "or", " ", "path", "reg", ".", "search", "(", " ", "arg", "Name", ".", "lower", "()", " ", "):", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "float", "Field", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "Path", "Butt", "on", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Text", "(", " ", "default", ".\\u", "\\u", "repr", "\\u\\u()", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "in_", "[_", "\"", "string", "\"_", ",_", "\"", "unicode", "\"_", ",_", "\"", "str", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "field", "/", "slide", "r", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "arg_", "in_", "field", "Slide", "r", "Args_", "+_", "float", "Field", "Args_", "+_", "vertical", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "arg_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "uit", "ypes_", "._", "Text", "Field", "Grp_", "(_", "name_", ",_", "create_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "ctrl_", "._", "get", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "ctrl_", "._", "set", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Text", "(", " ", "str", "(", "default", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "\"", "Unsu", "ppo", "rted", " ", "data", "Type", ":", " ", "%", "s", "\"_", "%_", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ctrl", " ", "=", " ", "uit", "ype", "s", ".", "Text", "Field", "Grp", "(", " ", "l", "=", "label", "Str", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "getter", " ", "=", " ", "make", "Eval", "Getter", "(", " ", "ctrl", ".", "get", "Text", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "sette", "r", " ", "=", " ", "ctrl", ".", "set", "Value", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "if", " ", "has", "Default", ":", " ", "ctrl", ".", "set", "Text", "(", " ", "default", ".\\u", "\\u", "repr", "\\u\\u()", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "new", " ", "=", " ", "ctrl", "(", " ", "name", ",", " ", "create", ",", " ", "**", "kwarg", "s", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "._", "get", "Value_", "=_", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctrl_", "._", "set", "Value_", "=_", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctrl_", "._", "data", "Type_", "=_", "ctrl_", "._", "get", "Doc", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctrl_", "._", "set", "Value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "remove", " ", "set", "Doc", "Tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ctrl_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RobotLocomotion/director/src/python/director/footstepsdriver.py
[ { "content": "from director import lcmUtils\nfrom director import objectmodel as om\nfrom director import visualization as vis\nfrom director.utime import getUtime\nfrom director import transformUtils\nfrom director.debugVis import DebugData\nfrom director import ioUtils\nfrom director import robotstate\nfrom director import applogic as app\nfrom director import vtkAll as vtk\nfrom director.lcmframe import frameFromPositionMessage, positionMessageFromFrame\nfrom director.simpletimer import SimpleTimer\nfrom director.shallowCopy import shallowCopy\nfrom director import roboturdf\nfrom director import filterUtils\nimport director.vtkNumpy as vnp\n\nimport os\nimport math\nimport numpy as np\nfrom director import drcargs\nimport drc as lcmdrc\nfrom bot_core.pose_t import pose_t\nfrom bot_core.robot_state_t import robot_state_t\nimport functools\nimport json\n\nfrom PythonQt import QtGui, QtCore\n\n_footMeshes = None\n_footMeshFiles = []\n_robotType = 0 # 0 - any atlas, 1 - val v1, 2 - val v2\n_pelvisLink = '' # pelvis\n_leftFootLink = '' # l_foot\n_rightFootLink = '' # r_foot\nwith open(drcargs.args().directorConfigFile) as directorConfigFile:\n directorConfig = json.load(directorConfigFile)\n\n # dodgy use of filename to find valkyrie:\n if (directorConfigFile.name.find(\"valkyrie\") > -1):\n _robotType = 1\n if (directorConfigFile.name.find(\"val_description\") > -1):\n _robotType = 2\n\n directorConfigDirectory = os.path.dirname(os.path.abspath(directorConfigFile.name))\n\n if 'leftFootMeshFiles' in directorConfig:\n _footMeshFiles.append( directorConfig['leftFootMeshFiles'] )\n _footMeshFiles.append( directorConfig['rightFootMeshFiles'] )\n for j in range(0,2):\n for i in range(len(_footMeshFiles[j])):\n _footMeshFiles[j][i] = os.path.join(directorConfigDirectory, _footMeshFiles[j][i])\n\n if 'pelvisLink' in directorConfig:\n _pelvisLink = directorConfig['pelvisLink']\n\n if 'leftFootLink' in directorConfig:\n _leftFootLink = directorConfig['leftFootLink']\n _rightFootLink = directorConfig['rightFootLink']\n\nDEFAULT_PARAM_SET = 'Drake Nominal'\nDEFAULT_STEP_PARAMS = {'BDI': {'Min Num Steps': 0,\n 'Max Num Steps': 12,\n 'Min Step Width': 0.20,\n 'Nominal Step Width': 0.26,\n 'Nominal Forward Step': 0.15,\n 'Max Forward Step': 0.40,\n 'Max Step Width': 0.4,\n 'Max Upward Step': 0.18,\n 'Max Downward Step': 0.18,\n 'Behavior': 0,\n 'Leading Foot': 0,\n 'Swing Height': 0.05,\n 'Drake Swing Speed': 0.2,\n 'Drake Instep Shift': 0.0275,\n 'Drake Min Hold Time': 2.0,\n 'Support Contact Groups': 0,\n 'Prevent Swing Undershoot': 0,\n 'Prevent Swing Overshoot': 0,\n 'Map Mode': 0,\n 'IHMC Transfer Time': 0.75,\n 'IHMC Swing Time': 1.2},\n 'Drake Nominal': {'Min Num Steps': 0,\n 'Max Num Steps': 16,\n 'Min Step Width': 0.20,\n 'Nominal Step Width': 0.26,\n 'Nominal Forward Step': 0.26,\n 'Max Forward Step': 0.30,\n 'Max Step Width': 0.32,\n 'Max Upward Step': 0.18,\n 'Max Downward Step': 0.18,\n 'Behavior': 2,\n 'Leading Foot': 0,\n 'Swing Height': 0.03,\n 'Drake Swing Speed': 0.6,\n 'Drake Instep Shift': 0.005,\n 'Drake Min Hold Time': 1.0,\n 'Support Contact Groups': 0,\n 'Prevent Swing Undershoot': 0,\n 'Prevent Swing Overshoot': 0,\n 'Map Mode': 0,\n 'IHMC Transfer Time': 0.75,\n 'IHMC Swing Time': 1.2},\n 'IHMC Nominal': {'Min Num Steps': 0,\n 'Max Num Steps': 16,\n 'Min Step Width': 0.20,\n 'Nominal Step Width': 0.26,\n 'Nominal Forward Step': 0.26,\n 'Max Forward Step': 0.30,\n 'Max Step Width': 0.32,\n 'Max Upward Step': 0.18,\n 'Max Downward Step': 0.18,\n 'Behavior': 2,\n 'Leading Foot': 0,\n 'Swing Height': 0.05,\n 'Drake Swing Speed': 0.2,\n 'Drake Instep Shift': 0.0275,\n 'Drake Min Hold Time': 2.0,\n 'Support Contact Groups': 0,\n 'Prevent Swing Undershoot': 0,\n 'Prevent Swing Overshoot': 0,\n 'Map Mode': 0,\n 'IHMC Transfer Time': 0.75,\n 'IHMC Swing Time': 1.2}}\nDEFAULT_STEP_PARAMS['Terrain'] = DEFAULT_STEP_PARAMS['Drake Nominal'].copy()\nDEFAULT_STEP_PARAMS['Terrain'].update({'Drake Min Hold Time': 1.0,\n 'Drake Swing Speed': 0.6,\n 'Swing Height': 0.05,\n 'Max Forward Step': 0.36,\n 'Max Num Steps': 6,\n 'Nominal Step Width': 0.22,\n 'Map Mode': 1})\nDEFAULT_STEP_PARAMS['Stairs'] = DEFAULT_STEP_PARAMS['Drake Nominal'].copy()\nDEFAULT_STEP_PARAMS['Stairs'].update({'Drake Min Hold Time': 2.0,\n 'Swing Height': 0.05,\n 'Max Num Steps': 8,\n 'Min Num Steps': 8,\n 'Drake Swing Speed': 0.6,\n 'Support Contact Groups': lcmdrc.footstep_params_t.SUPPORT_GROUPS_MIDFOOT_TOE,\n 'Map Mode': 2})\n\nDEFAULT_STEP_PARAMS['Polaris Platform'] = DEFAULT_STEP_PARAMS['Drake Nominal'].copy()\nDEFAULT_STEP_PARAMS['Polaris Platform'].update({'Drake Min Hold Time': 2.0,\n 'Prevent Swing Undershoot': 1,\n 'Swing Height': 0.05,\n 'Map Mode': 1})\n\nDEFAULT_CONTACT_SLICES = {(0.05, 0.3): np.array([[-0.13, -0.13, 0.13, 0.13],\n [0.0562, -0.0562, 0.0562, -0.0562]]),\n (0.3, .75): np.array([[-0.13, -0.13, 0.25, 0.25],\n [.25, -.25, .25, -.25]]),\n (0.75, 1.05): np.array([[-0.2, -0.2, 0.25, 0.25],\n [.4, -.4, .4, -.4]]),\n (1.05, 1.85): np.array([[-0.35, -0.35, 0.28, 0.28],\n [.4, -.4, .4, -.4]])\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def loadFootMeshes():\n meshes = []\n for i in range(0,2):\n d = DebugData()\n\n for footMeshFile in _footMeshFiles[i]:\n d.addPolyData(ioUtils.readPolyData( footMeshFile , computeNormals=True))\n\n t = vtk.vtkTransform()\n t.Scale(0.98, 0.98, 0.98)\n pd = filterUtils.transformPolyData(d.getPolyData(), t)\n meshes.append(pd)\n return meshes", "metadata": "root.loadFootMeshes", "header": "['module', '___EOS___']", "index": 158 }, { "content": "def getLeftFootMesh():\n return shallowCopy(getFootMeshes()[0])", "metadata": "root.getLeftFootMesh", "header": "['module', '___EOS___']", "index": 173 }, { "content": "def getRightFootMesh():\n return shallowCopy(getFootMeshes()[1])", "metadata": "root.getRightFootMesh", "header": "['module', '___EOS___']", "index": 177 }, { "content": "def getLeftFootColor():\n return [1.0, 1.0, 0.0]", "metadata": "root.getLeftFootColor", "header": "['module', '___EOS___']", "index": 181 }, { "content": "def getRightFootColor():\n return [0.33, 1.0, 0.0]", "metadata": "root.getRightFootColor", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def getFootMeshes():\n global _footMeshes\n if not _footMeshes:\n _footMeshes = loadFootMeshes()\n return _footMeshes", "metadata": "root.getFootMeshes", "header": "['module', '___EOS___']", "index": 190 }, { "content": "def getFootstepsFolder():\n obj = om.findObjectByName('footstep plan')\n if obj is None:\n obj = om.getOrCreateContainer('footstep plan', parentObj=om.getOrCreateContainer('planning'))\n obj.setIcon(om.Icons.Feet)\n om.collapse(obj)\n return obj", "metadata": "root.getFootstepsFolder", "header": "['module', '___EOS___']", "index": 197 }, { "content": "def getWalkingVolumesFolder():\n obj = om.findObjectByName('walking volumes')\n if obj is None:\n obj = om.getOrCreateContainer('walking volumes', parentObj=getFootstepsFolder())\n om.collapse(obj)\n return obj", "metadata": "root.getWalkingVolumesFolder", "header": "['module', '___EOS___']", "index": 205 }, { "content": "def getTerrainSlicesFolder():\n obj = om.findObjectByName('terrain slices')\n if obj is None:\n obj = om.getOrCreateContainer('terrain slices', parentObj=getFootstepsFolder())\n obj.setProperty('Visible', False)\n om.collapse(obj)\n return obj", "metadata": "root.getTerrainSlicesFolder", "header": "['module', '___EOS___']", "index": 212 }, { "content": "def getBDIAdjustedFootstepsFolder():\n obj = om.findObjectByName('BDI adj footstep plan')\n if obj is None:\n obj = om.getOrCreateContainer('BDI adj footstep plan')\n obj.setIcon(om.Icons.Feet)\n om.collapse(obj)\n return obj", "metadata": "root.getBDIAdjustedFootstepsFolder", "header": "['module', '___EOS___']", "index": 220 }, { "content": "class FootstepPlanItem(om.ObjectModelItem):\n pass", "metadata": "root.FootstepPlanItem", "header": "['module', '___EOS___']", "index": 229 }, { "content": "class WalkingPlanItem(om.ObjectModelItem):\n pass", "metadata": "root.WalkingPlanItem", "header": "['module', '___EOS___']", "index": 233 }, { "content": "class FootstepsDriver(object):\n\n\n\n\n\n\n\n\n ##############################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ####################### BDI Adjustment Logic and Visualization ##################\n\n\n\n", "metadata": "root.FootstepsDriver", "header": "['module', '___EOS___']", "index": 237 }, { "content": " def __init__(self, jointController):\n self.jointController = jointController\n self.lastFootstepPlan = None\n self.lastFootstepRequest = None\n self.goalSteps = None\n self.lastWalkingPlan = None\n self.walkingPlanCallback = None\n self.default_step_params = DEFAULT_STEP_PARAMS\n self.contact_slices = DEFAULT_CONTACT_SLICES\n self.show_contact_slices = False\n self.toolbarWidget = None\n\n ### Stuff pertaining to rendering BDI-frame steps\n self.pose_bdi = None\n self.bdi_plan = None\n self.bdi_plan_adjusted = None\n\n view = app.getDRCView()\n self.bdiRobotModel, self.bdiJointController = roboturdf.loadRobotModel('bdi model', view, parent='bdi model', color=roboturdf.getRobotOrangeColor(), visible=False)\n self.bdiRobotModel.setProperty('Visible', False)\n self.showBDIPlan = False # hide the BDI plans when created\n self.bdiChannel = \"POSE_BDI\"\n self.bdiSubcribe = None\n #enable this to used the bdi model to render a different state\n #self.bdiJointController.addLCMUpdater(\"EST_ROBOT_STATE_ALT\")\n\n self._setupSubscriptions()\n self._setupProperties()\n\n self.showToolbarWidget()\n # If we're a consoleapp and have no main window execButton won't exist\n if hasattr(self, 'execButton'):\n self.execButton.setEnabled(False)\n\n self.committedPlans = []", "metadata": "root.FootstepsDriver.__init__", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 239 }, { "content": " def _setupProperties(self):\n self.params = om.ObjectModelItem('Footstep Params')\n self.defaults_map = ['Drake Nominal', 'BDI', 'IHMC Nominal', 'Terrain', 'Stairs', 'Polaris Platform']\n self.params.addProperty('Defaults', 0, attributes=om.PropertyAttributes(enumNames=self.defaults_map))\n self.params.addProperty('Behavior', 0, attributes=om.PropertyAttributes(enumNames=['BDI Stepping', 'BDI Walking', 'Drake Walking']))\n self.params.addProperty('Leading Foot', 1, attributes=om.PropertyAttributes(enumNames=['Auto', 'Left', 'Right']))\n self.leading_foot_map = [lcmdrc.footstep_plan_params_t.LEAD_AUTO,\n lcmdrc.footstep_plan_params_t.LEAD_LEFT,\n lcmdrc.footstep_plan_params_t.LEAD_RIGHT]\n # self.params.addProperty('Map Command', 0, attributes=om.PropertyAttributes(enumNames=['Full Heightmap', 'Flat Ground', 'Z Normals']))\n self.params.addProperty('Map Mode', 0, attributes=om.PropertyAttributes(enumNames=['Foot Plane', 'Terrain Heights & Normals', 'Terrain Heights, Z Normals', 'Horizontal Plane']))\n self.map_mode_map = [\n lcmdrc.footstep_plan_params_t.FOOT_PLANE,\n lcmdrc.footstep_plan_params_t.TERRAIN_HEIGHTS_AND_NORMALS,\n lcmdrc.footstep_plan_params_t.TERRAIN_HEIGHTS_Z_NORMALS,\n lcmdrc.footstep_plan_params_t.HORIZONTAL_PLANE\n ]\n # self.params.addProperty('Heights Source', attributes=om.PropertyAttributes(enumNames=['Map Data', 'Foot Plane']))\n # self.params.addProperty('Normals Source', attributes=om.PropertyAttributes(enumNames=['Map Data', 'Foot Plane']))\n self.params.addProperty('Min Num Steps', None, attributes=om.PropertyAttributes(decimals=0, minimum=0, maximum=30, singleStep=1))\n self.params.addProperty('Max Num Steps', None, attributes=om.PropertyAttributes(decimals=0, minimum=1, maximum=30, singleStep=1))\n self.params.addProperty('Min Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.1, maximum=0.35, singleStep=0.01))\n self.params.addProperty('Nominal Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.21, maximum=0.4, singleStep=0.01))\n self.params.addProperty('Max Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.22, maximum=0.5, singleStep=0.01))\n self.params.addProperty('Nominal Forward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))\n self.params.addProperty('Max Forward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))\n self.params.addProperty('Swing Height', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.005))\n self.params.addProperty('Max Upward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))\n self.params.addProperty('Max Downward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))\n self.params.addProperty('Drake Swing Speed', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.05, maximum=5.0, singleStep=0.05))\n self.params.addProperty('Drake Min Hold Time', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=10.0, singleStep=0.05))\n self.params.addProperty('Drake Instep Shift', None, attributes=om.PropertyAttributes(decimals=4, minimum=-0.3, maximum=0.3, singleStep=0.0005))\n self.behavior_lcm_map = {\n 0: lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_STEPPING,\n 1: lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_WALKING,\n 2: lcmdrc.footstep_plan_params_t.BEHAVIOR_WALKING}\n self.params.addProperty('Planner Mode', 0, attributes=om.PropertyAttributes(enumNames=['Fast MIQP', 'Slow MISOCP']))\n self.params.addProperty('Support Contact Groups', 0, attributes=om.PropertyAttributes(enumNames=['Whole Foot', 'Front 2/3', 'Back 2/3']))\n self.params.addProperty('Prevent Swing Undershoot', 0, attributes=om.PropertyAttributes(enumNames=['False', 'True']))\n self.params.addProperty('Prevent Swing Overshoot', 0, attributes=om.PropertyAttributes(enumNames=['False', 'True']))\n self.params.addProperty('IHMC Transfer Time', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.6, maximum=5.0, singleStep=0.05))\n self.params.addProperty('IHMC Swing Time', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.6, maximum=5.0, singleStep=0.05))\n\n self.applyDefaults(DEFAULT_PARAM_SET)", "metadata": "root.FootstepsDriver._setupProperties", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 276 }, { "content": " def applyDefaults(self, set_name):\n defaults = self.default_step_params[set_name]\n for k, v in defaults.iteritems():\n self.params.setProperty(k, v)", "metadata": "root.FootstepsDriver.applyDefaults", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def _setupSubscriptions(self):\n\n useHistoricalLoader = False\n historicalLoader = lcmUtils.HistoricalLCMLoader('drc', 'software/drc_lcmtypes/lcmtypes', os.getenv('DRC_BASE')) if useHistoricalLoader else None\n\n lcmUtils.addSubscriber('FOOTSTEP_PLAN_RESPONSE', lcmdrc.footstep_plan_t, self.onFootstepPlan, historicalLoader)\n lcmUtils.addSubscriber('WALKING_TRAJ_RESPONSE', lcmdrc.robot_plan_t, self.onWalkingPlan)\n lcmUtils.addSubscriber('WALKING_SIMULATION_TRAJ_RESPONSE', lcmdrc.robot_plan_t, self.onWalkingPlan)\n\n ### Related to BDI-frame adjustment:\n self.bdiSubcribe = lcmUtils.addSubscriber( self.bdiChannel , pose_t, self.onPoseBDI)\n self.bdiSubcribe.setSpeedLimit(60)\n sub2 = lcmUtils.addSubscriber('BDI_ADJUSTED_FOOTSTEP_PLAN', lcmdrc.footstep_plan_t, self.onBDIAdjustedFootstepPlan)\n sub2.setSpeedLimit(1) # was 5 but was slow rendering", "metadata": "root.FootstepsDriver._setupSubscriptions", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 326 }, { "content": " def changeSubscriptionBDI(self, newBDIChannel=\"POSE_BDI\"):\n # used to monitor a different pose e.g. POSE_BODY_LOGGED in playback\n self.bdiChannel = newBDIChannel\n lcmUtils.removeSubscriber ( self.bdiSubcribe )\n\n self.bdiSubcribe = lcmUtils.addSubscriber( self.bdiChannel , pose_t, self.onPoseBDI)\n self.bdiSubcribe.setSpeedLimit(60)", "metadata": "root.FootstepsDriver.changeSubscriptionBDI", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 341 }, { "content": " def getDefaultStepParams(self):\n default_step_params = lcmdrc.footstep_params_t()\n default_step_params.step_speed = self.params.properties.drake_swing_speed\n default_step_params.drake_min_hold_time = self.params.properties.drake_min_hold_time\n default_step_params.drake_instep_shift = self.params.properties.drake_instep_shift\n default_step_params.step_height = self.params.properties.swing_height\n default_step_params.constrain_full_foot_pose = True\n default_step_params.bdi_step_duration = 2.0\n default_step_params.bdi_sway_duration = 0.0\n default_step_params.bdi_lift_height = 0.065\n default_step_params.bdi_toe_off = 1\n default_step_params.bdi_knee_nominal = 0.0\n default_step_params.bdi_max_foot_vel = 0.0\n default_step_params.bdi_sway_end_dist = 0.02\n default_step_params.bdi_step_end_dist = 0.02\n default_step_params.mu = 1.0\n default_step_params.ihmc_transfer_time = self.params.properties.ihmc_transfer_time\n default_step_params.ihmc_swing_time = self.params.properties.ihmc_swing_time\n\n default_step_params.support_contact_groups = self.params.properties.support_contact_groups\n default_step_params.prevent_swing_undershoot = self.params.properties.prevent_swing_undershoot\n default_step_params.prevent_swing_overshoot = self.params.properties.prevent_swing_overshoot\n return default_step_params", "metadata": "root.FootstepsDriver.getDefaultStepParams", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 352 }, { "content": " def onWalkingPlan(self, msg):\n self.lastWalkingPlan = msg\n if self.walkingPlanCallback:\n self.walkingPlanCallback(self.lastWalkingPlan)", "metadata": "root.FootstepsDriver.onWalkingPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 376 }, { "content": " def onBDIAdjustedFootstepPlan(self, msg):\n folder = getBDIAdjustedFootstepsFolder()\n om.removeFromObjectModel(folder)\n folder = getBDIAdjustedFootstepsFolder()\n self.drawFootstepPlan(msg, folder)", "metadata": "root.FootstepsDriver.onBDIAdjustedFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 381 }, { "content": " def onFootstepPlan(self, msg):\n #self.clearFootstepPlan()\n self.lastFootstepPlan = msg\n\n planFolder = getFootstepsFolder()\n self.drawFootstepPlan( self.lastFootstepPlan , planFolder)\n self.transformPlanToBDIFrame( self.lastFootstepPlan )\n self.showToolbarWidget()", "metadata": "root.FootstepsDriver.onFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 387 }, { "content": " def showToolbarWidget(self):\n\n if app.getMainWindow() is None:\n return\n\n if self.toolbarWidget:\n self.execButton.setEnabled(True)\n return\n\n w = QtGui.QWidget()\n l = QtGui.QHBoxLayout(w)\n\n label = QtGui.QLabel('Walk plan:')\n execButton = QtGui.QPushButton('')\n execButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_MediaPlay))\n clearButton = QtGui.QPushButton('')\n clearButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_TrashIcon))\n stopButton = QtGui.QPushButton('')\n stopButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_MediaStop))\n\n l.addWidget(label)\n l.addWidget(execButton)\n l.addWidget(stopButton)\n l.addWidget(clearButton)\n l.setContentsMargins(0, 0, 0, 0)\n\n execButton.setShortcut(QtGui.QKeySequence('Ctrl+Return'))\n execButton.connect('clicked()', self.onExecClicked)\n clearButton.connect('clicked()', self.onClearClicked)\n stopButton.connect('clicked()', self.sendStopWalking)\n\n self.execButton = execButton\n self.stopButton = stopButton\n self.toolbarWidget = app.getMainWindow().toolBar().addWidget(w)\n self.execButton.show()", "metadata": "root.FootstepsDriver.showToolbarWidget", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 397 }, { "content": " def onExecClicked(self):\n self.commitFootstepPlan(self.lastFootstepPlan)\n\n om.removeFromObjectModel(om.findObjectByName('footstep widget'))\n walkGoal = om.findObjectByName('walking goal')\n if walkGoal:\n walkGoal.setProperty('Edit', False)\n self.execButton.setEnabled(False)", "metadata": "root.FootstepsDriver.onExecClicked", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 433 }, { "content": " def onClearClicked(self):\n om.removeFromObjectModel(om.findObjectByName('walking goal'))\n om.removeFromObjectModel(om.findObjectByName('footstep widget'))\n om.removeFromObjectModel(om.findObjectByName('LCM GL'))\n self.clearFootstepPlan()\n\n if self.toolbarWidget:\n self.execButton.setEnabled(False)", "metadata": "root.FootstepsDriver.onClearClicked", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 443 }, { "content": " def clearFootstepPlan(self):\n self.lastFootstepPlan = None\n om.removeFromObjectModel(getFootstepsFolder())", "metadata": "root.FootstepsDriver.clearFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 452 }, { "content": " def drawFootstepPlan(self, msg, folder, left_color=None, right_color=None, alpha=1.0):\n for step in folder.children():\n om.removeFromObjectModel(step)\n allTransforms = []\n volFolder = getWalkingVolumesFolder()\n map(om.removeFromObjectModel, volFolder.children())\n slicesFolder = getTerrainSlicesFolder()\n map(om.removeFromObjectModel, slicesFolder.children())\n\n\n for i, footstep in enumerate(msg.footsteps):\n trans = footstep.pos.translation\n trans = [trans.x, trans.y, trans.z]\n quat = footstep.pos.rotation\n quat = [quat.w, quat.x, quat.y, quat.z]\n\n footstepTransform = transformUtils.transformFromPose(trans, quat)\n\n allTransforms.append(footstepTransform)\n\n\n if i < 2:\n continue\n\n if footstep.is_right_foot:\n mesh = getRightFootMesh()\n if (right_color is None):\n color = getRightFootColor()\n else:\n color = right_color\n else:\n mesh = getLeftFootMesh()\n if (left_color is None):\n color = getLeftFootColor()\n else:\n color = left_color\n\n # add gradual shading to steps to indicate destination\n frac = float(i)/ float(msg.num_steps-1)\n this_color = [0,0,0]\n this_color[0] = 0.25*color[0] + 0.75*frac*color[0]\n this_color[1] = 0.25*color[1] + 0.75*frac*color[1]\n this_color[2] = 0.25*color[2] + 0.75*frac*color[2]\n\n\n if self.show_contact_slices:\n self.drawContactVolumes(footstepTransform, color)\n\n contact_pts_left, contact_pts_right = FootstepsDriver.getContactPts()\n if footstep.is_right_foot:\n sole_offset = np.mean(contact_pts_right, axis=0)\n else:\n sole_offset = np.mean(contact_pts_left, axis=0)\n\n t_sole_prev = frameFromPositionMessage(msg.footsteps[i-2].pos)\n t_sole_prev.PreMultiply()\n t_sole_prev.Translate(sole_offset)\n t_sole = transformUtils.copyFrame(footstepTransform)\n t_sole.Translate(sole_offset)\n yaw = np.arctan2(t_sole.GetPosition()[1] - t_sole_prev.GetPosition()[1],\n t_sole.GetPosition()[0] - t_sole_prev.GetPosition()[0])\n T_terrain_to_world = transformUtils.frameFromPositionAndRPY([t_sole_prev.GetPosition()[0], t_sole_prev.GetPosition()[1], 0],\n [0, 0, math.degrees(yaw)])\n path_dist = np.array(footstep.terrain_path_dist)\n height = np.array(footstep.terrain_height)\n # if np.any(height >= trans[2]):\n terrain_pts_in_local = np.vstack((path_dist, np.zeros(len(footstep.terrain_path_dist)), height))\n d = DebugData()\n for j in range(terrain_pts_in_local.shape[1]-1):\n d.addLine(terrain_pts_in_local[:,j], terrain_pts_in_local[:,j+1], radius=0.01)\n obj = vis.showPolyData(d.getPolyData(), 'terrain slice', parent=slicesFolder, visible=slicesFolder.getProperty('Visible'), color=[.8,.8,.3])\n obj.actor.SetUserTransform(T_terrain_to_world)\n\n renderInfeasibility = False\n if renderInfeasibility and footstep.infeasibility > 1e-6:\n d = DebugData()\n start = allTransforms[i-1].GetPosition()\n end = footstepTransform.GetPosition()\n d.addArrow(start, end, 0.02, 0.005,\n startHead=True,\n endHead=True)\n vis.showPolyData(d.getPolyData(), 'infeasibility %d -> %d' % (i-2, i-1), parent=folder, color=[1, 0.2, 0.2])\n\n stepName = 'step %d' % (i-1)\n\n obj = vis.showPolyData(mesh, stepName, color=this_color, alpha=alpha, parent=folder)\n obj.setIcon(om.Icons.Feet)\n frameObj = vis.showFrame(footstepTransform, stepName + ' frame', parent=obj, scale=0.3, visible=False)\n obj.actor.SetUserTransform(footstepTransform)\n obj.addProperty('Support Contact Groups', footstep.params.support_contact_groups, attributes=om.PropertyAttributes(enumNames=['Whole Foot', 'Front 2/3', 'Back 2/3']))\n obj.properties.setPropertyIndex('Support Contact Groups', 0)\n obj.footstep_index = i\n obj.footstep_property_callback = obj.properties.connectPropertyChanged(functools.partial(self.onFootstepPropertyChanged, obj))\n\n self.drawContactPts(obj, footstep, color=this_color)", "metadata": "root.FootstepsDriver.drawFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 456 }, { "content": " def drawContactVolumes(self, footstepTransform, color):\n volFolder = getWalkingVolumesFolder()\n for zs, xy in self.contact_slices.iteritems():\n points0 = np.vstack((xy, zs[0] + np.zeros((1,xy.shape[1]))))\n points1 = np.vstack((xy, zs[1] + np.zeros((1,xy.shape[1]))))\n points = np.hstack((points0, points1))\n points = points + np.array([[0.05],[0],[-0.0811]])\n points = points.T\n polyData = vnp.getVtkPolyDataFromNumpyPoints(points.copy())\n vol_mesh = filterUtils.computeDelaunay3D(polyData)\n obj = vis.showPolyData(vol_mesh, 'walking volume', parent=volFolder, alpha=0.5, visible=self.show_contact_slices, color=color)\n obj.actor.SetUserTransform(footstepTransform)", "metadata": "root.FootstepsDriver.drawContactVolumes", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 552 }, { "content": " def onFootstepPropertyChanged(self, obj, propertySet, propertyName):\n if propertyName == \"Support Contact Groups\":\n self.lastFootstepPlan.footsteps[obj.footstep_index].params.support_contact_groups = obj.properties.support_contact_groups\n self.sendUpdatePlanRequest()", "metadata": "root.FootstepsDriver.onFootstepPropertyChanged", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 565 }, { "content": " def drawContactPts(self, obj, footstep, **kwargs):\n leftPoints, rightPoints = FootstepsDriver.getContactPts(footstep.params.support_contact_groups)\n contact_pts = rightPoints if footstep.is_right_foot else leftPoints\n\n d = DebugData()\n for pt in contact_pts:\n d.addSphere(pt, radius=0.01)\n d_obj = vis.showPolyData(d.getPolyData(), \"contact points\", parent=obj, **kwargs)\n d_obj.actor.SetUserTransform(obj.actor.GetUserTransform())", "metadata": "root.FootstepsDriver.drawContactPts", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 570 }, { "content": " @staticmethod\n def getContactPts(support_contact_groups = lcmdrc.footstep_params_t.SUPPORT_GROUPS_HEEL_TOE):\n '''\n hard coded Location of the Drake contact points relative to foot frame. this should be read from URDF\n '''\n contact_pts_left = np.zeros((4,3))\n contact_pts_right = np.zeros((4,3))\n\n if (_robotType == 0):\n # atlas\n if support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_HEEL_TOE:\n contact_pts_left[0,:] = [-0.0876, 0.0626, -0.07645]\n contact_pts_left[1,:] = [-0.0876, -0.0626, -0.07645]\n contact_pts_left[2,:] = [0.1728, 0.0626, -0.07645]\n contact_pts_left[3,:] = [0.1728, -0.0626, -0.07645]\n elif support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_MIDFOOT_TOE:\n contact_pts_left[0,:] = [-0.0008, 0.0626, -0.07645]\n contact_pts_left[1,:] = [-0.0008, -0.0626, -0.07645]\n contact_pts_left[2,:] = [0.1728, 0.0626, -0.07645]\n contact_pts_left[3,:] = [0.1728, -0.0626, -0.07645]\n elif support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_HEEL_MIDFOOT:\n contact_pts_left[0,:] = [-0.0876, 0.0626, -0.07645]\n contact_pts_left[1,:] = [-0.0876, -0.0626, -0.07645]\n contact_pts_left[2,:] = [0.086, 0.0626, -0.07645]\n contact_pts_left[3,:] = [0.086, -0.0626, -0.07645]\n else:\n raise ValueError(\"Unrecognized support contact group: {:d}\".format(support_contact_groups))\n\n contact_pts_right = contact_pts_left.copy()\n\n if (_robotType == 1):\n #val v1\n contact_pts_left[0,:] = [0.110, 0.0624435, -0.22]\n contact_pts_left[1,:] = [0.110,-0.0624435, -0.22]\n contact_pts_left[2,:] = [0.075, 0.0624435, 0.0775]\n contact_pts_left[3,:] = [0.075,-0.0624435, 0.0775]\n contact_pts_right[0,:] = [0.075, 0.0624435, -0.0775]\n contact_pts_right[1,:] = [0.075,-0.0624435, -0.0775]\n contact_pts_right[2,:] = [0.110, 0.0624435, 0.22]\n contact_pts_right[3,:] = [0.110,-0.0624435, 0.22]\n\n if (_robotType == 2):\n #val v2 (NOTE: at the moment, function createFootstepList in lcm2ros_ihmc.cpp depends on\n #these values (taken from ihmc code: ValkyriePhysicalProperties.java))\n if support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_HEEL_TOE:\n contact_pts_left[0,:] = [-0.038, 0.055, -0.09]\n contact_pts_left[1,:] = [-0.038, -0.055, -0.09]\n contact_pts_left[2,:] = [0.172, 0.055, -0.09]\n contact_pts_left[3,:] = [0.172, -0.055, -0.09]\n elif support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_MIDFOOT_TOE:\n contact_pts_left[0,:] = [0.032, 0.055, -0.09]\n contact_pts_left[1,:] = [0.032, -0.055, -0.09]\n contact_pts_left[2,:] = [0.172, 0.055, -0.09]\n contact_pts_left[3,:] = [0.172, -0.055, -0.09]\n elif support_contact_groups == lcmdrc.footstep_params_t.SUPPORT_GROUPS_HEEL_MIDFOOT:\n contact_pts_left[0,:] = [-0.038, 0.055, -0.09]\n contact_pts_left[1,:] = [-0.038, -0.055, -0.09]\n contact_pts_left[2,:] = [0.102, 0.055, -0.09]\n contact_pts_left[3,:] = [0.102, -0.055, -0.09]\n else:\n raise ValueError(\"Unrecognized support contact group: {:d}\".format(support_contact_groups))\n\n contact_pts_right = contact_pts_left.copy()\n\n return contact_pts_left, contact_pts_right", "metadata": "root.FootstepsDriver.getContactPts", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 580 }, { "content": " @staticmethod\n def getFeetMidPoint(model, useWorldZ=True):\n '''\n Returns a frame in world coordinate system that is the average of the left\n and right foot reference point positions in world frame, the average of the\n left and right foot yaw in world frame, and Z axis aligned with world Z.\n The foot reference point is the average of the foot contact points in the foot frame.\n '''\n contact_pts_left, contact_pts_right = FootstepsDriver.getContactPts()\n\n contact_pts_mid_left = np.mean(contact_pts_left, axis=0) # mid point on foot relative to foot frame\n contact_pts_mid_right = np.mean(contact_pts_right, axis=0) # mid point on foot relative to foot frame\n\n t_lf_mid = model.getLinkFrame(_leftFootLink)\n t_lf_mid.PreMultiply()\n t_lf_mid.Translate(contact_pts_mid_left)\n\n t_rf_mid = model.getLinkFrame(_rightFootLink)\n t_rf_mid.PreMultiply()\n t_rf_mid.Translate(contact_pts_mid_right)\n\n if (_robotType == 0): # Atlas\n t_feet_mid = transformUtils.frameInterpolate(t_lf_mid, t_rf_mid, 0.5)\n elif (_robotType == 1):\n # Valkyrie v1 Foot orientation is silly\n l_foot_sole = transformUtils.frameFromPositionAndRPY([0,0,0], [180.0, 82.5, 0])\n l_foot_sole.PostMultiply()\n l_foot_sole.Concatenate(t_lf_mid)\n r_foot_sole = transformUtils.frameFromPositionAndRPY([0,0,0], [0.0, -82.5, 0])\n r_foot_sole.PostMultiply()\n r_foot_sole.Concatenate(t_rf_mid)\n t_feet_mid = transformUtils.frameInterpolate(l_foot_sole, r_foot_sole, 0.5)\n elif (_robotType == 2):\n # Valkyrie v2 is better\n t_feet_mid = transformUtils.frameInterpolate(t_lf_mid, t_rf_mid, 0.5)\n\n\n if useWorldZ:\n rpy = [0.0, 0.0, np.degrees(transformUtils.rollPitchYawFromTransform(t_feet_mid)[2])]\n return transformUtils.frameFromPositionAndRPY(t_feet_mid.GetPosition(), rpy)\n else:\n return t_feet_mid", "metadata": "root.FootstepsDriver.getFeetMidPoint", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 646 }, { "content": " @staticmethod\n def debugDrawFootPoints(model):\n pts_left, pts_right = FootstepsDriver.getContactPts()\n d = DebugData()\n\n for linkName in [_leftFootLink, _rightFootLink]:\n\n t = model.getLinkFrame(linkName)\n d.addFrame(t, scale=0.2)\n\n if (linkName is _leftFootLink):\n pts = pts_left\n else:\n pts = pts_right\n\n footMidPoint = np.mean(pts, axis=0)\n for p in pts.tolist() + [footMidPoint.tolist()]:\n t.TransformPoint(p, p)\n d.addSphere(p, radius=0.015)\n\n midpt = FootstepsDriver.getFeetMidPoint(model)\n d.addFrame(midpt, scale=0.2)\n vis.showPolyData(d.getPolyData(), 'foot points debug', parent='debug', colorByName='RGB255')", "metadata": "root.FootstepsDriver.debugDrawFootPoints", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 690 }, { "content": " def createGoalSteps(self, model, pose):\n distanceForward = 1.0\n\n fr = model.getLinkFrame(_leftFootLink)\n fl = model.getLinkFrame(_rightFootLink)\n pelvisT = model.getLinkFrame(_pelvisLink)\n\n xaxis = [1.0, 0.0, 0.0]\n pelvisT.TransformVector(xaxis, xaxis)\n xaxis = np.array(xaxis)\n zaxis = np.array([0.0, 0.0, 1.0])\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n\n numGoalSteps = 3\n is_right_foot = True\n self.goalSteps = []\n for i in range(numGoalSteps):\n t = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n if is_right_foot:\n t.Translate(fr.GetPosition())\n else:\n t.Translate(fl.GetPosition())\n t.Translate(xaxis*distanceForward)\n distanceForward += 0.15\n is_right_foot = not is_right_foot\n step = lcmdrc.footstep_t()\n step.pos = positionMessageFromFrame(t)\n step.is_right_foot = is_right_foot\n step.params = self.getDefaultStepParams()\n self.goalSteps.append(step)\n\n request = self.constructFootstepPlanRequest(pose)\n request.num_goal_steps = len(self.goalSteps)\n request.goal_steps = self.goalSteps\n\n self.sendFootstepPlanRequest(request)", "metadata": "root.FootstepsDriver.createGoalSteps", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 714 }, { "content": " def onStepModified(self, ndx, frameObj):\n self.lastFootstepPlan.footsteps[ndx+2].pos = positionMessageFromFrame(frameObj.transform)\n self.lastFootstepPlan.footsteps[ndx+2].fixed_x = True\n self.lastFootstepPlan.footsteps[ndx+2].fixed_y = True\n self.lastFootstepPlan.footsteps[ndx+2].fixed_yaw = True\n self.sendUpdatePlanRequest()", "metadata": "root.FootstepsDriver.onStepModified", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 753 }, { "content": " def sendUpdatePlanRequest(self):\n msg = lcmdrc.footstep_check_request_t()\n msg.initial_state = self.lastFootstepRequest.initial_state\n msg.footstep_plan = self.lastFootstepPlan\n msg.snap_to_terrain = True\n msg.compute_infeasibility = False\n self.sendFootstepPlanCheckRequest(msg)", "metadata": "root.FootstepsDriver.sendUpdatePlanRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 760 }, { "content": " def updateRequest(self):\n if self.lastFootstepRequest is not None:\n msg = self.lastFootstepRequest\n msg = self.applyParams(msg)\n self.sendFootstepPlanRequest(msg)", "metadata": "root.FootstepsDriver.updateRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 768 }, { "content": " def constructFootstepPlanRequest(self, pose, goalFrame=None):\n\n msg = lcmdrc.footstep_plan_request_t()\n msg.utime = getUtime()\n state_msg = robotstate.drakePoseToRobotState(pose)\n msg.initial_state = state_msg\n\n if goalFrame is None:\n goalFrame = vtk.vtkTransform()\n msg.goal_pos = positionMessageFromFrame(goalFrame)\n\n msg = self.applyParams(msg)\n msg = self.applySafeRegions(msg)\n return msg", "metadata": "root.FootstepsDriver.constructFootstepPlanRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 774 }, { "content": " def applyParams(self, msg):\n msg.params = lcmdrc.footstep_plan_params_t()\n msg.params.max_num_steps = self.params.properties.max_num_steps\n msg.params.min_num_steps = self.params.properties.min_num_steps\n msg.params.min_step_width = self.params.properties.min_step_width\n msg.params.nom_step_width = self.params.properties.nominal_step_width\n msg.params.max_step_width = self.params.properties.max_step_width\n msg.params.nom_forward_step = self.params.properties.nominal_forward_step\n msg.params.max_forward_step = self.params.properties.max_forward_step\n msg.params.nom_upward_step = self.params.properties.max_upward_step\n msg.params.nom_downward_step = self.params.properties.max_downward_step\n msg.params.planning_mode = self.params.properties.planner_mode\n msg.params.behavior = self.behavior_lcm_map[self.params.properties.behavior]\n # msg.params.use_map_heights = self.params.properties.heights_source == 0\n # msg.params.use_map_normals = self.params.properties.normals_source == 0\n msg.params.map_mode = self.map_mode_map[self.params.properties.map_mode]\n # msg.params.map_command = self.map_command_lcm_map[self.params.properties.map_command]\n msg.params.leading_foot = self.leading_foot_map[self.params.properties.leading_foot]\n msg.default_step_params = self.getDefaultStepParams()\n return msg", "metadata": "root.FootstepsDriver.applyParams", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 789 }, { "content": " def applySafeRegions(self, msg):\n safe_regions_folder = om.findObjectByName('Safe terrain regions')\n safe_terrain_regions = []\n if safe_regions_folder:\n for obj in safe_regions_folder.children():\n if obj.getProperty('Enabled for Walking'):\n safe_terrain_regions.append(obj.safe_region)\n msg.num_iris_regions = len(safe_terrain_regions)\n for r in safe_terrain_regions:\n msg.iris_regions.append(r.to_iris_region_t())\n return msg", "metadata": "root.FootstepsDriver.applySafeRegions", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 810 }, { "content": " def sendFootstepPlanCheckRequest(self, request, waitForResponse=False, waitTimeout=5000):\n assert isinstance(request, lcmdrc.footstep_check_request_t)\n\n requestChannel = 'FOOTSTEP_CHECK_REQUEST'\n responseChannel = 'FOOTSTEP_PLAN_RESPONSE'\n\n if waitForResponse:\n if waitTimeout == 0:\n helper = lcmUtils.MessageResponseHelper(responseChannel, lcmdrc.footstep_plan_t)\n lcmUtils.publish(requestChannel, request)\n return helper\n return lcmUtils.MessageResponseHelper.publishAndWait(requestChannel, request,\n responseChannel, lcmdrc.footstep_plan_t, waitTimeout)\n else:\n lcmUtils.publish(requestChannel, request)", "metadata": "root.FootstepsDriver.sendFootstepPlanCheckRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 822 }, { "content": " def sendFootstepPlanRequest(self, request, waitForResponse=False, waitTimeout=5000):\n\n assert isinstance(request, lcmdrc.footstep_plan_request_t)\n self.lastFootstepRequest = request\n\n requestChannel = 'FOOTSTEP_PLAN_REQUEST'\n responseChannel = 'FOOTSTEP_PLAN_RESPONSE'\n\n if waitForResponse:\n if waitTimeout == 0:\n helper = lcmUtils.MessageResponseHelper(responseChannel, lcmdrc.footstep_plan_t)\n lcmUtils.publish(requestChannel, request)\n return helper\n return lcmUtils.MessageResponseHelper.publishAndWait(requestChannel, request,\n responseChannel, lcmdrc.footstep_plan_t, waitTimeout)\n else:\n lcmUtils.publish(requestChannel, request)", "metadata": "root.FootstepsDriver.sendFootstepPlanRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 838 }, { "content": " def sendWalkingPlanRequest(self, footstepPlan, startPose, waitForResponse=False, waitTimeout=5000, req_type='traj'):\n\n msg = lcmdrc.walking_plan_request_t()\n msg.utime = getUtime()\n state_msg = robotstate.drakePoseToRobotState(startPose)\n msg.initial_state = state_msg\n msg.new_nominal_state = msg.initial_state\n msg.use_new_nominal_state = True\n msg.footstep_plan = footstepPlan\n\n if req_type == 'traj':\n requestChannel = 'WALKING_TRAJ_REQUEST'\n responseChannel = 'WALKING_TRAJ_RESPONSE'\n response_type = lcmdrc.robot_plan_t\n elif req_type == 'controller':\n requestChannel = 'WALKING_CONTROLLER_PLAN_REQUEST'\n responseChannel = 'WALKING_CONTROLLER_PLAN_RESPONSE'\n response_type = lcmdrc.walking_plan_t\n elif req_type == 'simulate_drake':\n requestChannel = 'WALKING_SIMULATION_DRAKE_REQUEST'\n responseChannel = 'WALKING_SIMULATION_TRAJ_RESPONSE'\n response_type = lcmdrc.robot_plan_t\n else:\n raise ValueError(\"Invalid request type: {:s}\".format(req_type))\n\n if waitForResponse:\n if waitTimeout == 0:\n helper = lcmUtils.MessageResponseHelper(responseChannel, response_type)\n lcmUtils.publish(requestChannel, msg)\n return helper\n return lcmUtils.MessageResponseHelper.publishAndWait(requestChannel, msg,\n responseChannel, response_type, waitTimeout)\n else:\n lcmUtils.publish(requestChannel, msg)", "metadata": "root.FootstepsDriver.sendWalkingPlanRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 856 }, { "content": " def sendStopWalking(self):\n msg = lcmdrc.plan_control_t()\n msg.utime = getUtime()\n msg.control = lcmdrc.plan_control_t.TERMINATE\n lcmUtils.publish('STOP_WALKING', msg)", "metadata": "root.FootstepsDriver.sendStopWalking", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 891 }, { "content": " def commitFootstepPlan(self, footstepPlan):\n\n for previousPlan in self.committedPlans:\n if previousPlan.utime == footstepPlan.utime:\n raise Exception(\"Footstep plan was already executed. Execution of the plan is no longer allowed for safety reasons. You should request a new footstep plan.\")\n\n self.committedPlans.append(footstepPlan)\n self.drawFootstepPlan(footstepPlan, getFootstepsFolder(), alpha=0.3)\n\n if footstepPlan.params.behavior in (lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_STEPPING,\n lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_WALKING):\n self._commitFootstepPlanBDI(footstepPlan)\n elif footstepPlan.params.behavior == lcmdrc.footstep_plan_params_t.BEHAVIOR_WALKING:\n self._commitFootstepPlanDrake(footstepPlan)", "metadata": "root.FootstepsDriver.commitFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 897 }, { "content": " def _commitFootstepPlanDrake(self, footstepPlan):\n startPose = self.jointController.getPose('EST_ROBOT_STATE')\n self.sendWalkingPlanRequest(footstepPlan, startPose, req_type='controller')", "metadata": "root.FootstepsDriver._commitFootstepPlanDrake", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 912 }, { "content": " def _commitFootstepPlanBDI(self, footstepPlan):\n footstepPlan.utime = getUtime()\n lcmUtils.publish('COMMITTED_FOOTSTEP_PLAN', footstepPlan)", "metadata": "root.FootstepsDriver._commitFootstepPlanBDI", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 916 }, { "content": " def sendHaltSimulationDrakeRequest(self):\n msg = lcmdrc.utime_t()\n msg.utime = getUtime()\n lcmUtils.publish('HALT_DRAKE_SIMULATION', msg)", "metadata": "root.FootstepsDriver.sendHaltSimulationDrakeRequest", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 920 }, { "content": " def onPoseBDI(self,msg):\n self.pose_bdi = msg\n # Set the xyzrpy of this pose to equal that estimated by BDI\n rpy = transformUtils.quaternionToRollPitchYaw(msg.orientation)\n pose = self.jointController.q.copy()\n pose[0:3] = msg.pos\n pose[3:6] = rpy\n self.bdiJointController.setPose(\"ERS BDI\", pose)", "metadata": "root.FootstepsDriver.onPoseBDI", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 927 }, { "content": " def onBDIAdjustedFootstepPlan(self,msg):\n self.bdi_plan_adjusted = msg.decode( msg.encode() ) # decode and encode ensures deepcopy\n if (self.showBDIPlan is True):\n self.drawBDIFootstepPlanAdjusted()\n #else:\n # print \"not showing adjusted bdi plan\"", "metadata": "root.FootstepsDriver.onBDIAdjustedFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 936 }, { "content": " def transformPlanToBDIFrame(self, plan):\n if (self.pose_bdi is None):\n # print \"haven't received POSE_BDI\"\n return\n\n # TODO: This transformation should be rewritten using the LOCAL_TO_LOCAL_BDI frame\n # instead of using FK here\n\n t_bodybdi = transformUtils.transformFromPose(self.pose_bdi.pos, self.pose_bdi.orientation)\n t_bodybdi.PostMultiply()\n\n current_pose = self.jointController.q\n t_bodymain = transformUtils.transformFromPose( current_pose[0:3] , transformUtils.rollPitchYawToQuaternion(current_pose[3:6]) )\n t_bodymain.PostMultiply()\n\n # iterate and transform\n self.bdi_plan = plan.decode( plan.encode() ) # decode and encode ensures deepcopy\n for i, footstep in enumerate(self.bdi_plan.footsteps):\n step = footstep.pos\n\n t_step = frameFromPositionMessage(step)\n t_body_to_step = vtk.vtkTransform()\n t_body_to_step.DeepCopy(t_step)\n t_body_to_step.PostMultiply()\n t_body_to_step.Concatenate(t_bodymain.GetLinearInverse())\n\n t_stepbdi = vtk.vtkTransform()\n t_stepbdi.DeepCopy(t_body_to_step)\n t_stepbdi.PostMultiply()\n t_stepbdi.Concatenate(t_bodybdi)\n footstep.pos = positionMessageFromFrame(t_stepbdi)\n\n if (self.showBDIPlan is True):\n self.drawBDIFootstepPlan()\n #else:\n # print \"not showing bdi plan\"", "metadata": "root.FootstepsDriver.transformPlanToBDIFrame", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 943 }, { "content": " def drawBDIFootstepPlan(self):\n if (self.bdi_plan is None):\n return\n\n folder = om.getOrCreateContainer(\"BDI footstep plan\")\n om.removeFromObjectModel(folder)\n\n folder = om.getOrCreateContainer(\"BDI footstep plan\")\n folder.setIcon(om.Icons.Feet)\n om.collapse(folder)\n self.drawFootstepPlan(self.bdi_plan, folder, [0.0, 0.0, 1.0] , [1.0, 0.0, 0.0])", "metadata": "root.FootstepsDriver.drawBDIFootstepPlan", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 980 }, { "content": " def drawBDIFootstepPlanAdjusted(self):\n if (self.bdi_plan_adjusted is None):\n return\n\n folder = om.getOrCreateContainer('BDI adj footstep plan')\n om.removeFromObjectModel(folder)\n\n folder = om.getOrCreateContainer('BDI adj footstep plan')\n folder.setIcon(om.Icons.Feet)\n om.collapse(folder)\n self.drawFootstepPlan(self.bdi_plan_adjusted, folder, [1.0, 1.0, 0.0] , [0.0, 1.0, 1.0])", "metadata": "root.FootstepsDriver.drawBDIFootstepPlanAdjusted", "header": "['class', 'FootstepsDriver', '(', 'object', ')', ':', '___EOS___']", "index": 992 }, { "content": "class FootstepRequestGenerator(object):\n\n\n\n\n", "metadata": "root.FootstepRequestGenerator", "header": "['module', '___EOS___']", "index": 1005 }, { "content": " def __init__(self, footstepsDriver):\n self.footstepsDriver = footstepsDriver", "metadata": "root.FootstepRequestGenerator.__init__", "header": "['class', 'FootstepRequestGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 1007 }, { "content": " @staticmethod\n def getRobotStanceFrame(robotModel):\n return FootstepsDriver.getFeetMidPoint(robotModel)", "metadata": "root.FootstepRequestGenerator.getRobotStanceFrame", "header": "['class', 'FootstepRequestGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 1010 }, { "content": " @staticmethod\n def makeStepFrames(stepFrames, relativeFrame=None, showFrames=False):\n\n frames = []\n for i, stepFrame in enumerate(stepFrames):\n\n stepFrame = transformUtils.frameFromPositionAndRPY(stepFrame, [0,0,0])\n stepFrame.PostMultiply()\n if relativeFrame:\n stepFrame.Concatenate(relativeFrame)\n\n if showFrames:\n obj = vis.updateFrame(stepFrame, 'step frame %d' % i, parent='step frames', scale=0.2)\n stepFrame = obj.transform\n\n frames.append(stepFrame)\n\n return frames", "metadata": "root.FootstepRequestGenerator.makeStepFrames", "header": "['class', 'FootstepRequestGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 1014 }, { "content": " def makeStepMessages(self, stepFrames, leadingFoot, snapToTerrain=False):\n\n assert leadingFoot in ('left', 'right')\n isRightFootOffset = 0 if leadingFoot == 'left' else 1\n\n leftPoints, rightPoints = FootstepsDriver.getContactPts()\n\n # note, assumes symmetrical feet. the loop below should be\n # updated to alternate between left/right contact point sets\n footOriginToSole = -np.mean(leftPoints, axis=0)\n\n stepMessages = []\n for i, stepFrame in enumerate(stepFrames):\n\n t = transformUtils.copyFrame(stepFrame)\n t.PreMultiply()\n t.Translate(footOriginToSole)\n\n step = lcmdrc.footstep_t()\n step.pos = positionMessageFromFrame(t)\n step.is_right_foot = (i + isRightFootOffset) % 2\n step.params = self.footstepsDriver.getDefaultStepParams()\n\n step.fixed_x = True\n step.fixed_y = True\n step.fixed_z = True\n step.fixed_roll = True\n step.fixed_pitch = True\n step.fixed_yaw = True\n\n if snapToTerrain:\n step.fixed_z = False\n step.fixed_roll = False\n step.fixed_pitch = False\n\n stepMessages.append(step)\n\n return stepMessages", "metadata": "root.FootstepRequestGenerator.makeStepMessages", "header": "['class', 'FootstepRequestGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 1033 }, { "content": " def makeFootstepRequest(self, startPose, stepFrames, leadingFoot, numberOfFillSteps=0, snapToTerrain=False):\n\n stepMessages = self.makeStepMessages(stepFrames, leadingFoot, snapToTerrain=snapToTerrain)\n request = self.footstepsDriver.constructFootstepPlanRequest(startPose)\n request.num_goal_steps = len(stepMessages)\n request.goal_steps = stepMessages\n request.params.leading_foot = lcmdrc.footstep_plan_params_t.LEAD_LEFT if leadingFoot == 'left' else lcmdrc.footstep_plan_params_t.LEAD_RIGHT\n request.params.max_num_steps = len(stepMessages) + numberOfFillSteps\n return request", "metadata": "root.FootstepRequestGenerator.makeFootstepRequest", "header": "['class', 'FootstepRequestGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 1072 } ]
[ { "span": "from director.simpletimer import SimpleTimer", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 44 }, { "span": "from bot_core.robot_state_t import robot_state_t", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 48 }, { "span": "from PythonQt import QtGui, QtCore", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "object", "model_", "as_", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "visualization", "_", "as_", "vis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "utime", "_", "import_", "get", "Ut", "ime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "transform", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "debug", "Vis", "_", "import_", "Deb", "ug", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "io", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robots", "tate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "appl", "ogi", "c_", "as_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "vtk", "All_", "as_", "vtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "lcm", "frame_", "import_", "frame", "Fro", "m", "Position", "Message_", ",_", "position", "Messag", "e", "Fro", "m", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "simple", "timer_", "import_", "Simple", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "shallow", "Copy_", "import_", "shallow", "Copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robot", "ur", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "filter", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "director_", "._", "vtk", "Num", "py_", "as_", "vn", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "dr", "car", "gs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dr", "c_", "as_", "lcm", "dr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bot", "\\u", "core_", "._", "pose", "\\u", "t_", "import_", "pose", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bot", "\\u", "core_", "._", "robot", "\\u", "state", "\\u", "t_", "import_", "robot", "\\u", "state", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Pyth", "on", "Qt_", "import_", "Qt", "Gui_", ",_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "foot", "Mesh", "es_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "foot", "Mesh", "Files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "robot", "Type_", "=_", "0_", "#", " ", "0", " ", "-", " ", "any", " ", "atlas", ",", " ", "1", " ", "-", " ", "val", " ", "v1", ",", " ", "2", " ", "-", " ", "val", " ", "v2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pel", "vis", "Link_", "=_", "''_", "#", " ", "pel", "vis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "left", "Foot", "Link_", "=_", "''_", "#", " ", "l\\u", "foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "right", "Foot", "Link_", "=_", "''_", "#", " ", "r", "\\u", "foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "dr", "car", "gs_", "._", "args_", "(_", ")_", "._", "director", "Config", "File_", ")_", "as_", "director", "Config", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "director", "Config_", "=_", "json_", "._", "load_", "(_", "director", "Config", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dod", "gy", " ", "use", " ", "of", " ", "filename", " ", "to", " ", "find", " ", "val", "ky", "rie", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "director", "Config", "File_", "._", "name_", "._", "find_", "(_", "\"", "val", "ky", "rie", "\"_", ")_", ">_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "robot", "Type_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "director", "Config", "File_", "._", "name_", "._", "find_", "(_", "\"", "val", "\\u", "description", "\"_", ")_", ">_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "robot", "Type_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "director", "Config", "Directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "director", "Config", "File_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "left", "Foot", "Mesh", "Files", "'_", "in_", "director", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "foot", "Mesh", "Files_", "._", "append_", "(_", "director", "Config_", "[_", "'", "left", "Foot", "Mesh", "Files", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "foot", "Mesh", "Files_", "._", "append_", "(_", "director", "Config_", "[_", "'", "right", "Foot", "Mesh", "Files", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "\\u", "foot", "Mesh", "Files_", "[_", "j_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "foot", "Mesh", "Files_", "[_", "j_", "]_", "[_", "i_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "director", "Config", "Directory_", ",_", "\\u", "foot", "Mesh", "Files_", "[_", "j_", "]_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "pel", "vis", "Link", "'_", "in_", "director", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "pel", "vis", "Link_", "=_", "director", "Config_", "[_", "'", "pel", "vis", "Link", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "left", "Foot", "Link", "'_", "in_", "director", "Config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "left", "Foot", "Link_", "=_", "director", "Config_", "[_", "'", "left", "Foot", "Link", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "right", "Foot", "Link_", "=_", "director", "Config_", "[_", "'", "right", "Foot", "Link", "'_", "]_", "\\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", "AUL", "T", "\\u", "PARAM", "\\u", "SET_", "=_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "=_", "{_", "'", "BD", "I", "'_", ":_", "{_", "'", "Min", " ", "Num", " ", "Step", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ":_", "12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Min", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.20", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Forward", " ", "Step", "'_", ":_", "0.15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Forward", " ", "Step", "'_", ":_", "0.40", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Up", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Down", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Behavio", "r", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lead", "ing", " ", "Foot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ":_", "0.2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Ins", "tep", " ", "Shi", "ft", "'_", ":_", "0.02", "75_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "2.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Under", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Over", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Transfer", " ", "Time", "'_", ":_", "0.75_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Swi", "ng", " ", "Time", "'_", ":_", "1.2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", ":_", "{_", "'", "Min", " ", "Num", " ", "Step", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ":_", "16_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Min", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.20", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Forward", " ", "Step", "'_", ":_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Forward", " ", "Step", "'_", ":_", "0.30", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.32", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Up", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Down", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Behavio", "r", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lead", "ing", " ", "Foot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.03_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ":_", "0.6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Ins", "tep", " ", "Shi", "ft", "'_", ":_", "0.005_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Under", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Over", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Transfer", " ", "Time", "'_", ":_", "0.75_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Swi", "ng", " ", "Time", "'_", ":_", "1.2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Nomi", "nal", "'_", ":_", "{_", "'", "Min", " ", "Num", " ", "Step", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ":_", "16_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Min", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.20", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Forward", " ", "Step", "'_", ":_", "0.26", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Forward", " ", "Step", "'_", ":_", "0.30", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.32", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Up", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Down", "ward", " ", "Step", "'_", ":_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Behavio", "r", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lead", "ing", " ", "Foot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ":_", "0.2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Ins", "tep", " ", "Shi", "ft", "'_", ":_", "0.02", "75_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "2.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Under", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Over", "shoot", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Transfer", " ", "Time", "'_", ":_", "0.75_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IH", "MC", " ", "Swi", "ng", " ", "Time", "'_", ":_", "1.2_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Terra", "in", "'_", "]_", "=_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Terra", "in", "'_", "]_", "._", "update_", "(_", "{_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ":_", "0.6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Forward", " ", "Step", "'_", ":_", "0.36", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nomi", "nal", " ", "Step", " ", "Wid", "th", "'_", ":_", "0.22", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Sta", "irs", "'_", "]_", "=_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Sta", "irs", "'_", "]_", "._", "update_", "(_", "{_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "2.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Min", " ", "Num", " ", "Step", "s", "'_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ":_", "0.6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ":_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "MID", "FOO", "T", "\\u", "TO", "E_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Polari", "s", " ", "Plat", "form", "'_", "]_", "=_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "[_", "'", "Polari", "s", " ", "Plat", "form", "'_", "]_", "._", "update_", "(_", "{_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ":_", "2.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Under", "shoot", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ":_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", " ", "Mode", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CONTACT", "\\u", "SLI", "CES", "_", "=_", "{_", "(_", "0.05_", ",_", "0.3_", ")_", ":_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "0.13", "_", ",_", "-_", "0.13", "_", ",_", "0.13", "_", ",_", "0.13", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.05", "62_", ",_", "-_", "0.05", "62_", ",_", "0.05", "62_", ",_", "-_", "0.05", "62_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0.3_", ",_", ".75", "_", ")_", ":_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "0.13", "_", ",_", "-_", "0.13", "_", ",_", "0.25_", ",_", "0.25_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", ".25_", ",_", "-_", ".25_", ",_", ".25_", ",_", "-_", ".25_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0.75_", ",_", "1.05_", ")_", ":_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "0.2_", ",_", "-_", "0.2_", ",_", "0.25_", ",_", "0.25_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", ".4_", ",_", "-_", ".4_", ",_", ".4_", ",_", "-_", ".4_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1.05_", ",_", "1.8", "5_", ")_", ":_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "0.35_", ",_", "-_", "0.35_", ",_", "0.28", "_", ",_", "0.28", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", ".4_", ",_", "-_", ".4_", ",_", ".4_", ",_", "-_", ".4_", "]_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load", "Foot", "Mesh", "es_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meshes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "foot", "Mesh", "File_", "in_", "\\u", "foot", "Mesh", "Files_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Poly", "Data_", "(_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "foot", "Mesh", "File_", ",_", "compute", "Normal", "s_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Scale_", "(_", "0.98", "_", ",_", "0.98", "_", ",_", "0.98", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd_", "=_", "filter", "Utils_", "._", "transform", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meshes_", "._", "append_", "(_", "pd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meshes_", "\\u\\u\\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", "Le", "ft", "Foot", "Mesh_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "shallow", "Copy_", "(_", "get", "Foot", "Mesh", "es_", "(_", ")_", "[_", "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_", "get", "Rig", "ht", "Foot", "Mesh_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "shallow", "Copy_", "(_", "get", "Foot", "Mesh", "es_", "(_", ")_", "[_", "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_", "get", "Le", "ft", "Foot", "Color_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "1.0_", ",_", "1.0_", ",_", "0.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_", "get", "Rig", "ht", "Foot", "Color_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "0.33", "_", ",_", "1.0_", ",_", "0.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_", "get", "Foot", "Mesh", "es_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "foot", "Mesh", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "foot", "Mesh", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "foot", "Mesh", "es_", "=_", "load", "Foot", "Mesh", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "foot", "Mesh", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "foot", "step", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "foot", "step", " ", "plan", "'_", ",_", "parent", "Obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "planning", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Icon_", "(_", "om_", "._", "Icons", "_", "._", "Fee", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Walk", "ing", "Volume", "s", "Folder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "walking", " ", "volume", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "walking", " ", "volume", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Terra", "in", "Slice", "s", "Folder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "terrain", " ", "slice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "terrain", " ", "slice", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "BD", "IA", "dj", "uste", "d", "Foot", "step", "s", "Folder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "BD", "I", " ", "adj", " ", "foot", "step", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "BD", "I", " ", "adj", " ", "foot", "step", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Icon_", "(_", "om_", "._", "Icons", "_", "._", "Fee", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Foot", "step", "Plan", "Item_", "(_", "om_", "._", "Object", "Model", "Item_", ")_", ":_", "\\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_", "Walk", "ing", "Plan", "Item_", "(_", "om_", "._", "Object", "Model", "Item_", ")_", ":_", "\\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_", "Foot", "step", "s", "Driver_", "(_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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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u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "###########", "###########", "#", " ", "BD", "I", " ", "Adjustment", " ", "Logi", "c", " ", "and", " ", "Visualiza", "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_", "\\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_", "Foot", "step", "s", "Driver_", "(_", "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_", ",_", "joint", "Controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "joint", "Controller_", "=_", "joint", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Plan_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Request_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "goal", "Steps_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Walk", "ing", "Plan_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "walking", "Plan", "Callback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "step", "\\u", "params_", "=_", "DEF", "AUL", "T", "\\u", "STEP", "\\u", "PARAMS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "contact", "\\u", "slices_", "=_", "DEF", "AUL", "T", "\\u", "CONTACT", "\\u", "SLI", "CES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "\\u", "contact", "\\u", "slices_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "toolb", "ar", "Widget_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Stuff", " ", "pert", "ain", "ing", " ", "to", " ", "render", "ing", " ", "BD", "I", "-", "frame", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pose", "\\u", "bdi", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "\\u", "plan_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "\\u", "plan", "\\u", "adjusted", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Robot", "Model_", ",_", "self_", "._", "bdi", "Joint", "Controller_", "=_", "robot", "ur", "df_", "._", "load", "Robot", "Model_", "(_", "'", "bdi", " ", "model", "'_", ",_", "view_", ",_", "parent_", "=_", "'", "bdi", " ", "model", "'_", ",_", "color_", "=_", "robot", "ur", "df_", "._", "get", "Robot", "Ora", "nge", "Color_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Robot", "Model_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "BD", "IP", "lan", "_", "=_", "False_", "#", " ", "hide", " ", "the", " ", "BD", "I", " ", "plans", " ", "whe", "n", " ", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Channel_", "=_", "\"", "POS", "E", "\\u", "BD", "I", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Subc", "ribe", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "enable", " ", "this", " ", "to", " ", "used", " ", "the", " ", "bdi", " ", "model", " ", "to", " ", "render", " ", "a", " ", "different", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "bdi", "Joint", "Controlle", "r", ".", "add", "LC", "MU", "pdat", "er", "(\"", "EST", "\\u", "ROB", "OT", "\\u", "STATE", "\\u", "ALT", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "setup", "Subscription", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "setup", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "show", "Toolb", "ar", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "a", " ", "console", "app", " ", "and", " ", "have", " ", "no", " ", "main", " ", "window", " ", "exec", "Butt", "on", " ", "won", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "exec", "Butt", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exec", "Button_", "._", "set", "Enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "committ", "ed", "Plan", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "=_", "om_", "._", "Object", "Model", "Item_", "(_", "'", "Foot", "step", " ", "Param", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "s", "\\u", "map_", "=_", "[_", "'", "Dra", "ke", " ", "Nomi", "nal", "'_", ",_", "'", "BD", "I", "'_", ",_", "'", "IH", "MC", " ", "Nomi", "nal", "'_", ",_", "'", "Terra", "in", "'_", ",_", "'", "Sta", "irs", "'_", ",_", "'", "Polari", "s", " ", "Plat", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Default", "s", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "self_", "._", "default", "s", "\\u", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Behavio", "r", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "BD", "I", " ", "Step", "ping", "'_", ",_", "'", "BD", "I", " ", "Walk", "ing", "'_", ",_", "'", "Dra", "ke", " ", "Walk", "ing", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Lead", "ing", " ", "Foot", "'_", ",_", "1_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Auto", "'_", ",_", "'", "Le", "ft", "'_", ",_", "'", "Rig", "ht", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lead", "ing", "\\u", "foot", "\\u", "map_", "=_", "[_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "LEA", "D", "\\u", "AUTO", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "LEA", "D", "\\u", "LEFT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "LEA", "D", "\\u", "RIGHT_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "params", ".", "add", "Proper", "ty", "('", "Map", " ", "Command", "',", " ", "0", ",", " ", "attribute", "s", "=", "om", ".", "Proper", "ty", "Attribute", "s", "(", "enum", "Names", "=[", "'", "Full", " ", "Hei", "ght", "map", "',", " ", "'", "Flat", " ", "Gro", "und", "',", " ", "'", "Z", " ", "Normal", "s", "'])", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Map", " ", "Mode", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Foot", " ", "Plan", "e", "'_", ",_", "'", "Terra", "in", " ", "Hei", "ghts", " ", "&", " ", "Normal", "s", "'_", ",_", "'", "Terra", "in", " ", "Hei", "ghts", ",", " ", "Z", " ", "Normal", "s", "'_", ",_", "'", "Horiz", "onta", "l", " ", "Plan", "e", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "\\u", "mode", "\\u", "map_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "FOO", "T", "\\u", "PLAN", "E_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "TER", "RAI", "N", "\\u", "HE", "IGHT", "S", "\\u", "AND", "\\u", "NORMA", "LS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "TER", "RAI", "N", "\\u", "HE", "IGHT", "S", "\\u", "Z", "\\u", "NORMA", "LS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "HORI", "ZON", "TAL", "\\u", "PLAN", "E_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "params", ".", "add", "Proper", "ty", "('", "Hei", "ghts", " ", "Sou", "rce", "',", " ", "attribute", "s", "=", "om", ".", "Proper", "ty", "Attribute", "s", "(", "enum", "Names", "=[", "'", "Map", " ", "Data", "',", " ", "'", "Foot", " ", "Plan", "e", "'])", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "params", ".", "add", "Proper", "ty", "('", "Normal", "s", " ", "Sou", "rce", "',", " ", "attribute", "s", "=", "om", ".", "Proper", "ty", "Attribute", "s", "(", "enum", "Names", "=[", "'", "Map", " ", "Data", "',", " ", "'", "Foot", " ", "Plan", "e", "'])", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Min", " ", "Num", " ", "Step", "s", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "0_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "30_", ",_", "single", "Step_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Max", " ", "Num", " ", "Step", "s", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "0_", ",_", "minimum_", "=_", "1_", ",_", "maximum_", "=_", "30_", ",_", "single", "Step_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Min", " ", "Step", " ", "Wid", "th", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.1_", ",_", "maximum_", "=_", "0.35_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Nomi", "nal", " ", "Step", " ", "Wid", "th", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.21", "_", ",_", "maximum_", "=_", "0.4_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Max", " ", "Step", " ", "Wid", "th", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.22", "_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Nomi", "nal", " ", "Forward", " ", "Step", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Max", " ", "Forward", " ", "Step", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Swi", "ng", " ", "Hei", "ght", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.005_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Max", " ", "Up", "ward", " ", "Step", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Max", " ", "Down", "ward", " ", "Step", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "0.5_", ",_", "single", "Step_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Dra", "ke", " ", "Swi", "ng", " ", "Spee", "d", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.05_", ",_", "maximum_", "=_", "5.0_", ",_", "single", "Step_", "=_", "0.05_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Dra", "ke", " ", "Min", " ", "Hold", " ", "Time", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "10.0_", ",_", "single", "Step_", "=_", "0.05_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Dra", "ke", " ", "Ins", "tep", " ", "Shi", "ft", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "4_", ",_", "minimum_", "=_", "-_", "0.3_", ",_", "maximum_", "=_", "0.3_", ",_", "single", "Step_", "=_", "0.0005", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "behavior", "\\u", "lcm", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "BD", "I", "\\u", "STEP", "PING", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "BD", "I", "\\u", "WAL", "KING", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "WAL", "KING", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Plann", "er", " ", "Mode", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Fast", " ", "MI", "QP", "'_", ",_", "'", "Slow", " ", "MIS", "OC", "P", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Who", "le", " ", "Foot", "'_", ",_", "'", "Front", " ", "2", "/", "3", "'_", ",_", "'", "Back", " ", "2", "/", "3", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Under", "shoot", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Fal", "se", "'_", ",_", "'", "Tru", "e", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "Prev", "ent", " ", "Swi", "ng", " ", "Over", "shoot", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Fal", "se", "'_", ",_", "'", "Tru", "e", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "IH", "MC", " ", "Transfer", " ", "Time", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.6_", ",_", "maximum_", "=_", "5.0_", ",_", "single", "Step_", "=_", "0.05_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "._", "add", "Property_", "(_", "'", "IH", "MC", " ", "Swi", "ng", " ", "Time", "'_", ",_", "None_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "2_", ",_", "minimum_", "=_", "0.6_", ",_", "maximum_", "=_", "5.0_", ",_", "single", "Step_", "=_", "0.05_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "appl", "y", "Defaults_", "(_", "DEF", "AUL", "T", "\\u", "PARAM", "\\u", "SET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "Defaults_", "(_", "self_", ",_", "set\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "=_", "self_", "._", "default", "\\u", "step", "\\u", "params_", "[_", "set\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "defaults_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "set", "Property_", "(_", "k_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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", "setup", "Subscription", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "Histori", "cal", "Loader_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "historical", "Loader_", "=_", "lcm", "Utils_", "._", "Histori", "cal", "LC", "ML", "oad", "er_", "(_", "'", "dr", "c", "'_", ",_", "'", "software", "/", "dr", "c\\u", "lcm", "types", "/", "lcm", "types", "'_", ",_", "os_", "._", "getenv_", "(_", "'", "DR", "C", "\\u", "BASE", "'_", ")_", ")_", "if_", "use", "Histori", "cal", "Loader_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "'", "FOO", "TST", "EP", "\\u", "PLAN", "\\u", "RESPONSE", "'_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ",_", "self_", "._", "on", "Foot", "step", "Plan_", ",_", "historical", "Loader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "'", "WAL", "KING", "\\u", "TRA", "J", "\\u", "RESPONSE", "'_", ",_", "lcm", "dr", "c_", "._", "robot", "\\u", "plan", "\\u", "t_", ",_", "self_", "._", "on", "Walk", "ing", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "'", "WAL", "KING", "\\u", "SIM", "ULAT", "ION", "\\u", "TRA", "J", "\\u", "RESPONSE", "'_", ",_", "lcm", "dr", "c_", "._", "robot", "\\u", "plan", "\\u", "t_", ",_", "self_", "._", "on", "Walk", "ing", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Rela", "ted", " ", "to", " ", "BD", "I", "-", "frame", " ", "adjustment", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bdi", "Subc", "ribe", "_", "=_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "self_", "._", "bdi", "Channel_", ",_", "pose", "\\u", "t_", ",_", "self_", "._", "on", "Pose", "BD", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Subc", "ribe", "_", "._", "set", "Spee", "d", "Limit_", "(_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub", "2_", "=_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "'", "BD", "I", "\\u", "ADJ", "UST", "ED", "\\u", "FOO", "TST", "EP", "\\u", "PLAN", "'_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ",_", "self_", "._", "on", "BD", "IA", "dj", "uste", "d", "Foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub", "2_", "._", "set", "Spee", "d", "Limit_", "(_", "1_", ")_", "#", " ", "was", " ", "5", " ", "but", " ", "was", " ", "slow", " ", "render", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "Subscription", "BD", "I_", "(_", "self_", ",_", "new", "BD", "IC", "hannel", "_", "=_", "\"", "POS", "E", "\\u", "BD", "I", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "used", " ", "to", " ", "monit", "or", " ", "a", " ", "different", " ", "pose", " ", "e", ".", "g", ".", " ", "POS", "E", "\\u", "BODY", "\\u", "LOGGE", "D", " ", "in", " ", "playback", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bdi", "Channel_", "=_", "new", "BD", "IC", "hannel", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "remove", "Subscriber_", "(_", "self_", "._", "bdi", "Subc", "ribe", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bdi", "Subc", "ribe", "_", "=_", "lcm", "Utils_", "._", "add", "Subscriber_", "(_", "self_", "._", "bdi", "Channel_", ",_", "pose", "\\u", "t_", ",_", "self_", "._", "on", "Pose", "BD", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Subc", "ribe", "_", "._", "set", "Spee", "d", "Limit_", "(_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Default", "Step", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "step", "\\u", "params_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "step", "\\u", "speed_", "=_", "self_", "._", "params_", "._", "properties_", "._", "dra", "ke", "\\u", "swing", "\\u", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "dra", "ke", "\\u", "min", "\\u", "hold", "\\u", "time_", "=_", "self_", "._", "params_", "._", "properties_", "._", "dra", "ke", "\\u", "min", "\\u", "hold", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "dra", "ke", "\\u", "inst", "ep", "\\u", "shift_", "=_", "self_", "._", "params_", "._", "properties_", "._", "dra", "ke", "\\u", "inst", "ep", "\\u", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "step", "\\u", "height_", "=_", "self_", "._", "params_", "._", "properties_", "._", "swing", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "constrain", "\\u", "full", "\\u", "foot", "\\u", "pose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "step", "\\u", "duration_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "swa", "y", "\\u", "duration_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "lift", "\\u", "height_", "=_", "0.06", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "toe", "\\u", "off_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "kne", "e\\u", "nominal", "_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "max", "\\u", "foot", "\\u", "vel_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "swa", "y", "\\u", "end", "\\u", "dist_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "bdi", "\\u", "step", "\\u", "end", "\\u", "dist_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "mu_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "ih", "mc", "\\u", "transfer", "\\u", "time_", "=_", "self_", "._", "params_", "._", "properties_", "._", "ih", "mc", "\\u", "transfer", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "ih", "mc", "\\u", "swing", "\\u", "time_", "=_", "self_", "._", "params_", "._", "properties_", "._", "ih", "mc", "\\u", "swing", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "support", "\\u", "contact", "\\u", "groups_", "=_", "self_", "._", "params_", "._", "properties_", "._", "support", "\\u", "contact", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "prevent", "\\u", "swing", "\\u", "under", "shoot", "_", "=_", "self_", "._", "params_", "._", "properties_", "._", "prevent", "\\u", "swing", "\\u", "under", "shoot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "step", "\\u", "params_", "._", "prevent", "\\u", "swing", "\\u", "overs", "hoo", "t_", "=_", "self_", "._", "params_", "._", "properties_", "._", "prevent", "\\u", "swing", "\\u", "overs", "hoo", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "default", "\\u", "step", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Walk", "ing", "Plan_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Walk", "ing", "Plan_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "walking", "Plan", "Callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "walking", "Plan", "Callback_", "(_", "self_", "._", "last", "Walk", "ing", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "on", "BD", "IA", "dj", "uste", "d", "Foot", "step", "Plan_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder_", "=_", "get", "BD", "IA", "dj", "uste", "d", "Foot", "step", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "get", "BD", "IA", "dj", "uste", "d", "Foot", "step", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Foot", "step", "Plan_", "(_", "msg_", ",_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Foot", "step", "Plan_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "clear", "Foot", "step", "Plan", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Foot", "step", "Plan_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan", "Folder_", "=_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Foot", "step", "Plan_", "(_", "self_", "._", "last", "Foot", "step", "Plan_", ",_", "plan", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transform", "Plan", "To", "BD", "IF", "rame_", "(_", "self_", "._", "last", "Foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "Toolb", "ar", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Toolb", "ar", "Widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "app_", "._", "get", "Main", "Window_", "(_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "toolb", "ar", "Widget_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exec", "Button_", "._", "set", "Enabled_", "(_", "True_", ")_", "\\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_", "w_", "=_", "Qt", "Gui_", "._", "QW", "idge", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "Qt", "Gui_", "._", "Q", "HB", "ox", "Layout_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "Qt", "Gui_", "._", "QL", "abel_", "(_", "'", "Walk", " ", "plan", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec", "Button_", "._", "set", "Icon_", "(_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "._", "style_", "(_", ")_", "._", "standard", "Icon_", "(_", "Qt", "Gui_", "._", "QS", "tyle_", "._", "SP", "\\u", "Media", "Play_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Button_", "._", "set", "Icon_", "(_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "._", "style_", "(_", ")_", "._", "standard", "Icon_", "(_", "Qt", "Gui_", "._", "QS", "tyle_", "._", "SP", "\\u", "Tra", "sh", "Icon_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "Button_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "Button_", "._", "set", "Icon_", "(_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "._", "style_", "(_", ")_", "._", "standard", "Icon_", "(_", "Qt", "Gui_", "._", "QS", "tyle_", "._", "SP", "\\u", "Media", "Stop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "._", "add", "Widget_", "(_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "add", "Widget_", "(_", "exec", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "add", "Widget_", "(_", "stop", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "add", "Widget_", "(_", "clear", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "set", "Conten", "ts", "Margins_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exec", "Button_", "._", "set", "Shortcut_", "(_", "Qt", "Gui_", "._", "QK", "ey", "Sequence_", "(_", "'", "Ctrl", "+", "Return", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec", "Button_", "._", "connect_", "(_", "'", "click", "ed", "()'_", ",_", "self_", "._", "on", "Exe", "c", "Clicked_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Button_", "._", "connect_", "(_", "'", "click", "ed", "()'_", ",_", "self_", "._", "on", "Clear", "Clicked_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "Button_", "._", "connect_", "(_", "'", "click", "ed", "()'_", ",_", "self_", "._", "send", "Sto", "p", "Walk", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exec", "Button_", "=_", "exec", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "Button_", "=_", "stop", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "toolb", "ar", "Widget_", "=_", "app_", "._", "get", "Main", "Window_", "(_", ")_", "._", "tool", "Bar_", "(_", ")_", "._", "add", "Widget_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "Button_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Exe", "c", "Clicked_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "commit", "Foot", "step", "Plan_", "(_", "self_", "._", "last", "Foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "foot", "step", " ", "widget", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "walk", "Goal", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "walking", " ", "goal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "walk", "Goal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "walk", "Goal", "_", "._", "set", "Property_", "(_", "'", "Edit", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "exec", "Button_", "._", "set", "Enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Clear", "Clicked_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "walking", " ", "goal", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "foot", "step", " ", "widget", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "LC", "M", " ", "GL", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "Foot", "step", "Plan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "toolb", "ar", "Widget_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exec", "Button_", "._", "set", "Enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "clear", "Foot", "step", "Plan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Foot", "step", "Plan_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "Foot", "step", "Plan_", "(_", "self_", ",_", "msg_", ",_", "folder_", ",_", "left", "\\u", "color_", "=_", "None_", ",_", "right", "\\u", "color_", "=_", "None_", ",_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "step_", "in_", "folder_", "._", "children_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "Transforms", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "Folder_", "=_", "get", "Walk", "ing", "Volume", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "(_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", ",_", "vol", "Folder_", "._", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "s", "Folder_", "=_", "get", "Terra", "in", "Slice", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "(_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", ",_", "slice", "s", "Folder_", "._", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "foot", "step_", "in_", "enumerate_", "(_", "msg_", "._", "foot", "steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "=_", "foot", "step_", "._", "pos_", "._", "translation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "[_", "trans_", "._", "x_", ",_", "trans_", "._", "y_", ",_", "trans_", "._", "z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quat_", "=_", "foot", "step_", "._", "pos_", "._", "rotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quat_", "=_", "[_", "quat_", "._", "w_", ",_", "quat_", "._", "x_", ",_", "quat_", "._", "y_", ",_", "quat_", "._", "z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "foot", "step", "Transform_", "=_", "transform", "Utils_", "._", "transform", "Fro", "m", "Pose", "_", "(_", "trans_", ",_", "quat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "Transforms", "_", "._", "append_", "(_", "foot", "step", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "<_", "2_", ":_", "\\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_", "foot", "step_", "._", "is", "\\u", "right", "\\u", "foot", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mesh_", "=_", "get", "Rig", "ht", "Foot", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "right", "\\u", "color_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "color_", "=_", "get", "Rig", "ht", "Foot", "Color_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "color_", "=_", "right", "\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mesh_", "=_", "get", "Le", "ft", "Foot", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "left", "\\u", "color_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "color_", "=_", "get", "Le", "ft", "Foot", "Color_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "color_", "=_", "left", "\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "gradu", "al", " ", "shad", "ing", " ", "to", " ", "step", "s", " ", "to", " ", "indicat", "e", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frac_", "=_", "float_", "(_", "i_", ")_", "/_", "float_", "(_", "msg_", "._", "num", "\\u", "steps_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "color_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "color_", "[_", "0_", "]_", "=_", "0.25_", "*_", "color_", "[_", "0_", "]_", "+_", "0.75_", "*_", "frac_", "*_", "color_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "color_", "[_", "1_", "]_", "=_", "0.25_", "*_", "color_", "[_", "1_", "]_", "+_", "0.75_", "*_", "frac_", "*_", "color_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "color_", "[_", "2_", "]_", "=_", "0.25_", "*_", "color_", "[_", "2_", "]_", "+_", "0.75_", "*_", "frac_", "*_", "color_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "show", "\\u", "contact", "\\u", "slices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw", "Conta", "ct", "Volume", "s_", "(_", "foot", "step", "Transform_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", ",_", "contact", "\\u", "pts", "\\u", "right_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Conta", "ct", "Pts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "foot", "step_", "._", "is", "\\u", "right", "\\u", "foot", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sole", "\\u", "offset_", "=_", "np_", "._", "mean_", "(_", "contact", "\\u", "pts", "\\u", "right_", ",_", "axis_", "=_", "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 ", " _", "sole", "\\u", "offset_", "=_", "np_", "._", "mean_", "(_", "contact", "\\u", "pts", "\\u", "left_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t", "\\u", "sole", "\\u", "prev_", "=_", "frame", "Fro", "m", "Position", "Message_", "(_", "msg_", "._", "foot", "steps_", "[_", "i_", "-_", "2_", "]_", "._", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "sole", "\\u", "prev_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "sole", "\\u", "prev_", "._", "Translate", "_", "(_", "sole", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "sole", "_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "foot", "step", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "sole", "_", "._", "Translate", "_", "(_", "sole", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaw_", "=_", "np_", "._", "arctan", "2_", "(_", "t", "\\u", "sole", "_", "._", "Get", "Position_", "(_", ")_", "[_", "1_", "]_", "-_", "t", "\\u", "sole", "\\u", "prev_", "._", "Get", "Position_", "(_", ")_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "sole", "_", "._", "Get", "Position_", "(_", ")_", "[_", "0_", "]_", "-_", "t", "\\u", "sole", "\\u", "prev_", "._", "Get", "Position_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T", "\\u", "terrain", "\\u", "to", "\\u", "world_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "t", "\\u", "sole", "\\u", "prev_", "._", "Get", "Position_", "(_", ")_", "[_", "0_", "]_", ",_", "t", "\\u", "sole", "\\u", "prev_", "._", "Get", "Position_", "(_", ")_", "[_", "1_", "]_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "math_", "._", "degrees_", "(_", "yaw_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "dist_", "=_", "np_", "._", "array_", "(_", "foot", "step_", "._", "terrain", "\\u", "path", "\\u", "dist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "np_", "._", "array_", "(_", "foot", "step_", "._", "terrain", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "np", ".", "any", "(", "height", " ", ">=", " ", "trans", "[", "2", "])", ":_", "\\u\\u\\uNL\\u\\u\\u_", "terrain", "\\u", "pts", "\\u", "in", "\\u", "local_", "=_", "np_", "._", "vstack_", "(_", "(_", "path", "\\u", "dist_", ",_", "np_", "._", "zeros_", "(_", "len_", "(_", "foot", "step_", "._", "terrain", "\\u", "path", "\\u", "dist_", ")_", ")_", ",_", "height_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "terrain", "\\u", "pts", "\\u", "in", "\\u", "local_", "._", "shape_", "[_", "1_", "]_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Line_", "(_", "terrain", "\\u", "pts", "\\u", "in", "\\u", "local_", "[_", ":_", ",_", "j_", "]_", ",_", "terrain", "\\u", "pts", "\\u", "in", "\\u", "local_", "[_", ":_", ",_", "j_", "+_", "1_", "]_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "vis_", "._", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "terrain", " ", "slice", "'_", ",_", "parent_", "=_", "slice", "s", "Folder_", ",_", "visible_", "=_", "slice", "s", "Folder_", "._", "get", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ")_", ",_", "color_", "=_", "[_", ".8_", ",_", ".8_", ",_", ".3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "T", "\\u", "terrain", "\\u", "to", "\\u", "world_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "render", "Inf", "easi", "bility_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "render", "Inf", "easi", "bility_", "and_", "foot", "step_", "._", "inf", "easi", "bility_", ">_", "1e-6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "all", "Transforms", "_", "[_", "i_", "-_", "1_", "]_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "foot", "step", "Transform_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Arrow", "_", "(_", "start_", ",_", "end_", ",_", "0.02_", ",_", "0.005_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Head_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "Head_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "inf", "easi", "bilit", "y", " ", "%", "d", " ", "->", " ", "%", "d", "'_", "%_", "(_", "i_", "-_", "2_", ",_", "i_", "-_", "1_", ")_", ",_", "parent_", "=_", "folder_", ",_", "color_", "=_", "[_", "1_", ",_", "0.2_", ",_", "0.2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "Name_", "=_", "'", "step", " ", "%", "d", "'_", "%_", "(_", "i_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "vis_", "._", "show", "Poly", "Data_", "(_", "mesh_", ",_", "step", "Name_", ",_", "color_", "=_", "this", "\\u", "color_", ",_", "alpha_", "=_", "alpha_", ",_", "parent_", "=_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Icon_", "(_", "om_", "._", "Icons", "_", "._", "Fee", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "vis_", "._", "show", "Frame_", "(_", "foot", "step", "Transform_", ",_", "step", "Name_", "+_", "'", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "scale_", "=_", "0.3_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "foot", "step", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "Property_", "(_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ",_", "foot", "step_", "._", "params_", "._", "support", "\\u", "contact", "\\u", "groups_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "Who", "le", " ", "Foot", "'_", ",_", "'", "Front", " ", "2", "/", "3", "'_", ",_", "'", "Back", " ", "2", "/", "3", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "foot", "step", "\\u", "index_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "foot", "step", "\\u", "property", "\\u", "callback_", "=_", "obj_", "._", "properties_", "._", "connect", "Proper", "ty", "Changed_", "(_", "functools_", "._", "partial_", "(_", "self_", "._", "on", "Foot", "step", "Proper", "ty", "Changed_", ",_", "obj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "draw", "Conta", "ct", "Pts_", "(_", "obj_", ",_", "foot", "step_", ",_", "color_", "=_", "this", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "Conta", "ct", "Volume", "s_", "(_", "self_", ",_", "foot", "step", "Transform_", ",_", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vol", "Folder_", "=_", "get", "Walk", "ing", "Volume", "s", "Folder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "zs_", ",_", "xy_", "in_", "self_", "._", "contact", "\\u", "slices_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "0_", "=_", "np_", "._", "vstack_", "(_", "(_", "xy_", ",_", "zs_", "[_", "0_", "]_", "+_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "xy_", "._", "shape_", "[_", "1_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "1_", "=_", "np_", "._", "vstack_", "(_", "(_", "xy_", ",_", "zs_", "[_", "1_", "]_", "+_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", "xy_", "._", "shape_", "[_", "1_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "np_", "._", "hstack_", "(_", "(_", "points", "0_", ",_", "points", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "points_", "+_", "np_", "._", "array_", "(_", "[_", "[_", "0.05_", "]_", ",_", "[_", "0_", "]_", ",_", "[_", "-_", "0.08", "11_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "points_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "vn", "p_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "points_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol", "\\u", "mesh_", "=_", "filter", "Utils_", "._", "compute", "Del", "au", "na", "y", "3", "D_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "vis_", "._", "show", "Poly", "Data_", "(_", "vol", "\\u", "mesh_", ",_", "'", "walking", " ", "volume", "'_", ",_", "parent_", "=_", "vol", "Folder_", ",_", "alpha_", "=_", "0.5_", ",_", "visible_", "=_", "self_", "._", "show", "\\u", "contact", "\\u", "slices_", ",_", "color_", "=_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "foot", "step", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "on", "Foot", "step", "Proper", "ty", "Changed_", "(_", "self_", ",_", "obj_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "property", "Name_", "==_", "\"", "Supp", "ort", " ", "Conta", "ct", " ", "Group", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Foot", "step", "Plan_", "._", "foot", "steps_", "[_", "obj_", "._", "foot", "step", "\\u", "index_", "]_", "._", "params_", "._", "support", "\\u", "contact", "\\u", "groups_", "=_", "obj_", "._", "properties_", "._", "support", "\\u", "contact", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Update", "Plan", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "Conta", "ct", "Pts_", "(_", "self_", ",_", "obj_", ",_", "foot", "step_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left", "Points_", ",_", "right", "Points_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Conta", "ct", "Pts_", "(_", "foot", "step_", "._", "params_", "._", "support", "\\u", "contact", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts_", "=_", "right", "Points_", "if_", "foot", "step_", "._", "is", "\\u", "right", "\\u", "foot", "_", "else_", "left", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pt_", "in_", "contact", "\\u", "pts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Sphere", "_", "(_", "pt_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d\\u", "obj_", "=_", "vis_", "._", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "\"", "contact", " ", "points", "\"_", ",_", "parent_", "=_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Conta", "ct", "Pts_", "(_", "support", "\\u", "contact", "\\u", "groups_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "HE", "EL", "\\u", "TO", "E_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "hard", " ", "code", "d", " ", "Locat", "ion", " ", "of", " ", "the", " ", "Dra", "ke", " ", "contact", " ", "points", " ", "relative", " ", "to", " ", "foot", " ", "frame", ".", " ", "this", " ", "shou", "ld", " ", "be", " ", "read", " ", "from", " ", "UR", "DF", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "=_", "np_", "._", "zeros_", "(_", "(_", "4_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "=_", "np_", "._", "zeros_", "(_", "(_", "4_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "\\u", "robot", "Type_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atlas", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "HE", "EL", "\\u", "TO", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "-_", "0.08", "76_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "-_", "0.08", "76_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.17", "28_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.17", "28_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "MID", "FOO", "T", "\\u", "TO", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "-_", "0.000", "8_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "-_", "0.000", "8_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.17", "28_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.17", "28_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "HE", "EL", "\\u", "MID", "FOO", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "-_", "0.08", "76_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "-_", "0.08", "76_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.08", "6_", ",_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.08", "6_", ",_", "-_", "0.06", "26_", ",_", "-_", "0.07", "645", "_", "]_", "\\u\\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_", "(_", "\"", "Unre", "cogni", "zed", " ", "support", " ", "contact", " ", "group", ":", " ", "{:", "d", "}\"_", "._", "format_", "(_", "support", "\\u", "contact", "\\u", "groups_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "=_", "contact", "\\u", "pts", "\\u", "left_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u", "robot", "Type_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "val", " ", "v1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "0.11", "0_", ",_", "0.06", "244", "35_", ",_", "-_", "0.22", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "0.11", "0_", ",_", "-_", "0.06", "244", "35_", ",_", "-_", "0.22", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.07", "5_", ",_", "0.06", "244", "35_", ",_", "0.07", "75_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.07", "5_", ",_", "-_", "0.06", "244", "35_", ",_", "0.07", "75_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "0.07", "5_", ",_", "0.06", "244", "35_", ",_", "-_", "0.07", "75_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "0.07", "5_", ",_", "-_", "0.06", "244", "35_", ",_", "-_", "0.07", "75_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.11", "0_", ",_", "0.06", "244", "35_", ",_", "0.22", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.11", "0_", ",_", "-_", "0.06", "244", "35_", ",_", "0.22", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u", "robot", "Type_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "val", " ", "v2", " ", "(", "NOTE", ":", " ", "at", " ", "the", " ", "moment", ",", " ", "function", " ", "create", "Foot", "step", "List", " ", "in", " ", "lcm", "2r", "os", "\\u", "ih", "mc", ".", "cpp", " ", "depend", "s", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", "these", " ", "values", " ", "(", "take", "n", " ", "from", " ", "ih", "mc", " ", "code", ":", " ", "Val", "ky", "rie", "Phys", "ical", "Proper", "ties", ".", "java", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "HE", "EL", "\\u", "TO", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "-_", "0.03", "8_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "-_", "0.03", "8_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.17", "2_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.17", "2_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "MID", "FOO", "T", "\\u", "TO", "E_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "0.03", "2_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "0.03", "2_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.17", "2_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.17", "2_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "support", "\\u", "contact", "\\u", "groups_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "params", "\\u", "t_", "._", "SUPPORT", "\\u", "GROUPS", "\\u", "HE", "EL", "\\u", "MID", "FOO", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact", "\\u", "pts", "\\u", "left_", "[_", "0_", ",_", ":_", "]_", "=_", "[_", "-_", "0.03", "8_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "1_", ",_", ":_", "]_", "=_", "[_", "-_", "0.03", "8_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "2_", ",_", ":_", "]_", "=_", "[_", "0.10", "2_", ",_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", "[_", "3_", ",_", ":_", "]_", "=_", "[_", "0.10", "2_", ",_", "-_", "0.05", "5_", ",_", "-_", "0.09", "_", "]_", "\\u\\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_", "(_", "\"", "Unre", "cogni", "zed", " ", "support", " ", "contact", " ", "group", ":", " ", "{:", "d", "}\"_", "._", "format_", "(_", "support", "\\u", "contact", "\\u", "groups_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "right_", "=_", "contact", "\\u", "pts", "\\u", "left_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "contact", "\\u", "pts", "\\u", "left_", ",_", "contact", "\\u", "pts", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Fee", "t", "Mid", "Point_", "(_", "model_", ",_", "use", "Wor", "ld", "Z_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "frame", " ", "in", " ", "world", " ", "coordinate", " ", "system", " ", "tha", "t", " ", "is", " ", "the", " ", "averag", "e", " ", "of", " ", "the", " ", "left", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "right", " ", "foot", " ", "reference", " ", "point", " ", "position", "s", " ", "in", " ", "world", " ", "frame", ",", " ", "the", " ", "averag", "e", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "left", " ", "and", " ", "right", " ", "foot", " ", "yaw", " ", "in", " ", "world", " ", "frame", ",", " ", "and", " ", "Z", " ", "axis", " ", "aligned", " ", "with", " ", "world", " ", "Z", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "foot", " ", "reference", " ", "point", " ", "is", " ", "the", " ", "averag", "e", " ", "of", " ", "the", " ", "foot", " ", "contact", " ", "points", " ", "in", " ", "the", " ", "foot", " ", "frame", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "left_", ",_", "contact", "\\u", "pts", "\\u", "right_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Conta", "ct", "Pts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "mid", "\\u", "left_", "=_", "np_", "._", "mean_", "(_", "contact", "\\u", "pts", "\\u", "left_", ",_", "axis_", "=_", "0_", ")_", "#", " ", "mid", " ", "point", " ", "on", " ", "foot", " ", "relative", " ", "to", " ", "foot", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contact", "\\u", "pts", "\\u", "mid", "\\u", "right_", "=_", "np_", "._", "mean_", "(_", "contact", "\\u", "pts", "\\u", "right_", ",_", "axis_", "=_", "0_", ")_", "#", " ", "mid", " ", "point", " ", "on", " ", "foot", " ", "relative", " ", "to", " ", "foot", " ", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "lf", "\\u", "mid_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "\\u", "left", "Foot", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "lf", "\\u", "mid_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "lf", "\\u", "mid_", "._", "Translate", "_", "(_", "contact", "\\u", "pts", "\\u", "mid", "\\u", "left_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "rf", "\\u", "mid_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "\\u", "right", "Foot", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "rf", "\\u", "mid_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "rf", "\\u", "mid_", "._", "Translate", "_", "(_", "contact", "\\u", "pts", "\\u", "mid", "\\u", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "\\u", "robot", "Type_", "==_", "0_", ")_", ":_", "#", " ", "Atla", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t", "\\u", "feet", "\\u", "mid_", "=_", "transform", "Utils_", "._", "frame", "Interpolate", "_", "(_", "t", "\\u", "lf", "\\u", "mid_", ",_", "t", "\\u", "rf", "\\u", "mid_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "\\u", "robot", "Type_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Val", "ky", "rie", " ", "v1", " ", "Foot", " ", "orientation", " ", "is", " ", "sil", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l\\u", "foot", "\\u", "sole", "_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "180.0_", ",_", "82.", "5_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "foot", "\\u", "sole", "_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "foot", "\\u", "sole", "_", "._", "Concat", "enat", "e_", "(_", "t", "\\u", "lf", "\\u", "mid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "foot", "\\u", "sole", "_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0.0_", ",_", "-_", "82.", "5_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "foot", "\\u", "sole", "_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "foot", "\\u", "sole", "_", "._", "Concat", "enat", "e_", "(_", "t", "\\u", "rf", "\\u", "mid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "feet", "\\u", "mid_", "=_", "transform", "Utils_", "._", "frame", "Interpolate", "_", "(_", "l\\u", "foot", "\\u", "sole", "_", ",_", "r", "\\u", "foot", "\\u", "sole", "_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "\\u", "robot", "Type_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Val", "ky", "rie", " ", "v2", " ", "is", " ", "bett", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t", "\\u", "feet", "\\u", "mid_", "=_", "transform", "Utils_", "._", "frame", "Interpolate", "_", "(_", "t", "\\u", "lf", "\\u", "mid_", ",_", "t", "\\u", "rf", "\\u", "mid_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "Wor", "ld", "Z_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rpy", "_", "=_", "[_", "0.0_", ",_", "0.0_", ",_", "np_", "._", "degrees_", "(_", "transform", "Utils_", "._", "roll", "Pit", "ch", "Ya", "w", "Fro", "m", "Transform_", "(_", "t", "\\u", "feet", "\\u", "mid_", ")_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "t", "\\u", "feet", "\\u", "mid_", "._", "Get", "Position_", "(_", ")_", ",_", "rpy", "_", ")_", "\\u\\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_", "t", "\\u", "feet", "\\u", "mid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "debug", "Draw", "Foot", "Points_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pts", "\\u", "left_", ",_", "pts", "\\u", "right_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Conta", "ct", "Pts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "link", "Name_", "in_", "[_", "\\u", "left", "Foot", "Link_", ",_", "\\u", "right", "Foot", "Link_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "link", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Frame_", "(_", "t_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "link", "Name_", "is_", "\\u", "left", "Foot", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pts_", "=_", "pts", "\\u", "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 ", " _", "pts_", "=_", "pts", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "foot", "Mid", "Point_", "=_", "np_", "._", "mean_", "(_", "pts_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "pts_", "._", "tolist_", "(_", ")_", "+_", "[_", "foot", "Mid", "Point_", "._", "tolist_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "Transform", "Point_", "(_", "p_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p_", ",_", "radius_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mid", "pt_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Fee", "t", "Mid", "Point_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Frame_", "(_", "mid", "pt_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "foot", " ", "points", " ", "debug", "'_", ",_", "parent_", "=_", "'", "debug", "'_", ",_", "color", "By", "Name_", "=_", "'", "RGB", "255", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Goal", "Steps_", "(_", "self_", ",_", "model_", ",_", "pose_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distance", "Forward_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fr_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "\\u", "left", "Foot", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "\\u", "right", "Foot", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pel", "vis", "T_", "=_", "model_", "._", "get", "Link", "Frame_", "(_", "\\u", "pel", "vis", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pel", "vis", "T_", "._", "Transform", "Vector_", "(_", "xaxis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "array_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Goal", "Steps_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "right", "\\u", "foot", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "goal", "Steps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Goal", "Steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "right", "\\u", "foot", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "Translate", "_", "(_", "fr_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "Translate", "_", "(_", "fl_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "xaxis_", "*_", "distance", "Forward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance", "Forward_", "+=_", "0.15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "right", "\\u", "foot", "_", "=_", "not_", "is", "\\u", "right", "\\u", "foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "pos_", "=_", "position", "Messag", "e", "Fro", "m", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "is", "\\u", "right", "\\u", "foot", "_", "=_", "is", "\\u", "right", "\\u", "foot", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "params_", "=_", "self_", "._", "get", "Default", "Step", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "goal", "Steps_", "._", "append_", "(_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "self_", "._", "construct", "Foot", "step", "Plan", "Request_", "(_", "pose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "num", "\\u", "goal", "\\u", "steps_", "=_", "len_", "(_", "self_", "._", "goal", "Steps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "goal", "\\u", "steps_", "=_", "self_", "._", "goal", "Steps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Step", "Modified_", "(_", "self_", ",_", "ndx_", ",_", "frame", "Obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Foot", "step", "Plan_", "._", "foot", "steps_", "[_", "ndx_", "+_", "2_", "]_", "._", "pos_", "=_", "position", "Messag", "e", "Fro", "m", "Frame_", "(_", "frame", "Obj_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Plan_", "._", "foot", "steps_", "[_", "ndx_", "+_", "2_", "]_", "._", "fixed", "\\u", "x_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Plan_", "._", "foot", "steps_", "[_", "ndx_", "+_", "2_", "]_", "._", "fixed", "\\u", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Plan_", "._", "foot", "steps_", "[_", "ndx_", "+_", "2_", "]_", "._", "fixed", "\\u", "yaw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Update", "Plan", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "Update", "Plan", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "check", "\\u", "request", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "initial", "\\u", "state_", "=_", "self_", "._", "last", "Foot", "step", "Request_", "._", "initial", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "foot", "step", "\\u", "plan_", "=_", "self_", "._", "last", "Foot", "step", "Plan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "snap", "\\u", "to", "\\u", "terrain", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "compute", "\\u", "inf", "easi", "bility_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Foot", "step", "Plan", "Check", "Request_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "last", "Foot", "step", "Request_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "self_", "._", "last", "Foot", "step", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "appl", "y", "Params_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Foot", "step", "Plan", "Request_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "construct", "Foot", "step", "Plan", "Request_", "(_", "self_", ",_", "pose_", ",_", "goal", "Frame_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "request", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "\\u", "msg_", "=_", "robots", "tate_", "._", "dra", "ke", "Pose", "To", "Robot", "State_", "(_", "pose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "initial", "\\u", "state_", "=_", "state", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "goal", "Frame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "goal", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "goal", "\\u", "pos_", "=_", "position", "Messag", "e", "Fro", "m", "Frame_", "(_", "goal", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "self_", "._", "appl", "y", "Params_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "appl", "y", "Safe", "Regions", "_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "Params_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "params_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "max", "\\u", "num", "\\u", "steps_", "=_", "self_", "._", "params_", "._", "properties_", "._", "max", "\\u", "num", "\\u", "steps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "min", "\\u", "num", "\\u", "steps_", "=_", "self_", "._", "params_", "._", "properties_", "._", "min", "\\u", "num", "\\u", "steps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "min", "\\u", "step", "\\u", "width_", "=_", "self_", "._", "params_", "._", "properties_", "._", "min", "\\u", "step", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "nom", "\\u", "step", "\\u", "width_", "=_", "self_", "._", "params_", "._", "properties_", "._", "nominal", "\\u", "step", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "max", "\\u", "step", "\\u", "width_", "=_", "self_", "._", "params_", "._", "properties_", "._", "max", "\\u", "step", "\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "nom", "\\u", "forward", "\\u", "step_", "=_", "self_", "._", "params_", "._", "properties_", "._", "nominal", "\\u", "forward", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "max", "\\u", "forward", "\\u", "step_", "=_", "self_", "._", "params_", "._", "properties_", "._", "max", "\\u", "forward", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "nom", "\\u", "up", "ward", "\\u", "step_", "=_", "self_", "._", "params_", "._", "properties_", "._", "max", "\\u", "up", "ward", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "nom", "\\u", "down", "ward", "\\u", "step_", "=_", "self_", "._", "params_", "._", "properties_", "._", "max", "\\u", "down", "ward", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "planning", "\\u", "mode_", "=_", "self_", "._", "params_", "._", "properties_", "._", "planner", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "params_", "._", "behavior_", "=_", "self_", "._", "behavior", "\\u", "lcm", "\\u", "map_", "[_", "self_", "._", "params_", "._", "properties_", "._", "behavior_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "msg", ".", "params", ".", "use", "\\u", "map", "\\u", "height", "s", " ", "=", " ", "self", ".", "params", ".", "proper", "ties", ".", "height", "s", "\\u", "source", " ", "==", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "msg", ".", "params", ".", "use", "\\u", "map", "\\u", "normal", "s", " ", "=", " ", "self", ".", "params", ".", "proper", "ties", ".", "normal", "s", "\\u", "source", " ", "==", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "params_", "._", "map", "\\u", "mode_", "=_", "self_", "._", "map", "\\u", "mode", "\\u", "map_", "[_", "self_", "._", "params_", "._", "properties_", "._", "map", "\\u", "mode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "msg", ".", "params", ".", "map", "\\u", "command", " ", "=", " ", "self", ".", "map", "\\u", "command", "\\u", "lcm", "\\u", "map", "[", "self", ".", "params", ".", "proper", "ties", ".", "map", "\\u", "command", "]_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "params_", "._", "lead", "ing", "\\u", "foot", "_", "=_", "self_", "._", "lead", "ing", "\\u", "foot", "\\u", "map_", "[_", "self_", "._", "params_", "._", "properties_", "._", "lead", "ing", "\\u", "foot", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "default", "\\u", "step", "\\u", "params_", "=_", "self_", "._", "get", "Default", "Step", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "Safe", "Regions", "_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe", "\\u", "regions", "\\u", "folder_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "Safe", " ", "terrain", " ", "regions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "safe", "\\u", "terrain", "\\u", "regions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "safe", "\\u", "regions", "\\u", "folder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "safe", "\\u", "regions", "\\u", "folder_", "._", "children_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "._", "get", "Property_", "(_", "'", "Enable", "d", " ", "for", " ", "Walk", "ing", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "safe", "\\u", "terrain", "\\u", "regions_", "._", "append_", "(_", "obj_", "._", "safe", "\\u", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "num", "\\u", "iri", "s", "\\u", "regions_", "=_", "len_", "(_", "safe", "\\u", "terrain", "\\u", "regions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "safe", "\\u", "terrain", "\\u", "regions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "iri", "s", "\\u", "regions_", "._", "append_", "(_", "r_", "._", "to", "\\u", "iri", "s", "\\u", "region", "\\u", "t_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "Foot", "step", "Plan", "Check", "Request_", "(_", "self_", ",_", "request_", ",_", "wait", "For", "Response_", "=_", "False_", ",_", "wait", "Timeout_", "=_", "5000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "request_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "check", "\\u", "request", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Channel_", "=_", "'", "FOO", "TST", "EP", "\\u", "CHECK", "\\u", "REQUEST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "Channel_", "=_", "'", "FOO", "TST", "EP", "\\u", "PLAN", "\\u", "RESPONSE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "wait", "For", "Response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait", "Timeout_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "(_", "response", "Channel_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "._", "publi", "sh", "And", "Wait_", "(_", "request", "Channel_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "Channel_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ",_", "wait", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "send", "Foot", "step", "Plan", "Request_", "(_", "self_", ",_", "request_", ",_", "wait", "For", "Response_", "=_", "False_", ",_", "wait", "Timeout_", "=_", "5000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "request_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "request", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Foot", "step", "Request_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request", "Channel_", "=_", "'", "FOO", "TST", "EP", "\\u", "PLAN", "\\u", "REQUEST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "Channel_", "=_", "'", "FOO", "TST", "EP", "\\u", "PLAN", "\\u", "RESPONSE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "wait", "For", "Response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait", "Timeout_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "(_", "response", "Channel_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "._", "publi", "sh", "And", "Wait_", "(_", "request", "Channel_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "Channel_", ",_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "t_", ",_", "wait", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "send", "Walk", "ing", "Plan", "Request_", "(_", "self_", ",_", "foot", "step", "Plan_", ",_", "start", "Pose", "_", ",_", "wait", "For", "Response_", "=_", "False_", ",_", "wait", "Timeout_", "=_", "5000_", ",_", "req", "\\u", "type_", "=_", "'", "traj", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "lcm", "dr", "c_", "._", "walking", "\\u", "plan", "\\u", "request", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "\\u", "msg_", "=_", "robots", "tate_", "._", "dra", "ke", "Pose", "To", "Robot", "State_", "(_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "initial", "\\u", "state_", "=_", "state", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "new", "\\u", "nominal", "\\u", "state_", "=_", "msg_", "._", "initial", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "use", "\\u", "new", "\\u", "nominal", "\\u", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "foot", "step", "\\u", "plan_", "=_", "foot", "step", "Plan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "req", "\\u", "type_", "==_", "'", "traj", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "Channel_", "=_", "'", "WAL", "KING", "\\u", "TRA", "J", "\\u", "REQUEST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "Channel_", "=_", "'", "WAL", "KING", "\\u", "TRA", "J", "\\u", "RESPONSE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "type_", "=_", "lcm", "dr", "c_", "._", "robot", "\\u", "plan", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "req", "\\u", "type_", "==_", "'", "controlle", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "Channel_", "=_", "'", "WAL", "KING", "\\u", "CONTROLLER", "\\u", "PLAN", "\\u", "REQUEST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "Channel_", "=_", "'", "WAL", "KING", "\\u", "CONTROLLER", "\\u", "PLAN", "\\u", "RESPONSE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "type_", "=_", "lcm", "dr", "c_", "._", "walking", "\\u", "plan", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "req", "\\u", "type_", "==_", "'", "simulat", "e\\u", "dra", "ke", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "Channel_", "=_", "'", "WAL", "KING", "\\u", "SIM", "ULAT", "ION", "\\u", "DRA", "KE", "\\u", "REQUEST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "Channel_", "=_", "'", "WAL", "KING", "\\u", "SIM", "ULAT", "ION", "\\u", "TRA", "J", "\\u", "RESPONSE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "type_", "=_", "lcm", "dr", "c_", "._", "robot", "\\u", "plan", "\\u", "t_", "\\u\\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_", "(_", "\"", "Inva", "lid", " ", "request", " ", "type", ":", " ", "{:", "s", "}\"_", "._", "format_", "(_", "req", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "wait", "For", "Response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wait", "Timeout_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "(_", "response", "Channel_", ",_", "response", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lcm", "Utils_", "._", "Messag", "e", "Respons", "e", "Helper_", "._", "publi", "sh", "And", "Wait_", "(_", "request", "Channel_", ",_", "msg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response", "Channel_", ",_", "response", "\\u", "type_", ",_", "wait", "Timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lcm", "Utils_", "._", "publish_", "(_", "request", "Channel_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "send", "Sto", "p", "Walk", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "lcm", "dr", "c_", "._", "plan", "\\u", "control", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "control_", "=_", "lcm", "dr", "c_", "._", "plan", "\\u", "control", "\\u", "t_", "._", "TERMINAT", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "STOP", "\\u", "WAL", "KING", "'_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit", "Foot", "step", "Plan_", "(_", "self_", ",_", "foot", "step", "Plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "previ", "ous", "Plan_", "in_", "self_", "._", "committ", "ed", "Plan", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "previ", "ous", "Plan_", "._", "utime", "_", "==_", "foot", "step", "Plan_", "._", "utime", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Foot", "step", " ", "plan", " ", "was", " ", "alr", "ead", "y", " ", "executed", ".", " ", "Execut", "ion", " ", "of", " ", "the", " ", "plan", " ", "is", " ", "no", " ", "long", "er", " ", "allow", "ed", " ", "for", " ", "safety", " ", "reasons", ".", " ", "You", " ", "shou", "ld", " ", "request", " ", "a", " ", "new", " ", "foot", "step", " ", "plan", ".\"_", ")_", "\\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_", "._", "committ", "ed", "Plan", "s_", "._", "append_", "(_", "foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Foot", "step", "Plan_", "(_", "foot", "step", "Plan_", ",_", "get", "Foot", "step", "s", "Folder_", "(_", ")_", ",_", "alpha_", "=_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "foot", "step", "Plan_", "._", "params_", "._", "behavior_", "in_", "(_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "BD", "I", "\\u", "STEP", "PING", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "BD", "I", "\\u", "WAL", "KING", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "commit", "Foot", "step", "Plan", "BD", "I_", "(_", "foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "foot", "step", "Plan_", "._", "params_", "._", "behavior_", "==_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "BE", "HA", "VIO", "R", "\\u", "WAL", "KING", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "commit", "Foot", "step", "Plan", "Dra", "ke_", "(_", "foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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", "commit", "Foot", "step", "Plan", "Dra", "ke_", "(_", "self_", ",_", "foot", "step", "Plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Pose", "_", "=_", "self_", "._", "joint", "Controller_", "._", "get", "Pose", "_", "(_", "'", "EST", "\\u", "ROB", "OT", "\\u", "STATE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "Walk", "ing", "Plan", "Request_", "(_", "foot", "step", "Plan_", ",_", "start", "Pose", "_", ",_", "req", "\\u", "type_", "=_", "'", "controlle", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "commit", "Foot", "step", "Plan", "BD", "I_", "(_", "self_", ",_", "foot", "step", "Plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foot", "step", "Plan_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "COMMIT", "TED", "\\u", "FOO", "TST", "EP", "\\u", "PLAN", "'_", ",_", "foot", "step", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "Hal", "t", "Simul", "ation", "Dra", "ke", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "lcm", "dr", "c_", "._", "utime", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "utime", "_", "=_", "get", "Ut", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "HAL", "T", "\\u", "DRA", "KE", "\\u", "SIM", "ULAT", "ION", "'_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Pose", "BD", "I_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pose", "\\u", "bdi", "_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "xyz", "rpy", " ", "of", " ", "this", " ", "pose", " ", "to", " ", "equal", " ", "tha", "t", " ", "estimate", "d", " ", "by", " ", "BD", "I_", "\\u\\u\\uNL\\u\\u\\u_", "rpy", "_", "=_", "transform", "Utils_", "._", "quaternion", "To", "Roll", "Pit", "ch", "Ya", "w_", "(_", "msg_", "._", "orientation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "=_", "self_", "._", "joint", "Controller_", "._", "q_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "[_", "0_", ":_", "3_", "]_", "=_", "msg_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "[_", "3_", ":_", "6_", "]_", "=_", "rpy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bdi", "Joint", "Controller_", "._", "set", "Pose", "_", "(_", "\"", "ERS", " ", "BD", "I", "\"_", ",_", "pose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "BD", "IA", "dj", "uste", "d", "Foot", "step", "Plan_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bdi", "\\u", "plan", "\\u", "adjusted", "_", "=_", "msg_", "._", "decode_", "(_", "msg_", "._", "encode_", "(_", ")_", ")_", "#", " ", "decode", " ", "and", " ", "encode", " ", "ensure", "s", " ", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "show", "BD", "IP", "lan", "_", "is_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw", "BD", "IF", "oot", "step", "Plan", "Adjust", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "not", " ", "showin", "g", " ", "adjusted", " ", "bdi", " ", "plan", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "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_", "transform", "Plan", "To", "BD", "IF", "rame_", "(_", "self_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "pose", "\\u", "bdi", "_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "have", "n", "'", "t", " ", "receive", "d", " ", "POS", "E", "\\u", "BD", "I", "\"_", "\\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_", "#", " ", "TOD", "O", ":", " ", "Thi", "s", " ", "transformation", " ", "shou", "ld", " ", "be", " ", "rew", "rit", "ten", " ", "usi", "ng", " ", "the", " ", "LOCAL", "\\u", "TO", "\\u", "LOCAL", "\\u", "BD", "I", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "usi", "ng", " ", "FK", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t", "\\u", "body", "bdi", "_", "=_", "transform", "Utils_", "._", "transform", "Fro", "m", "Pose", "_", "(_", "self_", "._", "pose", "\\u", "bdi", "_", "._", "pos_", ",_", "self_", "._", "pose", "\\u", "bdi", "_", "._", "orientation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "bdi", "_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "pose_", "=_", "self_", "._", "joint", "Controller_", "._", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "main_", "=_", "transform", "Utils_", "._", "transform", "Fro", "m", "Pose", "_", "(_", "current", "\\u", "pose_", "[_", "0_", ":_", "3_", "]_", ",_", "transform", "Utils_", "._", "roll", "Pit", "ch", "Ya", "w", "To", "Quaternion", "_", "(_", "current", "\\u", "pose_", "[_", "3_", ":_", "6_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "main_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "and", " ", "transform_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bdi", "\\u", "plan_", "=_", "plan_", "._", "decode_", "(_", "plan_", "._", "encode_", "(_", ")_", ")_", "#", " ", "decode", " ", "and", " ", "encode", " ", "ensure", "s", " ", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "foot", "step_", "in_", "enumerate_", "(_", "self_", "._", "bdi", "\\u", "plan_", "._", "foot", "steps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step_", "=_", "foot", "step_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "step_", "=_", "frame", "Fro", "m", "Position", "Message_", "(_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "\\u", "to", "\\u", "step_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "\\u", "to", "\\u", "step_", "._", "De", "ep", "Copy_", "(_", "t", "\\u", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "\\u", "to", "\\u", "step_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "body", "\\u", "to", "\\u", "step_", "._", "Concat", "enat", "e_", "(_", "t", "\\u", "body", "main_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "step", "bdi", "_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "step", "bdi", "_", "._", "De", "ep", "Copy_", "(_", "t", "\\u", "body", "\\u", "to", "\\u", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "step", "bdi", "_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "step", "bdi", "_", "._", "Concat", "enat", "e_", "(_", "t", "\\u", "body", "bdi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foot", "step_", "._", "pos_", "=_", "position", "Messag", "e", "Fro", "m", "Frame_", "(_", "t", "\\u", "step", "bdi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "show", "BD", "IP", "lan", "_", "is_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw", "BD", "IF", "oot", "step", "Plan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "not", " ", "showin", "g", " ", "bdi", " ", "plan", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "BD", "IF", "oot", "step", "Plan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "bdi", "\\u", "plan_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "\"", "BD", "I", " ", "foot", "step", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "\"", "BD", "I", " ", "foot", "step", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "._", "set", "Icon_", "(_", "om_", "._", "Icons", "_", "._", "Fee", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Foot", "step", "Plan_", "(_", "self_", "._", "bdi", "\\u", "plan_", ",_", "folder_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ",_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "s", "Driver_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "BD", "IF", "oot", "step", "Plan", "Adjust", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "bdi", "\\u", "plan", "\\u", "adjusted", "_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "BD", "I", " ", "adj", " ", "foot", "step", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "BD", "I", " ", "adj", " ", "foot", "step", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "._", "set", "Icon_", "(_", "om_", "._", "Icons", "_", "._", "Fee", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "collapse", "_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Foot", "step", "Plan_", "(_", "self_", "._", "bdi", "\\u", "plan", "\\u", "adjusted", "_", ",_", "folder_", ",_", "[_", "1.0_", ",_", "1.0_", ",_", "0.0_", "]_", ",_", "[_", "0.0_", ",_", "1.0_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Foot", "step", "Request", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Foot", "step", "Request", "Generator_", "(_", "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_", ",_", "foot", "step", "s", "Driver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "foot", "step", "s", "Driver_", "=_", "foot", "step", "s", "Driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "Request", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Robot", "Stan", "ce", "Frame_", "(_", "robot", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Foot", "step", "s", "Driver_", "._", "get", "Fee", "t", "Mid", "Point_", "(_", "robot", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "Request", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "make", "Step", "Frames_", "(_", "step", "Frames_", ",_", "relative", "Frame_", "=_", "None_", ",_", "show", "Frames_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "step", "Frame_", "in_", "enumerate_", "(_", "step", "Frames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "step", "Frame_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relative", "Frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "Frame_", "._", "Concat", "enat", "e_", "(_", "relative", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "show", "Frames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "vis_", "._", "update", "Frame_", "(_", "step", "Frame_", ",_", "'", "step", " ", "frame", " ", "%", "d", "'_", "%_", "i_", ",_", "parent_", "=_", "'", "step", " ", "frames", "'_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "Frame_", "=_", "obj_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frames_", "._", "append_", "(_", "step", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "frames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "Request", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Step", "Messages_", "(_", "self_", ",_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", ",_", "snap", "To", "Terra", "in_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "lead", "ing", "Foot", "_", "in_", "(_", "'", "left", "'_", ",_", "'", "right", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Rig", "ht", "Foot", "Offset_", "=_", "0_", "if_", "lead", "ing", "Foot", "_", "==_", "'", "left", "'_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Points_", ",_", "right", "Points_", "=_", "Foot", "step", "s", "Driver_", "._", "get", "Conta", "ct", "Pts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", ",", " ", "assume", "s", " ", "symmetric", "al", " ", "feet", ".", " ", "the", " ", "loop", " ", "belo", "w", " ", "shou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", " ", "to", " ", "alternat", "e", " ", "bet", "ween", " ", "left", "/", "right", " ", "contact", " ", "point", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "foot", "Orig", "in", "To", "Sol", "e_", "=_", "-_", "np_", "._", "mean_", "(_", "left", "Points_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step", "Messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "step", "Frame_", "in_", "enumerate_", "(_", "step", "Frames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "step", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "foot", "Orig", "in", "To", "Sol", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "pos_", "=_", "position", "Messag", "e", "Fro", "m", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "is", "\\u", "right", "\\u", "foot", "_", "=_", "(_", "i_", "+_", "is", "Rig", "ht", "Foot", "Offset_", ")_", "%_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "params_", "=_", "self_", "._", "foot", "step", "s", "Driver_", "._", "get", "Default", "Step", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "step_", "._", "fixed", "\\u", "x_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "z_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "roll_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "pitch_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "yaw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "snap", "To", "Terra", "in_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step_", "._", "fixed", "\\u", "z_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "roll_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "fixed", "\\u", "pitch_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "Messages_", "._", "append_", "(_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "step", "Messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Foot", "step", "Request", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Foot", "step", "Request_", "(_", "self_", ",_", "start", "Pose", "_", ",_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", ",_", "number", "Of", "Fil", "l", "Steps_", "=_", "0_", ",_", "snap", "To", "Terra", "in_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "Messages_", "=_", "self_", "._", "make", "Step", "Messages_", "(_", "step", "Frames_", ",_", "lead", "ing", "Foot", "_", ",_", "snap", "To", "Terra", "in_", "=_", "snap", "To", "Terra", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "foot", "step", "s", "Driver_", "._", "construct", "Foot", "step", "Plan", "Request_", "(_", "start", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "num", "\\u", "goal", "\\u", "steps_", "=_", "len_", "(_", "step", "Messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "goal", "\\u", "steps_", "=_", "step", "Messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "params_", "._", "lead", "ing", "\\u", "foot", "_", "=_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "LEA", "D", "\\u", "LEFT_", "if_", "lead", "ing", "Foot", "_", "==_", "'", "left", "'_", "else_", "lcm", "dr", "c_", "._", "foot", "step", "\\u", "plan", "\\u", "params", "\\u", "t_", "._", "LEA", "D", "\\u", "RIGHT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "params_", "._", "max", "\\u", "num", "\\u", "steps_", "=_", "len_", "(_", "step", "Messages_", ")_", "+_", "number", "Of", "Fil", "l", "Steps_", "\\u\\u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"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_", "\"\"\"", "\\", "10", ";", "Simple", " ", "WS", "GI", " ", "applica", "tion", "s", " ", "for", " ", "testi", "ng", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pprint_", "import_", "pformat_", "\\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 ", " _", "bytes_", "\\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 ", " _", "bytes_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ImageEngine/gaffer/python/GafferSceneUI/FilterUI.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport Gaffer\nimport GafferUI\nimport GafferScene\n\nGaffer.Metadata.registerNode(\n\n\tGafferScene.Filter,\n\n\t\"description\",\n\t\"\"\"\n\tThe base type for all nodes which are capable of choosing which\n\tscene locations a FilteredSceneProcessor applies to.\n\t\"\"\",\n\n\tplugs = {\n\n\t\t\"enabled\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tThe on/off state of the filter. When it is off, the\n\t\t\tfilter does not match any locations.\n\t\t\t\"\"\",\n\n\t\t\t\"nodule:type\", \"\",\n\n\t\t],\n\n\t\t\"out\" : [\n\n\t\t\t\"description\",\n\t\t\t\"\"\"\n\t\t\tThe result of the filter. This should be connected into\n\t\t\tthe \"filter\" plug of a FilteredSceneProcessor.\n\t\t\t\"\"\",\n\n\t\t\t\"plugValueWidget:type\", \"\",\n\n\t\t]\n\n\t}\n\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferUI", "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_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scene_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "_", "._", "Metadata_", "._", "register", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "Scene_", "._", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "The", " ", "base", " ", "type", " ", "for", " ", "all", " ", "nodes", " ", "whi", "ch", " ", "are", " ", "capable", " ", "of", " ", "choo", "sing", " ", "whi", "ch", "\\", "10", ";", "\t", "scen", "e", " ", "location", "s", " ", "a", " ", "Filter", "ed", "Scen", "e", "Process", "or", " ", "appli", "es", " ", "to", ".", "\\", "10", ";", "\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plug", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enable", "d", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "The", " ", "on", "/", "off", " ", "state", " ", "of", " ", "the", " ", "filter", ".", " ", "Whe", "n", " ", "it", " ", "is", " ", "off", ",", " ", "the", "\\", "10", ";", "\t\t\t", "filter", " ", "doe", "s", " ", "not", " ", "match", " ", "any", " ", "location", "s", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nod", "ule", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "out", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t\t\t", "The", " ", "result", " ", "of", " ", "the", " ", "filter", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "connect", "ed", " ", "int", "o", "\\", "10", ";", "\t\t\t", "the", " ", "\"", "filter", "\"", " ", "plug", " ", "of", " ", "a", " ", "Filter", "ed", "Scen", "e", "Process", "or", ".", "\\", "10", ";", "\t\t\t", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plug", "Value", "Wid", "get", ":", "type", "\"_", ",_", "\"\"_", ",_", "\\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_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
alimanfoo/petl/petl/io/__init__.py
[ { "content": "from __future__ import absolute_import, print_function, division\n\nfrom petl.io.base import fromcolumns\n\nfrom petl.io.sources import FileSource, GzipSource, BZ2Source, ZipSource, \\\n StdinSource, StdoutSource, URLSource, StringSource, PopenSource, \\\n MemorySource\n\nfrom petl.io.csv import fromcsv, fromtsv, tocsv, appendcsv, totsv, appendtsv, \\\n teecsv, teetsv\n\nfrom petl.io.pickle import frompickle, topickle, appendpickle, teepickle\n\nfrom petl.io.text import fromtext, totext, appendtext, teetext\n\nfrom petl.io.xml import fromxml\n\nfrom petl.io.html import tohtml, teehtml\n\nfrom petl.io.json import fromjson, tojson, tojsonarrays, fromdicts\n\nfrom petl.io.db import fromdb, todb, appenddb\n\nfrom petl.io.xls import fromxls, toxls\n\nfrom petl.io.xlsx import fromxlsx, toxlsx\n\nfrom petl.io.numpy import fromarray, toarray, torecarray\n\nfrom petl.io.pandas import fromdataframe, todataframe\n\nfrom petl.io.pytables import fromhdf5, fromhdf5sorted, tohdf5, appendhdf5\n\nfrom petl.io.whoosh import fromtextindex, searchtextindex, \\\n searchtextindexpage, totextindex, appendtextindex\n\nfrom petl.io.bcolz import frombcolz, tobcolz, appendbcolz\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from petl.io.base import fromcolumns", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 }, { "span": "from petl.io.sources import FileSource, GzipSource, BZ2Source, ZipSource, \\\n StdinSource, StdoutSource, URLSource, StringSource, PopenSource, \\\n MemorySource", "start_line": 4, "start_column": 0, "end_line": 6, "end_column": 16 }, { "span": "from petl.io.csv import fromcsv, fromtsv, tocsv, appendcsv, totsv, appendtsv, \\\n teecsv, teetsv", "start_line": 8, "start_column": 0, "end_line": 9, "end_column": 18 }, { "span": "from petl.io.pickle import frompickle, topickle, appendpickle, teepickle", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 72 }, { "span": "from petl.io.text import fromtext, totext, appendtext, teetext", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 62 }, { "span": "from petl.io.xml import fromxml", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 31 }, { "span": "from petl.io.html import tohtml, teehtml", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 40 }, { "span": "from petl.io.json import fromjson, tojson, tojsonarrays, fromdicts", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 66 }, { "span": "from petl.io.db import fromdb, todb, appenddb", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 45 }, { "span": "from petl.io.xls import fromxls, toxls", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 38 }, { "span": "from petl.io.xlsx import fromxlsx, toxlsx", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 41 }, { "span": "from petl.io.numpy import fromarray, toarray, torecarray", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 56 }, { "span": "from petl.io.pandas import fromdataframe, todataframe", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 53 }, { "span": "from petl.io.pytables import fromhdf5, fromhdf5sorted, tohdf5, appendhdf5", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 73 }, { "span": "from petl.io.whoosh import fromtextindex, searchtextindex, \\\n searchtextindexpage, totextindex, appendtextindex", "start_line": 33, "start_column": 0, "end_line": 34, "end_column": 53 }, { "span": "from petl.io.bcolz import frombcolz, tobcolz, appendbcolz", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "base_", "import_", "from", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "sources_", "import_", "File", "Source_", ",_", "Gz", "ip", "Source_", ",_", "BZ", "2", "Source_", ",_", "Zip", "Source_", ",_", "Std", "in", "Source_", ",_", "Stdout", "Source_", ",_", "URL", "Source_", ",_", "String", "Source_", ",_", "Pop", "en", "Source_", ",_", "Memo", "ry", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "csv_", "import_", "from", "csv_", ",_", "from", "tsv", "_", ",_", "toc", "sv_", ",_", "append", "csv_", ",_", "tot", "sv_", ",_", "append", "tsv", "_", ",_", "tee", "csv_", ",_", "tee", "tsv", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "pickle_", "import_", "from", "pickle_", ",_", "topic", "kle", "_", ",_", "append", "pickle_", ",_", "tee", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "text_", "import_", "from", "text_", ",_", "tot", "ext_", ",_", "append", "text_", ",_", "tee", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "xml_", "import_", "from", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "html_", "import_", "to", "html_", ",_", "tee", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "json_", "import_", "from", "json_", ",_", "to", "json_", ",_", "to", "json", "arrays_", ",_", "from", "dicts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "db_", "import_", "from", "db_", ",_", "tod", "b_", ",_", "append", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "xls", "_", "import_", "from", "xls", "_", ",_", "tox", "ls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "xls", "x_", "import_", "from", "xls", "x_", ",_", "tox", "ls", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "numpy_", "import_", "froma", "rray_", ",_", "toa", "rray_", ",_", "tore", "carr", "ay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "pandas_", "import_", "from", "dataframe_", ",_", "toda", "ta", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "pyt", "ables_", "import_", "from", "hdf5", "_", ",_", "from", "hdf5", "sorted_", ",_", "to", "hdf5", "_", ",_", "append", "hdf5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "who", "osh", "_", "import_", "from", "texti", "ndex_", ",_", "search", "texti", "ndex_", ",_", "search", "texti", "nde", "xpa", "ge_", ",_", "tot", "extin", "dex_", ",_", "append", "texti", "ndex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pet", "l_", "._", "io_", "._", "bco", "lz", "_", "import_", "from", "bco", "lz", "_", ",_", "tob", "col", "z_", ",_", "append", "bco", "lz", "_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 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, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 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, 2, 2, 0, 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, 2, 2, 0, 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, 2, 2, 0, 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, 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, 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 ]
Unused import
comodit/demos/render-farm/setup.py
[ { "content": "#!/usr/bin/env python\n\nimport config \n\nfrom comodit_client.api import Client\nfrom comodit_client.api.collection import EntityNotFoundException\nfrom comodit_client.api.importer import Import\n\n\n\nif __name__ == '__main__':\n try:\n setup()\n except Exception as e:\n print e\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup():\n # Connect to the ComodIT API\n client = Client(config.endpoint, config.username, config.password)\n org = client.get_organization(config.organization)\n\n print \"Setting up ComodIT...\"\n\n # Create environment (if not already present)\n try:\n org.environments().create(\"Render Farm\", \"Environment containing the render farm.\")\n except:\n pass\n\n # Import applications\n importer = Import()\n importer.import_application(org, 'nfs-server')\n importer.import_application(org, 'nfs-client')\n importer.import_application(org, 'blender')\n\n print \"Done.\"", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 8 } ]
[ { "span": "from comodit_client.api.collection import EntityNotFoundException", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "api_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "api_", "._", "collection_", "import_", "Entit", "y", "Not", "Foun", "d", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "api_", "._", "importer_", "import_", "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\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup_", "(_", ")_", "\\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 ", " _", "print_", "e_", "\\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_", "setup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Connect", " ", "to", " ", "the", " ", "Com", "od", "IT", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Client_", "(_", "config_", "._", "endpoint_", ",_", "config_", "._", "username_", ",_", "config_", "._", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "client_", "._", "get", "\\u", "organization_", "(_", "config_", "._", "organization_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Sett", "ing", " ", "up", " ", "Com", "od", "IT", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "environ", "ment", " ", "(", "if", " ", "not", " ", "alr", "ead", "y", " ", "presen", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "org_", "._", "environments_", "(_", ")_", "._", "create_", "(_", "\"", "Render", " ", "Far", "m", "\"_", ",_", "\"", "Environ", "ment", " ", "contain", "ing", " ", "the", " ", "render", " ", "farm", ".\"_", ")_", "\\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_", "#", " ", "Import", " ", "applications_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "importer_", "=_", "Import_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "import", "\\u", "application_", "(_", "org_", ",_", "'", "nfs", "-", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "import", "\\u", "application_", "(_", "org_", ",_", "'", "nfs", "-", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "import", "\\u", "application_", "(_", "org_", ",_", "'", "blender", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Don", "e", ".\"_", "\\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, 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, 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 ]
Unused import
bretth/django-pq/pq/migrations/0002_auto__add_field_queue_connection__add_field_queue_idempotent__add_fiel.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'pq.flowstore': {\n 'Meta': {'object_name': 'FlowStore'},\n 'ended_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'enqueued_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'expired_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'jobs': ('picklefield.fields.PickledObjectField', [], {'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '100'}),\n 'queue': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['pq.Queue']\", 'null': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})\n },\n u'pq.job': {\n 'Meta': {'object_name': 'Job'},\n 'args': ('picklefield.fields.PickledObjectField', [], {'blank': 'True'}),\n 'between': ('django.db.models.fields.CharField', [], {'max_length': '5', 'null': 'True', 'blank': 'True'}),\n 'created_at': ('django.db.models.fields.DateTimeField', [], {}),\n 'description': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n 'ended_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'enqueued_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'exc_info': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'expired_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'flow': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['pq.FlowStore']\", 'null': 'True', 'blank': 'True'}),\n 'func_name': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'if_failed': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'if_result': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'instance': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'}),\n 'interval': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'}),\n 'kwargs': ('picklefield.fields.PickledObjectField', [], {'blank': 'True'}),\n 'meta': ('picklefield.fields.PickledObjectField', [], {'blank': 'True'}),\n 'origin': ('django.db.models.fields.CharField', [], {'max_length': '254', 'null': 'True', 'blank': 'True'}),\n 'queue': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['pq.Queue']\", 'null': 'True', 'blank': 'True'}),\n 'repeat': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'}),\n 'result': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'}),\n 'result_ttl': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'scheduled_for': ('django.db.models.fields.DateTimeField', [], {}),\n 'status': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'timeout': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'uuid': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),\n 'weekdays': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'})\n },\n u'pq.queue': {\n 'Meta': {'object_name': 'Queue'},\n 'cleaned': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'default_timeout': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'idempotent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'lock_expires': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 5, 12, 0, 0)'}),\n 'name': ('django.db.models.fields.CharField', [], {'default': \"'default'\", 'max_length': '100', 'primary_key': 'True'}),\n 'scheduled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'serial': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n },\n u'pq.worker': {\n 'Meta': {'object_name': 'Worker'},\n 'birth': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'expire': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '254', 'primary_key': 'True'}),\n 'queue_names': ('django.db.models.fields.CharField', [], {'max_length': '254', 'null': 'True', 'blank': 'True'}),\n 'stop': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n }\n }\n\n complete_apps = ['pq']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding field 'Queue.idempotent'\n db.add_column(u'pq_queue', 'idempotent',\n self.gf('django.db.models.fields.BooleanField')(default=False),\n keep_default=False)\n\n # Adding field 'Worker.stop'\n db.add_column(u'pq_worker', 'stop',\n self.gf('django.db.models.fields.BooleanField')(default=False),\n keep_default=False)", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting field 'Queue.idempotent'\n db.delete_column(u'pq_queue', 'idempotent')\n\n # Deleting field 'Worker.stop'\n db.delete_column(u'pq_worker', 'stop')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "pq", ".", "flow", "store", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Flow", "Stor", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ende", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enqueue", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expir", "ed", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "jobs", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "pq", ".", "Queue", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "pq", ".", "job", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Jo", "b", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "args", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bet", "ween", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "5", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ende", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enqueue", "d\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exc", "\\u", "info", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expir", "ed", "\\u", "at", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flow", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "pq", ".", "Flow", "Stor", "e", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "if", "\\u", "fail", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "if", "\\u", "result", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kwarg", "s", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "orig", "in", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "pq", ".", "Queue", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "repeat", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "\\u", "ttl", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "schedule", "d\\u", "for", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timeo", "ut", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uuid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "weekday", "s", "'_", ":_", "(_", "'", "pickle", "field", ".", "fields", ".", "Pickl", "ed", "Object", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "pq", ".", "queue", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Queue", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clean", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "timeo", "ut", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "idempotent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lock", "\\u", "expir", "es", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", "(", "2013", ",", " ", "5", ",", " ", "1", "2", ",", " ", "0", ",", " ", "0", ")'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "default", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "schedule", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "serial", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "pq", ".", "worker", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Worke", "r", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expir", "e", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "names", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stop", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "pq", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Queue", ".", "idempotent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "pq", "\\u", "queue", "'_", ",_", "'", "idempotent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "(_", "default_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Worke", "r", ".", "stop", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "pq", "\\u", "worker", "'_", ",_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "(_", "default_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Queue", ".", "idempotent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "column_", "(_", "u", "'", "pq", "\\u", "queue", "'_", ",_", "'", "idempotent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Worke", "r", ".", "stop", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "column_", "(_", "u", "'", "pq", "\\u", "worker", "'_", ",_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
phaethon/scapy/scapy/arch/__init__.py
[ { "content": "## This file is part of Scapy\n## See http://www.secdev.org/projects/scapy for more informations\n## Copyright (C) Philippe Biondi <[email protected]>\n## This program is published under a GPLv2 license\n\n\"\"\"\nOperating system specific functionality.\n\"\"\"\n\n\nimport sys,os,socket\nfrom scapy.error import *\nimport scapy.config\n\ntry:\n import matplotlib.pyplot as plt\n MATPLOTLIB = True\n if scapy.config.conf.interactive:\n plt.ion()\nexcept ImportError:\n log_loading.debug(\"Can't import matplotlib. Not critical, but won't be able to plot.\")\n MATPLOTLIB = False\n\ntry:\n import networkx as nx\n NETWORKX = True\nexcept ImportError:\n log_loading.debug(\"Can't import networkx. Not criticial, but won't be able to draw network graphs.\")\n NETWORKX = False\n\ntry:\n import pyx\n PYX=1\nexcept ImportError:\n log_loading.debug(\"Can't import PyX. Won't be able to use psdump() or pdfdump().\")\n PYX=0\n\nif scapy.config.conf.use_netifaces:\n try:\n import netifaces\n except ImportError as e:\n log_loading.warning(\"Could not load module netifaces: %s\" % e)\n scapy.config.conf.use_netifaces = False\n\n\n\n \n \n\n\nLINUX=sys.platform.startswith(\"linux\")\nOPENBSD=sys.platform.startswith(\"openbsd\")\nFREEBSD=sys.platform.startswith(\"freebsd\")\nNETBSD = sys.platform.startswith(\"netbsd\")\nDARWIN=sys.platform.startswith(\"darwin\")\nSOLARIS=sys.platform.startswith(\"sunos\")\nWINDOWS=sys.platform.startswith(\"win32\")\n\nX86_64 = not WINDOWS and (os.uname()[4] == 'x86_64')\n\nif WINDOWS:\n pass\n# log_loading.warning(\"Windows support for scapy3k is currently in testing. Sniffing/sending/receiving packets should be working with WinPcap driver and Powershell. Create issues at https://github.com/phaethon/scapy\")\n\n# Next step is to import following architecture specific functions:\n# def get_if_raw_hwaddr(iff)\n# def get_if_raw_addr(iff):\n# def get_if_list():\n# def get_working_if():\n# def attach_filter(s, filter):\n# def set_promisc(s,iff,val=1):\n# def read_routes():\n# def get_if(iff,cmd):\n# def get_if_index(iff):\n\n\n\nif LINUX:\n from .linux import *\n if scapy.config.conf.use_winpcapy or scapy.config.conf.use_netifaces:\n from .pcapdnet import *\nelif OPENBSD or FREEBSD or NETBSD or DARWIN:\n from .bsd import *\nelif SOLARIS:\n from .solaris import *\nelif WINDOWS:\n from .windows import *\n\nif scapy.config.conf.iface is None:\n scapy.config.conf.iface = LOOPBACK_NAME\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def str2mac(s):\n #return (\"%02x:\"*6)[:-1] % tuple(map(ord, s)) \n return (\"%02x:\"*6)[:-1] % tuple(s)", "metadata": "root.str2mac", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def get_if_addr(iff):\n return socket.inet_ntoa(get_if_raw_addr(iff))", "metadata": "root.get_if_addr", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def get_if_hwaddr(iff):\n mac = get_if_raw_hwaddr(iff)\n return str2mac(mac)", "metadata": "root.get_if_hwaddr", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def get_if_raw_addr6(iff):\n \"\"\"\n Returns the main global unicast address associated with provided \n interface, in network format. If no global address is found, None \n is returned. \n \"\"\"\n #r = filter(lambda x: x[2] == iff and x[1] == IPV6_ADDR_GLOBAL, in6_getifaddr())\n r = [ x for x in in6_getifaddr() if x[2] == iff and x[1] == IPV6_ADDR_GLOBAL]\n if len(r) == 0:\n return None\n else:\n r = r[0][0] \n return inet_pton(socket.AF_INET6, r)", "metadata": "root.get_if_raw_addr6", "header": "['module', '___EOS___']", "index": 99 } ]
[ { "span": "import networkx as nx", "start_line": 24, "start_column": 4, "end_line": 24, "end_column": 25 }, { "span": "import pyx", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 14 }, { "span": "import netifaces", "start_line": 39, "start_column": 4, "end_line": 39, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Sca", "py_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "See", " ", "http", "://", "www", ".", "sec", "dev", ".", "org", "/", "project", "s", "/", "scap", "y", " ", "for", " ", "more", " ", "informations", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "Phil", "ipp", "e", " ", "Bio", "ndi", " ", "<", "phil", "@", "sec", "dev", ".", "org", ">_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "program", " ", "is", " ", "publi", "shed", " ", "under", " ", "a", " ", "GP", "Lv", "2", " ", "license_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Opera", "ting", " ", "system", " ", "specific", " ", "functional", "it", "y", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scapy_", "._", "error_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scapy_", "._", "config_", "\\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_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAT", "PLOT", "LIB_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scapy_", "._", "config_", "._", "conf_", "._", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "ion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "loading_", "._", "debug_", "(_", "\"", "Can", "'", "t", " ", "import", " ", "mat", "plotlib", ".", " ", "Not", " ", "critic", "al", ",", " ", "but", " ", "won", "'", "t", " ", "be", " ", "able", " ", "to", " ", "plot", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAT", "PLOT", "LIB_", "=_", "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_", "networkx_", "as_", "nx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "X_", "=_", "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 ", " _", "log", "\\u", "loading_", "._", "debug_", "(_", "\"", "Can", "'", "t", " ", "import", " ", "networkx", ".", " ", "Not", " ", "critic", "ial", ",", " ", "but", " ", "won", "'", "t", " ", "be", " ", "able", " ", "to", " ", "draw", " ", "network", " ", "graph", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "WORK", "X_", "=_", "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_", "pyx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "X_", "=_", "1_", "\\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 ", " _", "log", "\\u", "loading_", "._", "debug_", "(_", "\"", "Can", "'", "t", " ", "import", " ", "Py", "X", ".", " ", "Wo", "n", "'", "t", " ", "be", " ", "able", " ", "to", " ", "use", " ", "psd", "ump", "()", " ", "or", " ", "pdf", "dump", "().\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "X_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "scapy_", "._", "config_", "._", "conf_", "._", "use", "\\u", "neti", "faces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "neti", "faces_", "\\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", "\\u", "loading_", "._", "warning_", "(_", "\"", "Cou", "ld", " ", "not", " ", "load", " ", "module", " ", "neti", "face", "s", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scapy_", "._", "config_", "._", "conf_", "._", "use", "\\u", "neti", "faces_", "=_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "LINUX", "_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "linux", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPEN", "BS", "D_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "openb", "sd", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FREE", "BS", "D_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "freeb", "sd", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NET", "BS", "D_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "netb", "sd", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DAR", "WIN", "_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "dar", "win", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOL", "ARI", "S_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "sun", "os", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WINDOWS", "_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "\"", "win32", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X", "86", "\\u", "64_", "=_", "not_", "WINDOWS", "_", "and_", "(_", "os_", "._", "uname_", "(_", ")_", "[_", "4_", "]_", "==_", "'", "x8", "6", "\\u", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "WINDOWS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "log", "\\u", "load", "ing", ".", "warn", "ing", "(\"", "Window", "s", " ", "support", " ", "for", " ", "scap", "y", "3", "k", " ", "is", " ", "currentl", "y", " ", "in", " ", "testi", "ng", ".", " ", "Sni", "ffi", "ng", "/", "sendin", "g", "/", "receiv", "ing", " ", "packet", "s", " ", "shou", "ld", " ", "be", " ", "working", " ", "with", " ", "Win", "Pc", "ap", " ", "driver", " ", "and", " ", "Power", "shell", ".", " ", "Creat", "e", " ", "issue", "s", " ", "at", " ", "https", "://", "git", "hub", ".", "com", "/", "pha", "eth", "on", "/", "scap", "y", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "step", " ", "is", " ", "to", " ", "import", " ", "follow", "ing", " ", "architecture", " ", "specific", " ", "function", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "if", "\\u", "raw", "\\u", "hwa", "ddr", "(", "iff", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "if", "\\u", "raw", "\\u", "addr", "(", "iff", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "if", "\\u", "list", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "working", "\\u", "if", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "attach", "\\u", "filter", "(", "s", ",", " ", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "set\\u", "promis", "c", "(", "s", ",", "iff", ",", "val", "=", "1", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "read", "\\u", "route", "s", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "if", "(", "iff", ",", "cmd", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "get", "\\u", "if", "\\u", "index", "(", "iff", "):", "_", "\\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_", "if_", "LINUX", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "linux_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scapy_", "._", "config_", "._", "conf_", "._", "use", "\\u", "win", "pcap", "y_", "or_", "scapy_", "._", "config_", "._", "conf_", "._", "use", "\\u", "neti", "faces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "pcap", "dne", "t_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "OPEN", "BS", "D_", "or_", "FREE", "BS", "D_", "or_", "NET", "BS", "D_", "or_", "DAR", "WIN", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "bsd", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "SOL", "ARI", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "solar", "is_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "WINDOWS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "windows_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "scapy_", "._", "config_", "._", "conf_", "._", "iface_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scapy_", "._", "config_", "._", "conf_", "._", "iface_", "=_", "LOOP", "BACK", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str2", "mac_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "(\"", "%", "02", "x", ":\"", "*", "6", ")[", ":-", "1", "]", " ", "%", " ", "tuple", "(", "map", "(", "ord", ",", " ", "s", "))", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"%", "02", "x", ":\"_", "*_", "6_", ")_", "[_", ":_", "-_", "1_", "]_", "%_", "tuple_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "if", "\\u", "addr_", "(_", "iff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "get", "\\u", "if", "\\u", "raw", "\\u", "addr_", "(_", "iff_", ")_", ")_", "\\u\\u\\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", "if", "\\u", "hwa", "ddr_", "(_", "iff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mac_", "=_", "get", "\\u", "if", "\\u", "raw", "\\u", "hwa", "ddr_", "(_", "iff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str2", "mac_", "(_", "mac_", ")_", "\\u\\u\\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", "if", "\\u", "raw", "\\u", "addr", "6_", "(_", "iff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "main", " ", "global", " ", "unica", "st", " ", "address", " ", "associate", "d", " ", "with", " ", "provided", " ", "\\", "10", ";", " ", " ", " ", " ", "interface", ",", " ", "in", " ", "network", " ", "format", ".", " ", "If", " ", "no", " ", "global", " ", "address", " ", "is", " ", "found", ",", " ", "Non", "e", " ", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "return", "ed", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "r", " ", "=", " ", "filter", "(", "lambda", " ", "x", ":", " ", "x", "[", "2", "]", " ", "==", " ", "iff", " ", "and", " ", "x", "[", "1", "]", " ", "==", " ", "IP", "V6", "\\u", "ADDR", "\\u", "GLOB", "AL", ",", " ", "in", "6", "\\u", "geti", "fad", "dr", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "[_", "x_", "for_", "x_", "in_", "in", "6", "\\u", "geti", "fad", "dr_", "(_", ")_", "if_", "x_", "[_", "2_", "]_", "==_", "iff_", "and_", "x_", "[_", "1_", "]_", "==_", "IP", "V6", "\\u", "ADDR", "\\u", "GLOBAL_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "r_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "r_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inet", "\\u", "pto", "n_", "(_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", ",_", "r_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
programa-stic/barf-project/barf/barf/arch/__init__.py
[ { "content": "# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky\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# 1. Redistributions of source code must retain the above copyright notice, this\n# list of conditions and the following disclaimer.\n\n# 2. Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions and the following disclaimer in the documentation\n# and/or other materials provided with the distribution.\n\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (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\nimport x86\n\nfrom arch import *\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import x86", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", ",", " ", "Fund", "acion", " ", "Dr", ".", " ", "Manu", "el", " ", "Sa", "dos", "ky_", "\\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_", "#", " ", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "ABLE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SERVICES", ";", " ", "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", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR", " ", "TOR", "T", " ", "(", "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_", "import_", "x8", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "arch_", "import_", "*_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
sigmavirus24/github3.py/tests/integration/test_pulls.py
[ { "content": " def test_close(self):\n \"\"\"Show that one can close an open Pull Request.\"\"\"\n self.basic_login()\n cassette_name = self.cassette_name('close')\n with self.recorder.use_cassette(cassette_name):\n p = self.get_pull_request(num=241)\n assert p.close() is True", "metadata": "root.TestPullRequest.test_close", "header": "['class', 'TestPullRequest', '(', 'IntegrationHelper', ')', ':', '___EOS___']", "index": 19 } ]
[ { "span": "assert p.close() is True", "start_line": 25, "start_column": 12, "end_line": 25, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "class_", "Test", "Pul", "l", "Request_", "(_", "Integrati", "on", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "tha", "t", " ", "one", " ", "can", " ", "close", " ", "an", " ", "open", " ", "Pul", "l", " ", "Request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basic", "\\u", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cassette", "\\u", "name_", "=_", "self_", "._", "cassette", "\\u", "name_", "(_", "'", "close", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "recorder_", "._", "use", "\\u", "cassette", "_", "(_", "cassette", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "get", "\\u", "pull", "\\u", "request_", "(_", "num_", "=_", "241_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "close_", "(_", ")_", "is_", "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, 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 import
psd-tools/psd-tools/src/psd_tools/user_api/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nfrom psd_tools.user_api.psd_image import PSDImage, Layer, Group, BBox\nfrom psd_tools.user_api.embedded import Embedded\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from psd_tools.user_api.psd_image import PSDImage, Layer, Group, BBox", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 69 }, { "span": "from psd_tools.user_api.embedded import Embedded", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "psd", "\\u", "tools_", "._", "user", "\\u", "api_", "._", "psd", "\\u", "image_", "import_", "PS", "DI", "mage_", ",_", "Layer_", ",_", "Group_", ",_", "BB", "ox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "psd", "\\u", "tools_", "._", "user", "\\u", "api_", "._", "embedde", "d_", "import_", "Emb", "edd", "ed_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
mahmoud/clastic/clastic/errors.py
[ { "content": " def __init__(self, detail=None, **kwargs):\n self.exc_info = kwargs.pop('exc_info', None)\n super(InternalServerError, self).__init__(detail, **kwargs)\n if self.error_type is None:\n try:\n exc_type_name = self.exc_info.exc_type\n exc_type = getattr(exceptions, exc_type_name)\n self.error_type = STDLIB_EXC_URL + exc_type.__name__\n except:\n pass", "metadata": "root.InternalServerError.__init__", "header": "['class', 'InternalServerError', '(', 'HTTPException', ')', ':', '___EOS___']", "index": 399 }, { "content": " def to_dict(self):\n ret = super(InternalServerError, self).to_dict()\n try:\n ret['exc_info'] = self.exc_info.to_dict()\n except:\n ret['exc_info'] = None\n return ret", "metadata": "root.InternalServerError.to_dict", "header": "['class', 'InternalServerError', '(', 'HTTPException', ')', ':', '___EOS___']", "index": 410 }, { "content": " def to_dict(self, *a, **kw):\n ret = super(ContextualInternalServerError, self).to_dict(*a, **kw)\n del ret['exc_info']\n exc_info = getattr(self, 'exc_info', None)\n if not exc_info:\n return ret\n exc_tb = exc_info.tb_info.to_dict()\n for i, frame in enumerate(exc_tb['frames']):\n if self.hide_internal_frames:\n if not frame['line'] and frame['module_path'] == '<string>':\n frame['is_hidden'] = True\n elif frame['module_name'] == 'clastic.sinter' and \\\n frame['func_name'] == 'inject':\n frame['is_hidden'] = True\n frame['id'] = i\n try:\n pre_start_lineno = frame['pre_lines'][0]['lineno']\n except IndexError:\n pre_start_lineno = 1\n frame['pre_start_lineno'] = pre_start_lineno\n frame['post_start_lineno'] = frame['lineno'] + 1\n try:\n last_frame = exc_tb['frames'][-1]\n except:\n last_frame = None\n\n eid = {'is_email': False,\n 'clastic_version_info': '0.4.1dev', # TODO\n 'exc_type': exc_info.exc_type,\n 'exc_value': exc_info.exc_msg,\n 'exc_tb': exc_tb,\n 'last_frame': last_frame,\n 'exc_tb_str': str(exc_info.tb_info),\n 'server_time': str(datetime.datetime.now()),\n 'server_time_utc': str(datetime.datetime.utcnow()),\n 'python': {'executable': sys.executable,\n 'version': sys.version.replace('\\n', ' '),\n 'path': sys.path}}\n request = self.request\n if request:\n eid['req'] = {'path': request.path,\n 'full_url': request.url,\n 'method': request.method,\n 'abs_path': request.path,\n 'url_params': request.args,\n 'cookies': request.cookies,\n 'headers': request.headers,\n 'files': request.files}\n ret.update(eid)\n return ret", "metadata": "root.ContextualInternalServerError.to_dict", "header": "['class', 'ContextualInternalServerError', '(', 'InternalServerError', ')', ':', '___EOS___']", "index": 510 } ]
[ { "span": "except:", "start_line": 407, "start_column": 12, "end_line": 407, "end_column": 19 }, { "span": "except:", "start_line": 414, "start_column": 8, "end_line": 414, "end_column": 15 }, { "span": "except:", "start_line": 533, "start_column": 8, "end_line": 533, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Intern", "al", "Server", "Error_", "(_", "HTTP", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "detail_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exc", "\\u", "info_", "=_", "kwargs_", "._", "pop_", "(_", "'", "exc", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Intern", "al", "Server", "Error_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "detail_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "error", "\\u", "type_", "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 ", " _", "exc", "\\u", "type", "\\u", "name_", "=_", "self_", "._", "exc", "\\u", "info_", "._", "exc", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "type_", "=_", "getattr_", "(_", "exceptions_", ",_", "exc", "\\u", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "type_", "=_", "STD", "LIB", "\\u", "EXC", "\\u", "URL_", "+_", "exc", "\\u", "type_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intern", "al", "Server", "Error_", "(_", "HTTP", "Exception_", ")_", ":_", "\\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_", "to", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "super_", "(_", "Intern", "al", "Server", "Error_", ",_", "self_", ")_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "exc", "\\u", "info", "'_", "]_", "=_", "self_", "._", "exc", "\\u", "info_", "._", "to", "\\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 ", " _", "ret_", "[_", "'", "exc", "\\u", "info", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context", "ual", "Intern", "al", "Server", "Error_", "(_", "Intern", "al", "Server", "Error_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dict_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "super_", "(_", "Context", "ual", "Intern", "al", "Server", "Error_", ",_", "self_", ")_", "._", "to", "\\u", "dict_", "(_", "*_", "a_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ret_", "[_", "'", "exc", "\\u", "info", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "info_", "=_", "getattr_", "(_", "self_", ",_", "'", "exc", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "exc", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc", "\\u", "tb_", "=_", "exc", "\\u", "info_", "._", "tb", "\\u", "info_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "frame_", "in_", "enumerate_", "(_", "exc", "\\u", "tb_", "[_", "'", "frames", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "hide", "\\u", "internal", "\\u", "frames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "frame_", "[_", "'", "line", "'_", "]_", "and_", "frame_", "[_", "'", "module", "\\u", "path", "'_", "]_", "==_", "'<", "string", ">'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frame_", "[_", "'", "is", "\\u", "hidden", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "frame_", "[_", "'", "module", "\\u", "name", "'_", "]_", "==_", "'", "clas", "tic", ".", "sint", "er", "'_", "and_", "frame_", "[_", "'", "func", "\\u", "name", "'_", "]_", "==_", "'", "inject", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frame_", "[_", "'", "is", "\\u", "hidden", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frame_", "[_", "'", "id", "'_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pre", "\\u", "start", "\\u", "lineno_", "=_", "frame_", "[_", "'", "pre", "\\u", "lines", "'_", "]_", "[_", "0_", "]_", "[_", "'", "linen", "o", "'_", "]_", "\\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 ", " _", "pre", "\\u", "start", "\\u", "lineno_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frame_", "[_", "'", "pre", "\\u", "start", "\\u", "linen", "o", "'_", "]_", "=_", "pre", "\\u", "start", "\\u", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "[_", "'", "post", "\\u", "start", "\\u", "linen", "o", "'_", "]_", "=_", "frame_", "[_", "'", "linen", "o", "'_", "]_", "+_", "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 ", " _", "last", "\\u", "frame_", "=_", "exc", "\\u", "tb_", "[_", "'", "frames", "'_", "]_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "frame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eid_", "=_", "{_", "'", "is", "\\u", "email", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clas", "tic", "\\u", "version", "\\u", "info", "'_", ":_", "'", "0.", "4.1", "dev", "'_", ",_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exc", "\\u", "type", "'_", ":_", "exc", "\\u", "info_", "._", "exc", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exc", "\\u", "value", "'_", ":_", "exc", "\\u", "info_", "._", "exc", "\\u", "msg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exc", "\\u", "tb", "'_", ":_", "exc", "\\u", "tb_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "frame", "'_", ":_", "last", "\\u", "frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exc", "\\u", "tb", "\\u", "str", "'_", ":_", "str_", "(_", "exc", "\\u", "info_", "._", "tb", "\\u", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "time", "'_", ":_", "str_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "time", "\\u", "utc", "'_", ":_", "str_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "python", "'_", ":_", "{_", "'", "executable", "'_", ":_", "sys_", "._", "executable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "sys_", "._", "version_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'", " ", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "sys_", "._", "path_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eid_", "[_", "'", "req", "'_", "]_", "=_", "{_", "'", "path", "'_", ":_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "url", "'_", ":_", "request_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "request_", "._", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "abs", "\\u", "path", "'_", ":_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "params", "'_", ":_", "request_", "._", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "s", "'_", ":_", "request_", "._", "cookies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "request_", "._", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "request_", "._", "files_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "._", "update_", "(_", "eid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\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,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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 ]
Unused import
QingdaoU/OnlineJudge/problem/migrations/0007_remove_problem_last_update_time.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('problem', '0006_merge'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='problem',\n name='last_update_time',\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "problem", "'_", ",_", "'", "0006", "\\u", "merge", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Remove", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "problem", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "last", "\\u", "update", "\\u", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Non-callable called
azoft-dev-team/imagrium/jars/Lib/sikuli/Sikuli.py
[ { "content": "# Copyright 2010-2013, Sikuli.org\n# Released under the MIT License.\n# modified RaiMan 2013\n\nfrom __future__ import with_statement\nfrom org.sikuli.basics import Debug\nDebug.log(3, \"Jython: sikuli: Sikuli: entering\")\nimport time\nimport __builtin__\nimport __main__\nimport types\nimport sys\nimport os\nimport inspect\n\nDebug.log(3, \"Jython: sikuli: Sikuli: constants\")\nimport org.sikuli.script.FindFailed as FindFailed\nfrom org.sikuli.script.FindFailedResponse import *\nfrom org.sikuli.script.Constants import *\nimport org.sikuli.script.Button as Button\nfrom org.sikuli.script.Button import WHEEL_UP, WHEEL_DOWN\nfrom org.sikuli.basics import OS\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Region\")\nfrom org.sikuli.script import Region as JRegion\nfrom Region import *\nfrom org.sikuli.script import Observing\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Screen\")\nfrom org.sikuli.script import Screen as JScreen\nfrom Screen import *\n\nDebug.log(3, \"Jython: sikuli: Sikuli: Env.addHotkey\")\nfrom Env import *\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Match\")\nfrom org.sikuli.script import Match\nDebug.log(3, \"Jython: sikuli: Sikuli: import Pattern\")\nfrom org.sikuli.script import Pattern\nDebug.log(3, \"Jython: sikuli: Sikuli: import Location\")\nfrom org.sikuli.script import Location\nDebug.log(3, \"Jython: sikuli: Sikuli: import ScreenUnion\")\nfrom org.sikuli.script import ScreenUnion\nDebug.log(3, \"Jython: sikuli: Sikuli: import Finder\")\nfrom org.sikuli.script import Finder\nfrom org.sikuli.script import ImageFinder\nfrom org.sikuli.script import ImageFind\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Image\")\nfrom org.sikuli.script import Image\nfrom org.sikuli.script import ImageGroup\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import ImagePath\")\nfrom org.sikuli.script import ImagePath\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import App\")\nfrom org.sikuli.script import App\nDebug.log(3, \"Jython: sikuli: Sikuli: import KeyBoard/Mouse\")\nfrom org.sikuli.script import Key\nfrom org.sikuli.script import KeyModifier\nfrom org.sikuli.script.KeyModifier import KEY_CTRL, KEY_SHIFT, KEY_META, KEY_CMD, KEY_WIN, KEY_ALT\nfrom org.sikuli.script import Mouse\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import from Basics\")\nfrom org.sikuli.basics import Settings\nfrom org.sikuli.basics import ExtensionManager\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import from compare\")\nfrom org.sikuli.script.compare import DistanceComparator\nfrom org.sikuli.script.compare import VerticalComparator\nfrom org.sikuli.script.compare import HorizontalComparator\n\nDebug.log(3, \"Jython: sikuli: Sikuli: init SikuliImporter\")\nimport SikuliImporter\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import SikuliX\")\nfrom org.sikuli.basics import SikuliScript\nfrom org.sikuli.basics import SikuliX\n\n##\n# some support for handling unicode and strings\n#\n## use instead of print if unicode strings present\n# usage: uprint(s1, u1, u2, u3, s3, ...)\n#\n\n##\n# to make an utf8-encoded string from a str object\n#\n\n\n##\n# loads a Sikuli extension (.jar) from\n# 1. user's sikuli data path\n# 2. bundle path\n#\n\n##\n# append the given path sys.path if not yet contained\n#\n\n##\n# append the given path image path list if not yet contained\n#\n\n##\n# return the current image path list\n#\n\n##\n# remove the given path from the image path\n#\n\n##\n# reset the image path, so it only contains the bundlepath\n#\n\n##\n# Sets the path for searching images in all Sikuli Script methods. <br/>\n# Sikuli IDE sets this to the path of the bundle of source code (.sikuli)\n# automatically. If you write Sikuli scripts by the Sikuli IDE, you should\n# not call this method.\n#\n\n##\n# return the current bundlepath (usually the folder .sikuli) or None if no bundlepath is defined\n#\n\n##\n# return the parent folder of the current bundlepath\n# (usually the folder containing the current script folder.sikuli)\n# or None if no bundlepath is defined\n#\n\n##\n# make a valid path by joining the two paths (path2 might be a list)\n#\n\n##\n# Sikuli shows actions (click, dragDrop, ... etc.) if this flag is set to <i>True</i>.\n# The default setting is <i>False</i>.\n#\n\n##\n# Shows a message dialog containing the given message.\n# @param msg The given message string.\n\n##\n# Shows a question-message dialog requesting input from the user.\n# @param msg The message to display.\n# @param default The preset text of the input field (default empty).\n# @param title the title for the dialog (default: Sikuli input request)\n# @param hidden =true makes the dialog run as a password input (input hidden with bullets)\n# @return The user's input string.\n#\n##\n# Shows a dialog request to enter text in a multiline text field\n# Though not all text might be visible, everything entered is delivered with the returned text\n# The main purpose for this feature is to allow pasting text from somewhere\n# @param msg the message to display.\n# @param title the title for the dialog (default: Sikuli input request)\n# @param lines the maximum number of lines visible in the text field (default 9)\n# @param width the maximum number of characters visible in one line (default 20)\n# @return The user's input including the line breaks.\n\n\n\n\n##\n# set the default screen to given or primary screen\n#\n# TODO where else to remember an opened remote screen?\nremoteScreen = None\n\n\n##\n# set the default screen to given remote screen\n#\n\n##\n# Switches the frontmost application to the given application.\n# If the given application is not running, it will be launched by openApp()\n# automatically. <br/>\n# Note: On Windows, Sikule searches in the text on the title bar\n# instead of the application name.\n# @param app The name of the application. (case-insensitive)\n#\n\n##\n# Opens the given application. <br/>\n# @param app The name of an application if it is in the environment variable PATH, or the full path to an application.\n#\n\n##\n# Closes the given application. <br/>\n# @param app The name of the application. (case-insensitive)\n#\n\n##\n# Sleeps until the given amount of time in seconds has elapsed.\n# @param sec The amount of sleeping time in seconds.\n\n##\n# shutdown and return given exit code\n#\n\n##\n# Runs the given string command.\n# @param msg The given string command.\n# @return Returns the output from the executed command.\n\n##\n# display some help in interactive mode\n\n##\n# helper functions, that can be used when sorting lists of regions\n#\n\n\n\n\n\n\n##\n################## internal use only ###########################################\n#\n\n\n############### set SCREEN as primary screen at startup ################\nuse()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def useRemote(adr, port = 0):\n global remoteScreen\n import org.sikuli.script.ScreenRemote as SR\n SCREEN = SR(adr, str(port))\n if SCREEN.isValid():\n return use(SCREEN, True)\n else:\n return None", "metadata": "root.useRemote", "header": "['module', '___EOS___']", "index": 292 } ]
[ { "span": "SR(adr, str(port))", "start_line": 295, "start_column": 11, "end_line": 295, "end_column": 29 } ]
[ { "span": "org.sikuli.script.ScreenRemote ", "start_line": 294, "start_column": 9, "end_line": 294, "end_column": 39 } ]
1
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", "-", "2013", ",", " ", "Si", "kul", "i", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Release", "d", " ", "under", " ", "the", " ", "MIT", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modifi", "ed", " ", "Rai", "Man", " ", "2013_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "entering", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "\\u\\u", "builtin\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "constant", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Fin", "d", "Failed_", "as_", "Fin", "d", "Failed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Fin", "d", "Fail", "ed", "Response_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Button_", "as_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Button_", "import_", "WHE", "EL", "\\u", "UP_", ",_", "WHE", "EL", "\\u", "DOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "OS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Region", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Region_", "as_", "JR", "egi", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Region_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Observ", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Scr", "een", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Screen_", "as_", "JS", "creen", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Screen_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "Env", ".", "add", "Hot", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Env_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Pat", "tern", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Locat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Scr", "een", "Uni", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Scr", "een", "Union_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Fin", "der", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Find_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Image", "Path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "App", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "App_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Key", "Boa", "rd", "/", "Mouse", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Key", "Modifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Key", "Modifier_", "import_", "KEY", "\\u", "CTR", "L_", ",_", "KEY", "\\u", "SHIFT_", ",_", "KEY", "\\u", "META_", ",_", "KEY", "\\u", "CMD_", ",_", "KEY", "\\u", "WIN", "_", ",_", "KEY", "\\u", "ALT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Mouse", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "from", " ", "Basic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Ext", "ensi", "on", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "from", " ", "compare", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Distan", "ce", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Vertica", "l", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Horiz", "onta", "l", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "init", " ", "Si", "kul", "i", "Import", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Si", "kul", "i", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Si", "kul", "i", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Si", "kul", "i", "Script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Si", "kul", "i", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "support", " ", "for", " ", "handling", " ", "unicode", " ", "and", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "use", " ", "inst", "ead", " ", "of", " ", "print", " ", "if", " ", "unicode", " ", "string", "s", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usage", ":", " ", "upr", "int", "(", "s1", ",", " ", "u1", ",", " ", "u2", ",", " ", "u", "3", ",", " ", "s3", ",", " ", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "make", " ", "an", " ", "utf", "8", "-", "encode", "d", " ", "string", " ", "from", " ", "a", " ", "str", " ", "object_", "\\u\\u\\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_", "#", " ", "load", "s", " ", "a", " ", "Si", "kul", "i", " ", "extensi", "on", " ", "(.", "jar", ")", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "1", ".", " ", "user", "'", "s", " ", "si", "kul", "i", " ", "data", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "2", ".", " ", "bundle", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "give", "n", " ", "path", " ", "sys", ".", "path", " ", "if", " ", "not", " ", "ye", "t", " ", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "give", "n", " ", "path", " ", "image", " ", "path", " ", "list", " ", "if", " ", "not", " ", "ye", "t", " ", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "current", " ", "image", " ", "path", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "give", "n", " ", "path", " ", "from", " ", "the", " ", "image", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "the", " ", "image", " ", "path", ",", " ", "so", " ", "it", " ", "only", " ", "contain", "s", " ", "the", " ", "bundle", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "s", " ", "the", " ", "path", " ", "for", " ", "search", "ing", " ", "images", " ", "in", " ", "all", " ", "Si", "kul", "i", " ", "Script", " ", "method", "s", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Si", "kul", "i", " ", "IDE", " ", "sets", " ", "this", " ", "to", " ", "the", " ", "path", " ", "of", " ", "the", " ", "bundle", " ", "of", " ", "source", " ", "code", " ", "(.", "si", "kul", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", ".", " ", "If", " ", "you", " ", "write", " ", "Si", "kul", "i", " ", "scripts", " ", "by", " ", "the", " ", "Si", "kul", "i", " ", "IDE", ",", " ", "you", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "call", " ", "this", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "current", " ", "bundle", "path", " ", "(", "usual", "ly", " ", "the", " ", "folder", " ", ".", "si", "kul", "i", ")", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "bundle", "path", " ", "is", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "parent", " ", "folder", " ", "of", " ", "the", " ", "current", " ", "bundle", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "usual", "ly", " ", "the", " ", "folder", " ", "contain", "ing", " ", "the", " ", "current", " ", "script", " ", "folder", ".", "si", "kul", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "bundle", "path", " ", "is", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "valid", " ", "path", " ", "by", " ", "join", "ing", " ", "the", " ", "two", " ", "path", "s", " ", "(", "path", "2", " ", "mig", "ht", " ", "be", " ", "a", " ", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Si", "kul", "i", " ", "show", "s", " ", "action", "s", " ", "(", "click", ",", " ", "drag", "Drop", ",", " ", "...", " ", "etc", ".)", " ", "if", " ", "this", " ", "flag", " ", "is", " ", "set", " ", "to", " ", "<", "i", ">", "Tru", "e", "</", "i", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "setti", "ng", " ", "is", " ", "<", "i", ">", "Fal", "se", "</", "i", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "message", " ", "dialog", " ", "contain", "ing", " ", "the", " ", "give", "n", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "give", "n", " ", "message", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "question", "-", "message", " ", "dialog", " ", "request", "ing", " ", "input", " ", "from", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "message", " ", "to", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "default", " ", "The", " ", "prese", "t", " ", "text", " ", "of", " ", "the", " ", "input", " ", "field", " ", "(", "default", " ", "empty", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "title", " ", "the", " ", "title", " ", "for", " ", "the", " ", "dialog", " ", "(", "default", ":", " ", "Si", "kul", "i", " ", "input", " ", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "hidden", " ", "=", "true", " ", "make", "s", " ", "the", " ", "dialog", " ", "run", " ", "as", " ", "a", " ", "password", " ", "input", " ", "(", "input", " ", "hidden", " ", "with", " ", "bullet", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "The", " ", "user", "'", "s", " ", "input", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "dialog", " ", "request", " ", "to", " ", "enter", " ", "text", " ", "in", " ", "a", " ", "multiline", " ", "text", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tho", "ugh", " ", "not", " ", "all", " ", "text", " ", "mig", "ht", " ", "be", " ", "visi", "ble", ",", " ", "every", "thing", " ", "enter", "ed", " ", "is", " ", "deliver", "ed", " ", "with", " ", "the", " ", "return", "ed", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "main", " ", "purpose", " ", "for", " ", "this", " ", "feature", " ", "is", " ", "to", " ", "allow", " ", "past", "ing", " ", "text", " ", "from", " ", "some", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "the", " ", "message", " ", "to", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "title", " ", "the", " ", "title", " ", "for", " ", "the", " ", "dialog", " ", "(", "default", ":", " ", "Si", "kul", "i", " ", "input", " ", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "lines", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "lines", " ", "visi", "ble", " ", "in", " ", "the", " ", "text", " ", "field", " ", "(", "default", " ", "9", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "widt", "h", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "character", "s", " ", "visi", "ble", " ", "in", " ", "one", " ", "line", " ", "(", "default", " ", "20", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "The", " ", "user", "'", "s", " ", "input", " ", "inclu", "ding", " ", "the", " ", "line", " ", "breaks", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "set", " ", "the", " ", "default", " ", "screen", " ", "to", " ", "give", "n", " ", "or", " ", "primary", " ", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "where", " ", "else", " ", "to", " ", "remember", " ", "an", " ", "opene", "d", " ", "remote", " ", "screen", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "Screen_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "default", " ", "screen", " ", "to", " ", "give", "n", " ", "remote", " ", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Switche", "s", " ", "the", " ", "front", "most", " ", "applica", "tion", " ", "to", " ", "the", " ", "give", "n", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "give", "n", " ", "applica", "tion", " ", "is", " ", "not", " ", "runn", "ing", ",", " ", "it", " ", "will", " ", "be", " ", "launched", " ", "by", " ", "open", "App", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "On", " ", "Window", "s", ",", " ", "Si", "kul", "e", " ", "searche", "s", " ", "in", " ", "the", " ", "text", " ", "on", " ", "the", " ", "title", " ", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "the", " ", "applica", "tion", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "the", " ", "applica", "tion", ".", " ", "(", "case", "-", "inse", "nsitive", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opens", " ", "the", " ", "give", "n", " ", "applica", "tion", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "an", " ", "applica", "tion", " ", "if", " ", "it", " ", "is", " ", "in", " ", "the", " ", "environ", "ment", " ", "variab", "le", " ", "PATH", ",", " ", "or", " ", "the", " ", "full", " ", "path", " ", "to", " ", "an", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Closes", " ", "the", " ", "give", "n", " ", "applica", "tion", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "the", " ", "applica", "tion", ".", " ", "(", "case", "-", "inse", "nsitive", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sleep", "s", " ", "unti", "l", " ", "the", " ", "give", "n", " ", "amo", "unt", " ", "of", " ", "time", " ", "in", " ", "second", "s", " ", "has", " ", "ela", "pse", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "sec", " ", "The", " ", "amo", "unt", " ", "of", " ", "sleep", "ing", " ", "time", " ", "in", " ", "second", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shut", "down", " ", "and", " ", "return", " ", "give", "n", " ", "exit", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", "s", " ", "the", " ", "give", "n", " ", "string", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "give", "n", " ", "string", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "Return", "s", " ", "the", " ", "output", " ", "from", " ", "the", " ", "executed", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "display", " ", "some", " ", "help", " ", "in", " ", "interactive", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", "er", " ", "function", "s", ",", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "whe", "n", " ", "sorting", " ", "lists", " ", "of", " ", "regions_", "\\u\\u\\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\\uNL\\u\\u\\u_", "###########", "######", "#", " ", "internal", " ", "use", " ", "only", " ", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\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_", "###########", "###", "#", " ", "set", " ", "SCREEN", " ", "as", " ", "primary", " ", "screen", " ", "at", " ", "start", "up", " ", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "use_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "use", "Remote_", "(_", "adr", "_", ",_", "port_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "remote", "Screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Scr", "een", "Remote_", "as_", "SR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SCREEN", "_", "=_", "SR_", "(_", "adr", "_", ",_", "str_", "(_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "SCREEN", "_", "._", "is", "Valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "use_", "(_", "SCREEN", "_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unused import
spranesh/Redhawk/redhawk/utils/task_runner.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\" This module implements a TaskRunner class, which can be used to run\ntasks, such as those in redhawk.scripts.tasks.\n\nThis allows easy switching between running a task normally, and in parallel.\n\nThe first argument of a task is expected to be an iterable, which will be\nchunked, before calling the workers in case of a parallel task run.\n\"\"\"\n\nfrom __future__ import absolute_import\nimport os\nimport sys\n\npp_not_found_error = \"\"\"\nThe pp (parallel python) module was not found. If you have installed it,\nplease ensure that it is in python's path, by entering a python prompt, and\ntrying 'import pp'.\n\nIf you don't have it, you can get it from:\n\nhttp://www.parallelpython.com/ or http://pypi.python.org/pypi/pp\n\nYou can also get it from pip:\n\n $ pip install pp\n\nPlease run redhawk without the parallel option in the meantime.\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TaskRunner:\n\n\n\n\n\n", "metadata": "root.TaskRunner", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self,\n task,\n parallel=False,\n num_workers=0,\n chunk=80,\n servers = None,\n module_deps = None,\n function_deps = None,\n verbose = False):\n \"\"\" Create an instance of the Task Runner class.\n\n If parallel is False, the `task` is run on the args (see __call__). Else,\n\n Else, `num_workers` are created, and the first element of args (which should\n be an iterable) is chunked into `chunk` sizes. If `num_workers` is 0, it\n is auto detected.\n\n `module_deps` are a tuple of modules that the task depends on.\n `function_deps` are a tuple of functions that the task depends on.\n \"\"\"\n\n self.task = task\n self.parallel = parallel\n\n self.num_workers = num_workers or \"autodetect\"\n self.servers = servers or ()\n self.chunk = chunk\n\n if function_deps:\n self.function_deps = tuple(function_deps)\n else:\n self.function_deps = ()\n\n if module_deps:\n self.module_deps = tuple(module_deps)\n else:\n self.module_deps = ()\n\n self.verbose = verbose\n\n if parallel:\n try:\n import pp\n except ImportError as e:\n sys.stderr.write(pp_not_found_error)\n sys.exit(1)\n\n self.pp = pp\n return", "metadata": "root.TaskRunner.__init__", "header": "['class', 'TaskRunner', ':', '___EOS___']", "index": 32 }, { "content": " def __call__(self, *args):\n if self.parallel:\n args = list(args)\n if type(args[0]) is not list:\n args[0] = list(args[0])\n return self.RunParallel(args)\n else:\n return self.RunNormal(args)", "metadata": "root.TaskRunner.__call__", "header": "['class', 'TaskRunner', ':', '___EOS___']", "index": 83 }, { "content": " def RunNormal(self, args):\n \"\"\" Run the `task` normally.\"\"\"\n return self.task(*args)", "metadata": "root.TaskRunner.RunNormal", "header": "['class', 'TaskRunner', ':', '___EOS___']", "index": 93 }, { "content": " def RunParallel(self, args):\n job_server = self.pp.Server(\n ncpus = self.num_workers,\n ppservers = self.servers,\n secret='redhawk-secret-key')\n\n if self.verbose:\n sys.stderr.write(\"Starting pp with %s workers\\n\"%(job_server.get_ncpus()))\n\n jobs = []\n\n load = args[0]\n dispatched = 0\n\n while dispatched < len(load):\n args[0] = load[dispatched : dispatched+self.chunk]\n dispatched += self.chunk\n\n jobs.append(job_server.submit(\n self.task,\n tuple(args),\n self.function_deps,\n self.module_deps,\n ))\n \n results = [job() for job in jobs]\n\n if self.verbose:\n fp = sys.stdout\n sys.stdout = sys.stderr\n job_server.print_stats()\n sys.stdout = fp\n\n job_server.destroy()\n return results", "metadata": "root.TaskRunner.RunParallel", "header": "['class', 'TaskRunner', ':', '___EOS___']", "index": 98 } ]
[ { "span": "import os", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 9 } ]
[]
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_", "\"\"\"", " ", "Thi", "s", " ", "module", " ", "implement", "s", " ", "a", " ", "Task", "Run", "ner", " ", "class", ",", " ", "whi", "ch", " ", "can", " ", "be", " ", "used", " ", "to", " ", "run", "\\", "10", ";", "task", "s", ",", " ", "suc", "h", " ", "as", " ", "tho", "se", " ", "in", " ", "red", "haw", "k", ".", "scripts", ".", "task", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "allow", "s", " ", "easy", " ", "switching", " ", "bet", "ween", " ", "runn", "ing", " ", "a", " ", "task", " ", "normal", "ly", ",", " ", "and", " ", "in", " ", "parall", "el", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "first", " ", "argu", "ment", " ", "of", " ", "a", " ", "task", " ", "is", " ", "expected", " ", "to", " ", "be", " ", "an", " ", "iterable", ",", " ", "whi", "ch", " ", "will", " ", "be", "\\", "10", ";", "chunked", ",", " ", "bef", "ore", " ", "calling", " ", "the", " ", "worker", "s", " ", "in", " ", "case", " ", "of", " ", "a", " ", "parall", "el", " ", "task", " ", "run", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pp", "\\u", "not", "\\u", "found", "\\u", "error_", "=_", "\"\"\"", "\\", "10", ";", "The", " ", "pp", " ", "(", "parall", "el", " ", "python", ")", " ", "module", " ", "was", " ", "not", " ", "found", ".", " ", "If", " ", "you", " ", "have", " ", "install", "ed", " ", "it", ",", "\\", "10", ";", "plea", "se", " ", "ensure", " ", "tha", "t", " ", "it", " ", "is", " ", "in", " ", "python", "'", "s", " ", "path", ",", " ", "by", " ", "entering", " ", "a", " ", "python", " ", "prompt", ",", " ", "and", "\\", "10", ";", "try", "ing", " ", "'", "import", " ", "pp", "'.", "\\", "10", ";", "\\", "10", ";", "If", " ", "you", " ", "don", "'", "t", " ", "have", " ", "it", ",", " ", "you", " ", "can", " ", "get", " ", "it", " ", "from", ":", "\\", "10", ";", "\\", "10", ";", "http", "://", "www", ".", "parall", "elp", "yth", "on", ".", "com", "/", " ", "or", " ", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "pp", "\\", "10", ";", "\\", "10", ";", "You", " ", "can", " ", "als", "o", " ", "get", " ", "it", " ", "from", " ", "pip", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "$", " ", "pip", " ", "install", " ", "pp", "\\", "10", ";", "\\", "10", ";", "Ple", "ase", " ", "run", " ", "red", "haw", "k", " ", "with", "out", " ", "the", " ", "parall", "el", " ", "option", " ", "in", " ", "the", " ", "mean", "time", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Task", "Runner_", ":_", "\\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_", "Task", "Runner_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parallel_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "workers_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunk_", "=_", "80_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "servers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "deps_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "deps_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "Task", " ", "Run", "ner", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "parall", "el", " ", "is", " ", "Fal", "se", ",", " ", "the", " ", "`", "task", "`", " ", "is", " ", "run", " ", "on", " ", "the", " ", "args", " ", "(", "see", " ", "\\u\\u", "call", "\\u\\u)", ".", " ", " ", "Else", ",", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Else", ",", " ", "`", "num", "\\u", "worker", "s", "`", " ", "are", " ", "created", ",", " ", "and", " ", "the", " ", "first", " ", "element", " ", "of", " ", "args", " ", "(", "whi", "ch", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "an", " ", "iterable", ")", " ", "is", " ", "chunked", " ", "int", "o", " ", "`", "chunk", "`", " ", "size", "s", ".", " ", "If", " ", "`", "num", "\\u", "worker", "s", "`", " ", "is", " ", "0", ",", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "auto", " ", "detect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "module", "\\u", "dep", "s", "`", " ", "are", " ", "a", " ", "tuple", " ", "of", " ", "module", "s", " ", "tha", "t", " ", "the", " ", "task", " ", "depend", "s", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "`", "function", "\\u", "dep", "s", "`", " ", "are", " ", "a", " ", "tuple", " ", "of", " ", "function", "s", " ", "tha", "t", " ", "the", " ", "task", " ", "depend", "s", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parallel_", "=_", "parallel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "num", "\\u", "workers_", "=_", "num", "\\u", "workers_", "or_", "\"", "autode", "tect", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "servers_", "=_", "servers_", "or_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chunk_", "=_", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "function", "\\u", "deps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "function", "\\u", "deps_", "=_", "tuple_", "(_", "function", "\\u", "deps_", ")_", "\\u\\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_", "._", "function", "\\u", "deps_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "module", "\\u", "deps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "module", "\\u", "deps_", "=_", "tuple_", "(_", "module", "\\u", "deps_", ")_", "\\u\\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_", "._", "module", "\\u", "deps_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "verbose_", "=_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parallel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pp_", "\\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 ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "pp", "\\u", "not", "\\u", "found", "\\u", "error_", ")_", "\\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_", "._", "pp_", "=_", "pp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Runner_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "parallel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "is_", "not_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "0_", "]_", "=_", "list_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "Run", "Parallel", "_", "(_", "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 ", " _", "return_", "self_", "._", "Run", "Normal_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Runner_", ":_", "\\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", "Normal_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Run", " ", "the", " ", "`", "task", "`", " ", "normal", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "task_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Runner_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Run", "Parallel", "_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "server_", "=_", "self_", "._", "pp_", "._", "Server_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ncp", "us_", "=_", "self_", "._", "num", "\\u", "workers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pps", "erver", "s_", "=_", "self_", "._", "servers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secret_", "=_", "'", "red", "haw", "k", "-", "secret", "-", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Start", "ing", " ", "pp", " ", "with", " ", "%", "s", " ", "worker", "s", "\\\\", "n", "\"_", "%_", "(_", "job", "\\u", "server_", "._", "get", "\\u", "ncp", "us_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jobs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "load_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispatch", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "dispatch", "ed_", "<_", "len_", "(_", "load_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "0_", "]_", "=_", "load_", "[_", "dispatch", "ed_", ":_", "dispatch", "ed_", "+_", "self_", "._", "chunk_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispatch", "ed_", "+=_", "self_", "._", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jobs_", "._", "append_", "(_", "job", "\\u", "server_", "._", "submit_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tuple_", "(_", "args_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "function", "\\u", "deps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "module", "\\u", "deps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "job_", "(_", ")_", "for_", "job_", "in_", "jobs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "server_", "._", "print", "\\u", "stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "server_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
`__eq__` not overridden when adding attributes
graphql-python/graphene/graphene/core/types/base.py
[ { "content": "class InstanceType(object):\n", "metadata": "root.InstanceType", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def internal_type(self, schema):\n raise NotImplementedError(\"internal_type for type {} is not implemented\".format(self.__class__.__name__))", "metadata": "root.InstanceType.internal_type", "header": "['class', 'InstanceType', '(', 'object', ')', ':', '___EOS___']", "index": 8 }, { "content": "class MountType(InstanceType):\n parent = None\n", "metadata": "root.MountType", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def mount(self, cls):\n self.parent = cls", "metadata": "root.MountType.mount", "header": "['class', 'MountType', '(', 'InstanceType', ')', ':', '___EOS___']", "index": 15 }, { "content": "@total_ordering\nclass OrderedType(MountType):\n creation_counter = 0\n\n\n\n\n\n", "metadata": "root.OrderedType", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self, _creation_counter=None):\n self.creation_counter = _creation_counter or self.gen_counter()", "metadata": "root.OrderedType.__init__", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 45 }, { "content": " @staticmethod\n def gen_counter():\n counter = OrderedType.creation_counter\n OrderedType.creation_counter += 1\n return counter", "metadata": "root.OrderedType.gen_counter", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 48 }, { "content": " def __eq__(self, other):\n # Needed for @total_ordering\n if isinstance(self, type(other)):\n return self.creation_counter == other.creation_counter\n return NotImplemented", "metadata": "root.OrderedType.__eq__", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 54 }, { "content": " def __lt__(self, other):\n # This is needed because bisect does not take a comparison function.\n if isinstance(other, OrderedType):\n return self.creation_counter < other.creation_counter\n return NotImplemented", "metadata": "root.OrderedType.__lt__", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 60 }, { "content": " def __gt__(self, other):\n # This is needed because bisect does not take a comparison function.\n if isinstance(other, OrderedType):\n return self.creation_counter > other.creation_counter\n return NotImplemented", "metadata": "root.OrderedType.__gt__", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 66 }, { "content": " def __hash__(self):\n return hash((self.creation_counter))", "metadata": "root.OrderedType.__hash__", "header": "['class', 'OrderedType', '(', 'MountType', ')', ':', '___EOS___']", "index": 72 }, { "content": "class MirroredType(OrderedType):\n\n\n", "metadata": "root.MirroredType", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def __init__(self, *args, **kwargs):\n _creation_counter = kwargs.pop('_creation_counter', None)\n super(MirroredType, self).__init__(_creation_counter=_creation_counter)\n self.args = args\n self.kwargs = kwargs", "metadata": "root.MirroredType.__init__", "header": "['class', 'MirroredType', '(', 'OrderedType', ')', ':', '___EOS___']", "index": 78 }, { "content": " @property\n def List(self): # noqa\n from .definitions import List\n return List(self, *self.args, **self.kwargs)", "metadata": "root.MirroredType.List", "header": "['class', 'MirroredType', '(', 'OrderedType', ')', ':', '___EOS___']", "index": 84 }, { "content": " @property\n def NonNull(self): # noqa\n from .definitions import NonNull\n return NonNull(self, *self.args, **self.kwargs)", "metadata": "root.MirroredType.NonNull", "header": "['class', 'MirroredType', '(', 'OrderedType', ')', ':', '___EOS___']", "index": 89 } ]
[ { "span": "class MirroredType(OrderedType):", "start_line": 76, "start_column": 0, "end_line": 76, "end_column": 32 } ]
[ { "span": "def __eq__(self, other):", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 28 }, { "span": "self.args ", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 17 }, { "span": "self.kwargs ", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 19 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Insta", "nce", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "internal", "\\u", "type_", "(_", "self_", ",_", "schema_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "internal", "\\u", "type", " ", "for", " ", "type", " ", "{}", " ", "is", " ", "not", " ", "implemented", "\"_", "._", "format_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\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_", "Mount", "Type_", "(_", "Insta", "nce", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mount", "Type_", "(_", "Insta", "nce", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mount_", "(_", "self_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "=_", "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_", "@_", "total", "\\u", "ordering_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creati", "on", "\\u", "counter_", "=_", "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_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u", "creati", "on", "\\u", "counter_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "creati", "on", "\\u", "counter_", "=_", "\\u", "creati", "on", "\\u", "counter_", "or_", "self_", "._", "gen", "\\u", "counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gen", "\\u", "counter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "=_", "Order", "ed", "Type_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Order", "ed", "Type_", "._", "creati", "on", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Needed", " ", "for", " ", "@", "total", "\\u", "ordering_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", ",_", "type_", "(_", "other_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "creati", "on", "\\u", "counter_", "==_", "other_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "bec", "aus", "e", " ", "bisect", " ", "doe", "s", " ", "not", " ", "take", " ", "a", " ", "compa", "ris", "on", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "Order", "ed", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "creati", "on", "\\u", "counter_", "<_", "other_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\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_", "#", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "bec", "aus", "e", " ", "bisect", " ", "doe", "s", " ", "not", " ", "take", " ", "a", " ", "compa", "ris", "on", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "Order", "ed", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "creati", "on", "\\u", "counter_", ">_", "other_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Type_", "(_", "Mount", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "(_", "self_", "._", "creati", "on", "\\u", "counter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mirror", "ed", "Type_", "(_", "Order", "ed", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Mirror", "ed", "Type_", "(_", "Order", "ed", "Type_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "creati", "on", "\\u", "counter_", "=_", "kwargs_", "._", "pop_", "(_", "'\\u", "creati", "on", "\\u", "counter", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Mirror", "ed", "Type_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u", "creati", "on", "\\u", "counter_", "=_", "\\u", "creati", "on", "\\u", "counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kwargs_", "=_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mirror", "ed", "Type_", "(_", "Order", "ed", "Type_", ")_", ":_", "\\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_", "List_", "(_", "self_", ")_", ":_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "definitions_", "import_", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "List_", "(_", "self_", ",_", "*_", "self_", "._", "args_", ",_", "**_", "self_", "._", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mirror", "ed", "Type_", "(_", "Order", "ed", "Type_", ")_", ":_", "\\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_", "Non", "Null_", "(_", "self_", ")_", ":_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "definitions_", "import_", "Non", "Null_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Non", "Null_", "(_", "self_", ",_", "*_", "self_", "._", "args_", ",_", "**_", "self_", "._", "kwargs_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 3, 1, 1, 2, 2, 2, 3, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
columbia/libtrack/libtrack/parser/scripts/bipolar.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nmodule documentation\ngoes here\n\"\"\"\nimport sys\nimport re\nimport matplotlib.pyplot as plt\nfrom telesphorus.helpers import path_utils\n\ncalls = []\nGLOBAL = []\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n sys.exit(main())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(argv=sys.argv):\n \"\"\"\n Identify missing abstration of frequently occuring\n patterns and print them.\n \"\"\"\n if len(argv) != 3:\n usage(argv)\n for i in range(len(argv)):\n if argv[i] == \"-t\":\n trace_dir = argv[i + 1]\n path_utils.walktree(trace_dir, build_from_file)\n # fw = open(\"./timeindex\", \"w\")\n for c in calls:\n print >> fw, c[0], GLOBAL[c[1]]\n fw.close()\n if argv[i] == \"-csv\":\n csv = argv[i + 1]\n fw = open(csv, \"r\")\n build_from_csv(csv)\n points = []\n for call in calls:\n name = call[1]\n time = int(call[0])\n points.append([time, name])\n\n # print len(points)\n plt.plot(map(lambda c:c[0],points), map(lambda c:c[1],points), 'ro', markersize=1, label=None)\n plt.xlabel('Time to complete (microseconds)')\n plt.xscale('log')\n plt.ylabel('POSIX calls')\n plt.title('Bipolar Time Graph')\n #plt.show()\n plt.savefig('time-bipolar.png', format='png')", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 13 } ]
[ { "span": "main())", "start_line": 106, "start_column": 13, "end_line": 106, "end_column": 19 } ]
[ { "span": "def main(argv=sys.argv):", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 24 } ]
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_", "\"\"\"", "\\", "10", ";", "module", " ", "documentation", "\\", "10", ";", "go", "es", " ", "here", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tele", "sph", "or", "us_", "._", "helpers_", "import_", "path", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "calls_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GLOBAL_", "=_", "[_", "]_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Identif", "y", " ", "missi", "ng", " ", "abs", "trat", "ion", " ", "of", " ", "frequent", "ly", " ", "occur", "ing", "\\", "10", ";", " ", " ", " ", " ", "pattern", "s", " ", "and", " ", "print", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "argv_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "argv_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "argv_", "[_", "i_", "]_", "==_", "\"-", "t", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trace", "\\u", "dir_", "=_", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "utils_", "._", "walk", "tree_", "(_", "trace", "\\u", "dir_", ",_", "build", "\\u", "from", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "fw", " ", "=", " ", "open", "(\".", "/", "time", "index", "\",", " ", "\"", "w", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "c_", "in_", "calls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "fw_", ",_", "c_", "[_", "0_", "]_", ",_", "GLOBAL_", "[_", "c_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fw_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "argv_", "[_", "i_", "]_", "==_", "\"-", "csv", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv_", "=_", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fw_", "=_", "open_", "(_", "csv_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "from", "\\u", "csv_", "(_", "csv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "call_", "in_", "calls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "call_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "=_", "int_", "(_", "call_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "._", "append_", "(_", "[_", "time_", ",_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", " ", "len", "(", "points", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "plot_", "(_", "map_", "(_", "lambda_", "c_", ":_", "c_", "[_", "0_", "]_", ",_", "points_", ")_", ",_", "map_", "(_", "lambda_", "c_", ":_", "c_", "[_", "1_", "]_", ",_", "points_", ")_", ",_", "'", "ro", "'_", ",_", "markersize_", "=_", "1_", ",_", "label_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "'", "Time", " ", "to", " ", "complete", " ", "(", "microsecond", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xscale_", "(_", "'", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "'", "POSI", "X", " ", "calls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "'", "Bi", "polar", " ", "Time", " ", "Graph", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "plt", ".", "show", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "'", "time", "-", "bip", "ola", "r", ".", "png", "'_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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 ]
Special method has incorrect signature
uci-cbcl/tree-hmm/gmtkParam/__init__.py
[ { "content": " def __contains__(self, (obj_type, name)):\n return name in self._objects[obj_type]", "metadata": "root.Workspace.__contains__", "header": "['class', 'Workspace', '(', 'object', ')', ':', '___EOS___']", "index": 1660 }, { "content": " def __delitem__(self, (obj_type, name)):\n obj = self._objects[obj_type][name]\n del self._objects[obj_type][name]\n obj.parent = None", "metadata": "root.Workspace.__delitem__", "header": "['class', 'Workspace', '(', 'object', ')', ':', '___EOS___']", "index": 1679 } ]
[ { "span": "def __contains__(self, (obj_type, name)):", "start_line": 1660, "start_column": 4, "end_line": 1660, "end_column": 45 }, { "span": "def __delitem__(self, (obj_type, name)):", "start_line": 1679, "start_column": 4, "end_line": 1679, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Special", "_", "method_", "has_", "incorrect", "_", "signature_", "[SEP]_", "class_", "Workspace_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "(_", "obj", "\\u", "type_", ",_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "in_", "self_", "._", "\\u", "objects_", "[_", "obj", "\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Workspace_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "(_", "obj", "\\u", "type_", ",_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "\\u", "objects_", "[_", "obj", "\\u", "type_", "]_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "objects_", "[_", "obj", "\\u", "type_", "]_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "parent_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 4, 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 ]
Unused import
anandology/pyjamas/examples/tabpanelwidget/Tabs.py
[ { "content": "import pyjd # dummy in pyjs\n\nfrom pyjamas.ui.TabBar import TabBar\nfrom pyjamas.ui.TabPanel import TabPanel\nfrom pyjamas.ui import HasAlignment\nfrom pyjamas.ui.Image import Image\nfrom pyjamas.ui.VerticalPanel import VerticalPanel\nfrom pyjamas.ui.RootPanel import RootPanel\nfrom pyjamas.ui.HorizontalPanel import HorizontalPanel\nfrom pyjamas.ui.HTML import HTML\nfrom pyjamas.ui.Composite import Composite\n#from pyjamas.ui import DecoratorPanel\nfrom pyjamas.ui import MouseListener\nfrom pyjamas.ui import Event\nfrom pyjamas import Window\nfrom pyjamas.ui.DecoratorPanel import DecoratedTabPanel, DecoratorPanel\nfrom pyjamas.ui.DecoratorPanel import DecoratorTitledPanel\n\n#class PrettyTab(DecoratorPanel):\n\n\nif __name__ == '__main__':\n pyjd.setup(\"./public/Tabs.html\")\n app = Tabs()\n app.onModuleLoad()\n pyjd.run()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PrettyTab(Composite):\n\n", "metadata": "root.PrettyTab", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self, text, imageUrl):\n\n DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)\n\n p = HorizontalPanel()\n p.setSpacing(3)\n self.img = Image(imageUrl)\n self.txt = HTML(text)\n p.add(self.img)\n p.add(self.txt)\n\n self.add(p)", "metadata": "root.PrettyTab.__init__", "header": "['class', 'PrettyTab', '(', 'Composite', ')', ':', '___EOS___']", "index": 21 }, { "content": " def addClickListener(self, listener):\n\n self.img.addClickListener(listener)\n self.txt.addClickListener(listener)", "metadata": "root.PrettyTab.addClickListener", "header": "['class', 'PrettyTab', '(', 'Composite', ')', ':', '___EOS___']", "index": 34 }, { "content": "class Tabs:\n\n\n\n", "metadata": "root.Tabs", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def onModuleLoad(self):\n\n #red = PrettyTab(\"1638\", \"images/user_red.png\")\n #red.setStyleName('gwt-TabBarItem')\n\n #green = PrettyTab(\"1640\", \"images/user_green.png\")\n #red.setStyleName('gwt-TabBarItem')\n red = \"1638\"\n green = \"1640\"\n\n self.fTabs = DecoratedTabPanel(Size=(\"600px\", \"100%\"))\n self.fTabs.add(self.createImage(\"rembrandt/JohannesElison.jpg\"),\n red, True, name=\"johannes\")\n self.fTabs.add(self.createImage(\"rembrandt/SelfPortrait1640.jpg\"),\n green, True, name=\"self\")\n self.fTabs.add(self.createImage(\"rembrandt/LaMarcheNocturne.jpg\"),\n \"1642\", name=\"lamarche\")\n self.fTabs.add(self.createImage(\n \"rembrandt/TheReturnOfTheProdigalSon.jpg\"),\"1662\",\n \"prodigal\")\n self.fTabs.add(HTML(\"shouldn't be here!\"), None) # None means separator\n self.fTabs.add(HTML(\"This is a Test.<br />Tab should be on right\"),\n \"Test\", \"test\")\n self.fTabs.selectTab(0)\n\n dp = DecoratorTitledPanel(\"Tabs\", \"bluetitle\", \"bluetitleicon\",\n [\"bluetop\", \"bluetop2\", \"bluemiddle\", \"bluebottom\"])\n dp.add(self.fTabs)\n RootPanel().add(dp)\n\n self.fTabs.addTabListener(self)", "metadata": "root.Tabs.onModuleLoad", "header": "['class', 'Tabs', ':', '___EOS___']", "index": 41 }, { "content": " def createImage(self, imageUrl):\n image = Image(imageUrl)\n image.setStyleName(\"ks-images-Image\")\n \n p = VerticalPanel()\n p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)\n p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)\n p.add(image)\n\n return p", "metadata": "root.Tabs.createImage", "header": "['class', 'Tabs', ':', '___EOS___']", "index": 73 }, { "content": " def onTabSelected(self, sender, tabIndex):\n pass", "metadata": "root.Tabs.onTabSelected", "header": "['class', 'Tabs', ':', '___EOS___']", "index": 84 }, { "content": " def onBeforeTabSelected(self, sender, tabIndex):\n # 6 because one of them is the separator.\n if self.fTabs.getWidgetCount() == 6:\n self.fTabs.add(HTML(\"2nd Test.<br />Tab should be on right\"),\n \"2nd Test\", name=\"test2\")\n return True\n self.fTabs.remove(\"test2\")\n return tabIndex != 6 # don't allow change to tab 6 - we're removing it!", "metadata": "root.Tabs.onBeforeTabSelected", "header": "['class', 'Tabs', ':', '___EOS___']", "index": 87 } ]
[ { "span": "from pyjamas.ui.TabBar import TabBar", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 }, { "span": "from pyjamas.ui.TabPanel import TabPanel", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 }, { "span": "from pyjamas.ui import MouseListener", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 36 }, { "span": "from pyjamas.ui import Event", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 28 }, { "span": "from pyjamas import Window", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pyj", "d_", "#", " ", "dummy", " ", "in", " ", "pyj", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Tab", "Bar_", "import_", "Tab", "Bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Tab", "Panel_", "import_", "Tab", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "import_", "Has", "Alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Vertica", "l", "Panel_", "import_", "Vertica", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Roo", "t", "Panel_", "import_", "Roo", "t", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Horiz", "onta", "l", "Panel_", "import_", "Horiz", "onta", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "HTML_", "import_", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Composit", "e_", "import_", "Composit", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyj", "ama", "s", ".", "ui", " ", "import", " ", "Decorat", "or", "Panel_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "import_", "Mouse", "Listener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "import_", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "import_", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Decorat", "or", "Panel_", "import_", "Decorat", "ed", "Tab", "Panel_", ",_", "Decorat", "or", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Decorat", "or", "Panel_", "import_", "Decorat", "or", "Tit", "led", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Pret", "ty", "Tab", "(", "Decorat", "or", "Pane", "l", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "pyj", "d_", "._", "setup_", "(_", "\"./", "public", "/", "Tabs", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Tabs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "on", "Modul", "e", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "d_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pret", "ty", "Tab_", "(_", "Composit", "e_", ")_", ":_", "\\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_", "Pret", "ty", "Tab_", "(_", "Composit", "e_", ")_", ":_", "\\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_", ",_", "text_", ",_", "image", "Url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Decorat", "or", "Panel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "Decorat", "or", "Panel_", "._", "DECO", "RAT", "E", "\\u", "ALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Horiz", "onta", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set", "Spacing_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "img_", "=_", "Image_", "(_", "image", "Url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "txt_", "=_", "HTML_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add_", "(_", "self_", "._", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add_", "(_", "self_", "._", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pret", "ty", "Tab_", "(_", "Composit", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Click", "Listener_", "(_", "self_", ",_", "listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "img_", "._", "add", "Click", "Listener_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "txt_", "._", "add", "Click", "Listener_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Tabs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Tabs", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "on", "Modul", "e", "Load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "red", " ", "=", " ", "Pret", "ty", "Tab", "(\"", "1638", "\",", " ", "\"", "images", "/", "user", "\\u", "red", ".", "png", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "red", ".", "set", "Style", "Name", "('", "gw", "t", "-", "Tab", "Bar", "Item", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "green", " ", "=", " ", "Pret", "ty", "Tab", "(\"", "164", "0", "\",", " ", "\"", "images", "/", "user", "\\u", "green", ".", "png", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "red", ".", "set", "Style", "Name", "('", "gw", "t", "-", "Tab", "Bar", "Item", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "red_", "=_", "\"", "1638", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "green_", "=_", "\"", "164", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "=_", "Decorat", "ed", "Tab", "Panel_", "(_", "Size_", "=_", "(_", "\"", "600", "px", "\"_", ",_", "\"", "100", "%\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "self_", "._", "create", "Image_", "(_", "\"", "rem", "brand", "t", "/", "Joh", "anne", "s", "Eli", "son", ".", "jp", "g", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "red_", ",_", "True_", ",_", "name_", "=_", "\"", "jo", "hann", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "self_", "._", "create", "Image_", "(_", "\"", "rem", "brand", "t", "/", "Self", "Port", "rai", "t1", "640", ".", "jp", "g", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "green_", ",_", "True_", ",_", "name_", "=_", "\"", "self", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "self_", "._", "create", "Image_", "(_", "\"", "rem", "brand", "t", "/", "La", "March", "e", "No", "ctu", "rne", ".", "jp", "g", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "164", "2", "\"_", ",_", "name_", "=_", "\"", "lam", "arche", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "self_", "._", "create", "Image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rem", "brand", "t", "/", "The", "Return", "Of", "The", "Prod", "iga", "l", "Son", ".", "jp", "g", "\"_", ")_", ",_", "\"", "166", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prod", "iga", "l", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "HTML_", "(_", "\"", "shou", "ld", "n", "'", "t", " ", "be", " ", "here", "!\"_", ")_", ",_", "None_", ")_", "#", " ", "Non", "e", " ", "means", " ", "separator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "HTML_", "(_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "Test", ".", "<", "br", " ", "/>", "Tab", " ", "shou", "ld", " ", "be", " ", "on", " ", "right", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Test", "\"_", ",_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "select", "Tab_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dp_", "=_", "Decorat", "or", "Tit", "led", "Panel_", "(_", "\"", "Tabs", "\"_", ",_", "\"", "blue", "title", "\"_", ",_", "\"", "blue", "title", "icon", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "blue", "top", "\"_", ",_", "\"", "blue", "top", "2", "\"_", ",_", "\"", "blue", "middle", "\"_", ",_", "\"", "blue", "bottom", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp_", "._", "add_", "(_", "self_", "._", "f", "Tabs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Roo", "t", "Panel_", "(_", ")_", "._", "add_", "(_", "dp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "add", "Tab", "Listener_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tabs", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Image_", "(_", "self_", ",_", "image", "Url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "Image_", "(_", "image", "Url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "set", "Style", "Name_", "(_", "\"", "ks", "-", "images", "-", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Vertica", "l", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set", "Horiz", "onta", "l", "Alignment_", "(_", "Has", "Alignment_", "._", "ALIGN", "\\u", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set", "Vertica", "l", "Alignment_", "(_", "Has", "Alignment_", "._", "ALIGN", "\\u", "MIDDLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tabs", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Tab", "Selected_", "(_", "self_", ",_", "sender_", ",_", "tab", "Index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tabs", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Be", "fore", "Tab", "Selected_", "(_", "self_", ",_", "sender_", ",_", "tab", "Index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "6", " ", "bec", "aus", "e", " ", "one", " ", "of", " ", "them", " ", "is", " ", "the", " ", "separator", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "f", "Tabs", "_", "._", "get", "Wid", "get", "Count_", "(_", ")_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "f", "Tabs", "_", "._", "add_", "(_", "HTML_", "(_", "\"", "2n", "d", " ", "Test", ".", "<", "br", " ", "/>", "Tab", " ", "shou", "ld", " ", "be", " ", "on", " ", "right", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2n", "d", " ", "Test", "\"_", ",_", "name_", "=_", "\"", "test", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "f", "Tabs", "_", "._", "remove_", "(_", "\"", "test", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tab", "Index_", "!=_", "6_", "#", " ", "don", "'", "t", " ", "allow", " ", "change", " ", "to", " ", "tab", " ", "6", " ", "-", " ", "we", "'", "re", " ", "remo", "ving", " ", "it", "!", "_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Signature mismatch in overriding method
mahmoud/clastic/clastic/errors.py
[ { "content": "class ErrorHandler(object):\n wsgi_wrapper = None\n\n # TODO: allow overriding redirects (?)\n\n # 404\n not_found_type = NotFound\n\n # 405\n method_not_allowed_type = MethodNotAllowed\n\n # 500\n exc_info_type = ExceptionInfo\n server_error_type = InternalServerError\n\n\n", "metadata": "root.ErrorHandler", "header": "['module', '___EOS___']", "index": 459 }, { "content": " def __init__(self, **kwargs):\n \"\"\"\\\n Use reraise_uncaught=True if you want uncaught exceptions to be\n handled by the WSGI server rather than by this Clastic error handler.\n \"\"\"\n self.reraise_uncaught = kwargs.get('reraise_uncaught')", "metadata": "root.ErrorHandler.__init__", "header": "['class', 'ErrorHandler', '(', 'object', ')', ':', '___EOS___']", "index": 474 }, { "content": " def render_error(self, request, _error, **kwargs):\n best_match = request.accept_mimetypes.best_match(MIME_SUPPORT_MAP)\n _error.adapt(best_match)\n return _error", "metadata": "root.ErrorHandler.render_error", "header": "['class', 'ErrorHandler', '(', 'object', ')', ':', '___EOS___']", "index": 481 }, { "content": " def uncaught_to_response(self, _application, _route, **kwargs):\n if self.reraise_uncaught:\n raise\n eh = _application.error_handler\n exc_info = eh.exc_info_type.from_current()\n return eh.server_error_type(repr(exc_info),\n exc_info=exc_info,\n source_route=_route)", "metadata": "root.ErrorHandler.uncaught_to_response", "header": "['class', 'ErrorHandler', '(', 'object', ')', ':', '___EOS___']", "index": 486 }, { "content": "class ContextualErrorHandler(ErrorHandler):\n exc_info_type = ContextualExceptionInfo\n server_error_type = ContextualInternalServerError\n\n not_found_type = ContextualNotFound\n\n", "metadata": "root.ContextualErrorHandler", "header": "['module', '___EOS___']", "index": 606 }, { "content": " def __init__(self, *a, **kw):\n self.hide_internal_frames = kw.pop('hide_internal_frames', True)\n super(ContextualErrorHandler, self).__init__(*a, **kw)", "metadata": "root.ContextualErrorHandler.__init__", "header": "['class', 'ContextualErrorHandler', '(', 'ErrorHandler', ')', ':', '___EOS___']", "index": 612 }, { "content": " def uncaught_to_response(self, _application, _route, **kwargs):\n eh = _application.error_handler\n exc_info = eh.exc_info_type.from_current()\n SEType = eh.server_error_type\n return SEType(repr(exc_info),\n exc_info=exc_info,\n source_route=_route,\n request=kwargs.get('request'),\n hide_internal_frames=self.hide_internal_frames)", "metadata": "root.ContextualErrorHandler.uncaught_to_response", "header": "['class', 'ContextualErrorHandler', '(', 'ErrorHandler', ')', ':', '___EOS___']", "index": 616 }, { "content": "class REPLErrorHandler(ContextualErrorHandler):\n wsgi_wrapper = _REPLDebuggedApplication\n", "metadata": "root.REPLErrorHandler", "header": "['module', '___EOS___']", "index": 633 }, { "content": " def uncaught_to_response(self, **kwargs):\n print 'lolololol'\n raise", "metadata": "root.REPLErrorHandler.uncaught_to_response", "header": "['class', 'REPLErrorHandler', '(', 'ContextualErrorHandler', ')', ':', '___EOS___']", "index": 636 } ]
[ { "span": "def uncaught_to_response(self, **kwargs):", "start_line": 636, "start_column": 4, "end_line": 636, "end_column": 45 } ]
[ { "span": "def uncaught_to_response(self, _application, _route, **kwargs):", "start_line": 486, "start_column": 4, "end_line": 486, "end_column": 67 }, { "span": "def uncaught_to_response(self, _application, _route, **kwargs):", "start_line": 616, "start_column": 4, "end_line": 616, "end_column": 67 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Error", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wsgi", "\\u", "wrapper_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "allow", " ", "overrid", "ing", " ", "redirec", "ts", " ", "(?", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "404_", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "found", "\\u", "type_", "=_", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "405_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "not", "\\u", "allow", "ed", "\\u", "type_", "=_", "Meth", "od", "Not", "Allowed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "500_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "info", "\\u", "type_", "=_", "Except", "ion", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "error", "\\u", "type_", "=_", "Intern", "al", "Server", "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_", "[SEP]_", "class_", "Error", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "reraise", "\\u", "unca", "ugh", "t", "=", "Tru", "e", " ", "if", " ", "you", " ", "want", " ", "unca", "ugh", "t", " ", "exception", "s", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "handle", "d", " ", "by", " ", "the", " ", "WS", "GI", " ", "server", " ", "rat", "her", " ", "than", " ", "by", " ", "this", " ", "Cla", "stic", " ", "error", " ", "handler", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reraise", "\\u", "unca", "ugh", "t_", "=_", "kwargs_", "._", "get_", "(_", "'", "reraise", "\\u", "unca", "ugh", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "error_", "(_", "self_", ",_", "request_", ",_", "\\u", "error_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "match_", "=_", "request_", "._", "accept", "\\u", "mimetypes_", "._", "best", "\\u", "match_", "(_", "MIME", "\\u", "SUPPORT", "\\u", "MAP_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "error_", "._", "adapt", "_", "(_", "best", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unca", "ugh", "t", "\\u", "to", "\\u", "response_", "(_", "self_", ",_", "\\u", "application_", ",_", "\\u", "route_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "reraise", "\\u", "unca", "ugh", "t_", ":_", "\\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_", "eh", "_", "=_", "\\u", "application_", "._", "error", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "info_", "=_", "eh", "_", "._", "exc", "\\u", "info", "\\u", "type_", "._", "from", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "eh", "_", "._", "server", "\\u", "error", "\\u", "type_", "(_", "repr_", "(_", "exc", "\\u", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "info_", "=_", "exc", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "route_", "=_", "\\u", "route_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Context", "ual", "Error", "Handler_", "(_", "Error", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info", "\\u", "type_", "=_", "Context", "ual", "Except", "ion", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "error", "\\u", "type_", "=_", "Context", "ual", "Intern", "al", "Server", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "found", "\\u", "type_", "=_", "Context", "ual", "Not", "Found_", "\\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_", "Context", "ual", "Error", "Handler_", "(_", "Error", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hide", "\\u", "internal", "\\u", "frames_", "=_", "kw_", "._", "pop_", "(_", "'", "hide", "\\u", "internal", "\\u", "frames", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Context", "ual", "Error", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "a_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Context", "ual", "Error", "Handler_", "(_", "Error", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unca", "ugh", "t", "\\u", "to", "\\u", "response_", "(_", "self_", ",_", "\\u", "application_", ",_", "\\u", "route_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eh", "_", "=_", "\\u", "application_", "._", "error", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "info_", "=_", "eh", "_", "._", "exc", "\\u", "info", "\\u", "type_", "._", "from", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SET", "ype_", "=_", "eh", "_", "._", "server", "\\u", "error", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "SET", "ype_", "(_", "repr_", "(_", "exc", "\\u", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "info_", "=_", "exc", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "route_", "=_", "\\u", "route_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "kwargs_", "._", "get_", "(_", "'", "request", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hide", "\\u", "internal", "\\u", "frames_", "=_", "self_", "._", "hide", "\\u", "internal", "\\u", "frames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "REP", "LE", "rror", "Handler_", "(_", "Context", "ual", "Error", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wsgi", "\\u", "wrapper_", "=_", "\\u", "REP", "LD", "ebu", "gged", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "REP", "LE", "rror", "Handler_", "(_", "Context", "ual", "Error", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unca", "ugh", "t", "\\u", "to", "\\u", "response_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "lol", "olo", "lol", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
fredrik-johansson/mpmath/mpmath/visualization.py
[ { "content": "def default_color_function(ctx, z):\n if ctx.isinf(z):\n return (1.0, 1.0, 1.0)\n if ctx.isnan(z):\n return (0.5, 0.5, 0.5)\n pi = 3.1415926535898\n a = (float(ctx.arg(z)) + ctx.pi) / (2*ctx.pi)\n a = (a + 0.5) % 1.0\n b = 1.0 - float(1/(1.0+abs(z)**0.3))\n return hls_to_rgb(a, b, 0.8)", "metadata": "root.default_color_function", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def splot(ctx, f, u=[-5,5], v=[-5,5], points=100, keep_aspect=True, \\\n wireframe=False, file=None, dpi=None, axes=None):\n \"\"\"\n Plots the surface defined by `f`.\n\n If `f` returns a single component, then this plots the surface\n defined by `z = f(x,y)` over the rectangular domain with\n `x = u` and `y = v`.\n\n If `f` returns three components, then this plots the parametric\n surface `x, y, z = f(u,v)` over the pairs of intervals `u` and `v`.\n\n For example, to plot a simple function::\n\n >>> from mpmath import *\n >>> f = lambda x, y: sin(x+y)*cos(y)\n >>> splot(f, [-pi,pi], [-pi,pi]) # doctest: +SKIP\n\n Plotting a donut::\n\n >>> r, R = 1, 2.5\n >>> f = lambda u, v: [r*cos(u), (R+r*sin(u))*cos(v), (R+r*sin(u))*sin(v)]\n >>> splot(f, [0, 2*pi], [0, 2*pi]) # doctest: +SKIP\n\n .. note :: This function requires matplotlib (pylab) 0.98.5.3 or higher.\n \"\"\"\n import pylab\n import mpl_toolkits.mplot3d as mplot3d\n if file:\n axes = None\n fig = None\n if not axes:\n fig = pylab.figure()\n axes = mplot3d.axes3d.Axes3D(fig)\n ua, ub = u\n va, vb = v\n du = ub - ua\n dv = vb - va\n if not isinstance(points, (list, tuple)):\n points = [points, points]\n M, N = points\n u = pylab.linspace(ua, ub, M)\n v = pylab.linspace(va, vb, N)\n x, y, z = [pylab.zeros((M, N)) for i in xrange(3)]\n xab, yab, zab = [[0, 0] for i in xrange(3)]\n for n in xrange(N):\n for m in xrange(M):\n fdata = f(ctx.convert(u[m]), ctx.convert(v[n]))\n try:\n x[m,n], y[m,n], z[m,n] = fdata\n except TypeError:\n x[m,n], y[m,n], z[m,n] = u[m], v[n], fdata\n for c, cab in [(x[m,n], xab), (y[m,n], yab), (z[m,n], zab)]:\n if c < cab[0]:\n cab[0] = c\n if c > cab[1]:\n cab[1] = c\n if wireframe:\n axes.plot_wireframe(x, y, z, rstride=4, cstride=4)\n else:\n axes.plot_surface(x, y, z, rstride=4, cstride=4)\n axes.set_xlabel('x')\n axes.set_ylabel('y')\n axes.set_zlabel('z')\n if keep_aspect:\n dx, dy, dz = [cab[1] - cab[0] for cab in [xab, yab, zab]]\n maxd = max(dx, dy, dz)\n if dx < maxd:\n delta = maxd - dx\n axes.set_xlim3d(xab[0] - delta / 2.0, xab[1] + delta / 2.0)\n if dy < maxd:\n delta = maxd - dy\n axes.set_ylim3d(yab[0] - delta / 2.0, yab[1] + delta / 2.0)\n if dz < maxd:\n delta = maxd - dz\n axes.set_zlim3d(zab[0] - delta / 2.0, zab[1] + delta / 2.0)\n if fig:\n if file:\n pylab.savefig(file, dpi=dpi)\n else:\n pylab.show()", "metadata": "root.splot", "header": "['module', '___EOS___']", "index": 225 } ]
[ { "span": "pi ", "start_line": 115, "start_column": 4, "end_line": 115, "end_column": 6 }, { "span": "du ", "start_line": 261, "start_column": 4, "end_line": 261, "end_column": 6 }, { "span": "dv ", "start_line": 262, "start_column": 4, "end_line": 262, "end_column": 6 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "default", "\\u", "color", "\\u", "function_", "(_", "ctx_", ",_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ctx_", "._", "isinf", "_", "(_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "1.0_", ",_", "1.0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ctx_", "._", "isnan_", "(_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "0.5_", ",_", "0.5_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pi_", "=_", "3.14", "159", "265", "358", "98_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "(_", "float_", "(_", "ctx_", "._", "arg_", "(_", "z_", ")_", ")_", "+_", "ctx_", "._", "pi_", ")_", "/_", "(_", "2_", "*_", "ctx_", "._", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "(_", "a_", "+_", "0.5_", ")_", "%_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "1.0_", "-_", "float_", "(_", "1_", "/_", "(_", "1.0_", "+_", "abs_", "(_", "z_", ")_", "**_", "0.3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "hls", "\\u", "to", "\\u", "rgb_", "(_", "a_", ",_", "b_", ",_", "0.8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "spl", "ot_", "(_", "ctx_", ",_", "f_", ",_", "u_", "=_", "[_", "-_", "5_", ",_", "5_", "]_", ",_", "v_", "=_", "[_", "-_", "5_", ",_", "5_", "]_", ",_", "points_", "=_", "100_", ",_", "keep", "\\u", "aspect_", "=_", "True_", ",_", "wire", "frame_", "=_", "False_", ",_", "file_", "=_", "None_", ",_", "dpi_", "=_", "None_", ",_", "axes_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Plot", "s", " ", "the", " ", "surf", "ace", " ", "defin", "ed", " ", "by", " ", "`", "f", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "f", "`", " ", "return", "s", " ", "a", " ", "single", " ", "component", ",", " ", "then", " ", "this", " ", "plots", " ", "the", " ", "surf", "ace", "\\", "10", ";", " ", " ", " ", " ", "defin", "ed", " ", "by", " ", "`", "z", " ", "=", " ", "f", "(", "x", ",", "y", ")`", " ", "over", " ", "the", " ", "rectangular", " ", "domain", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "`", "x", " ", "=", " ", "u", "`", " ", "and", " ", "`", "y", " ", "=", " ", "v", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "f", "`", " ", "return", "s", " ", "three", " ", "component", "s", ",", " ", "then", " ", "this", " ", "plots", " ", "the", " ", "parametr", "ic", "\\", "10", ";", " ", " ", " ", " ", "surf", "ace", " ", "`", "x", ",", " ", "y", ",", " ", "z", " ", "=", " ", "f", "(", "u", ",", "v", ")`", " ", "over", " ", "the", " ", "pair", "s", " ", "of", " ", "interval", "s", " ", "`", "u", "`", " ", "and", " ", "`", "v", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "to", " ", "plot", " ", "a", " ", "simple", " ", "function", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "*", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "lambda", " ", "x", ",", " ", "y", ":", " ", "sin", "(", "x", "+", "y", ")*", "cos", "(", "y", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "spl", "ot", "(", "f", ",", " ", "[-", "pi", ",", "pi", "],", " ", "[-", "pi", ",", "pi", "])", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Plott", "ing", " ", "a", " ", "don", "ut", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ",", " ", "R", " ", "=", " ", "1", ",", " ", "2.5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "lambda", " ", "u", ",", " ", "v", ":", " ", "[", "r", "*", "cos", "(", "u", "),", " ", "(", "R", "+", "r", "*", "sin", "(", "u", "))", "*", "cos", "(", "v", "),", " ", "(", "R", "+", "r", "*", "sin", "(", "u", "))", "*", "sin", "(", "v", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "spl", "ot", "(", "f", ",", " ", "[", "0", ",", " ", "2", "*", "pi", "],", " ", "[", "0", ",", " ", "2", "*", "pi", "])", " ", " ", " ", " ", "#", " ", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", " ", "::", " ", "Thi", "s", " ", "function", " ", "require", "s", " ", "mat", "plotlib", " ", "(", "pyla", "b", ")", " ", "0.98", ".5", ".3", " ", "or", " ", "higher", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mpl", "\\u", "toolkits_", "._", "mplo", "t3", "d_", "as_", "mplo", "t3", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "axes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "pylab_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "mplo", "t3", "d_", "._", "axes", "3d_", "._", "Axe", "s3", "D_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ua_", ",_", "ub_", "=_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "va_", ",_", "vb_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "du_", "=_", "ub_", "-_", "ua_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dv_", "=_", "vb_", "-_", "va_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "points_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points_", "=_", "[_", "points_", ",_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M_", ",_", "N_", "=_", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "pylab_", "._", "linspace_", "(_", "ua_", ",_", "ub_", ",_", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "pylab_", "._", "linspace_", "(_", "va_", ",_", "vb_", ",_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", ",_", "z_", "=_", "[_", "pylab_", "._", "zeros_", "(_", "(_", "M_", ",_", "N_", ")_", ")_", "for_", "i_", "in_", "xrange_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xa", "b_", ",_", "yab", "_", ",_", "zab", "_", "=_", "[_", "[_", "0_", ",_", "0_", "]_", "for_", "i_", "in_", "xrange_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "xrange_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "m_", "in_", "xrange_", "(_", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fdata", "_", "=_", "f_", "(_", "ctx_", "._", "convert_", "(_", "u_", "[_", "m_", "]_", ")_", ",_", "ctx_", "._", "convert_", "(_", "v_", "[_", "n_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "[_", "m_", ",_", "n_", "]_", ",_", "y_", "[_", "m_", ",_", "n_", "]_", ",_", "z_", "[_", "m_", ",_", "n_", "]_", "=_", "fdata", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "[_", "m_", ",_", "n_", "]_", ",_", "y_", "[_", "m_", ",_", "n_", "]_", ",_", "z_", "[_", "m_", ",_", "n_", "]_", "=_", "u_", "[_", "m_", "]_", ",_", "v_", "[_", "n_", "]_", ",_", "fdata", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c_", ",_", "cab", "_", "in_", "[_", "(_", "x_", "[_", "m_", ",_", "n_", "]_", ",_", "xa", "b_", ")_", ",_", "(_", "y_", "[_", "m_", ",_", "n_", "]_", ",_", "yab", "_", ")_", ",_", "(_", "z_", "[_", "m_", ",_", "n_", "]_", ",_", "zab", "_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "<_", "cab", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cab", "_", "[_", "0_", "]_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", ">_", "cab", "_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cab", "_", "[_", "1_", "]_", "=_", "c_", "\\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_", "if_", "wire", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "._", "plot", "\\u", "wire", "frame_", "(_", "x_", ",_", "y_", ",_", "z_", ",_", "rstr", "ide_", "=_", "4_", ",_", "cstr", "ide_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "._", "plot", "\\u", "surface_", "(_", "x_", ",_", "y_", ",_", "z_", ",_", "rstr", "ide_", "=_", "4_", ",_", "cstr", "ide_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "axes_", "._", "set\\u", "xlabel_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "._", "set\\u", "ylabel_", "(_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "._", "set\\u", "zl", "abel_", "(_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keep", "\\u", "aspect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", ",_", "dy_", ",_", "dz_", "=_", "[_", "cab", "_", "[_", "1_", "]_", "-_", "cab", "_", "[_", "0_", "]_", "for_", "cab", "_", "in_", "[_", "xa", "b_", ",_", "yab", "_", ",_", "zab", "_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxd", "_", "=_", "max_", "(_", "dx_", ",_", "dy_", ",_", "dz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dx_", "<_", "maxd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta_", "=_", "maxd", "_", "-_", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "._", "set\\u", "xlim", "3d_", "(_", "xa", "b_", "[_", "0_", "]_", "-_", "delta_", "/_", "2.0_", ",_", "xa", "b_", "[_", "1_", "]_", "+_", "delta_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dy_", "<_", "maxd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta_", "=_", "maxd", "_", "-_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "._", "set\\u", "ylim", "3d_", "(_", "yab", "_", "[_", "0_", "]_", "-_", "delta_", "/_", "2.0_", ",_", "yab", "_", "[_", "1_", "]_", "+_", "delta_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dz_", "<_", "maxd", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta_", "=_", "maxd", "_", "-_", "dz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "._", "set\\u", "zli", "m3", "d_", "(_", "zab", "_", "[_", "0_", "]_", "-_", "delta_", "/_", "2.0_", ",_", "zab", "_", "[_", "1_", "]_", "+_", "delta_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fig_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylab_", "._", "savefig_", "(_", "file_", ",_", "dpi_", "=_", "dpi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylab_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Suspicious unused loop iteration variable
azoft-dev-team/imagrium/env/Lib/test/test_class.py
[ { "content": "\"Test the functionality of Python classes implementing operators.\"\n\nimport unittest\n\nfrom test import test_support\n\ntestmeths = [\n\n# Binary operations\n \"add\",\n \"radd\",\n \"sub\",\n \"rsub\",\n \"mul\",\n \"rmul\",\n \"div\",\n \"rdiv\",\n \"mod\",\n \"rmod\",\n \"divmod\",\n \"rdivmod\",\n \"pow\",\n \"rpow\",\n \"rshift\",\n \"rrshift\",\n \"lshift\",\n \"rlshift\",\n \"and\",\n \"rand\",\n \"or\",\n \"ror\",\n \"xor\",\n \"rxor\",\n\n# List/dict operations\n \"contains\",\n \"getitem\",\n \"getslice\",\n \"setitem\",\n \"setslice\",\n \"delitem\",\n \"delslice\",\n\n# Unary operations\n \"neg\",\n \"pos\",\n \"abs\",\n\n# generic operations\n \"init\",\n ]\n\n# These need to return something other than None\n# \"coerce\",\n# \"hash\",\n# \"str\",\n# \"repr\",\n# \"int\",\n# \"long\",\n# \"float\",\n# \"oct\",\n# \"hex\",\n\n# These are separate because they can influence the test of other methods.\n# \"getattr\",\n# \"setattr\",\n# \"delattr\",\n\ncallLst = []\n\n\n# Synthesize all the other AllTests methods from the names in testmeths.\n\nmethod_template = \"\"\"\\\n@trackCall\ndef __%(method)s__(self, *args):\n pass\n\"\"\"\n\nfor method in testmeths:\n exec method_template % locals() in AllTests.__dict__\n\ndel method, method_template\n\n\n\nif __name__=='__main__':\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "for method in testmeths:", "start_line": 126, "start_column": 0, "end_line": 126, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"", "Test", " ", "the", " ", "functional", "it", "y", " ", "of", " ", "Pyth", "on", " ", "classe", "s", " ", "implement", "ing", " ", "opera", "tors", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test_", "import_", "test\\u", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "testm", "eth", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bin", "ary", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rad", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sub", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rsu", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mul", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rm", "ul", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "div", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rdi", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mod", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rmo", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "div", "mod", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rdi", "vmo", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pow", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rpo", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rshi", "ft", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rr", "shift", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lsh", "ift", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rls", "hift", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rand", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "or", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ror", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rx", "or", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", "/", "dict", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "contain", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "getitem", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gets", "lice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "setitem", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sets", "lice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "deli", "tem", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dels", "lice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Una", "ry", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "neg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pos", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gener", "ic", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "init", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "need", " ", "to", " ", "return", " ", "somet", "hing", " ", "other", " ", "than", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "coerce", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "hash", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "str", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "repr", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "int", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "long", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "float", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "oct", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "hex", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "separate", " ", "bec", "aus", "e", " ", "the", "y", " ", "can", " ", "influence", " ", "the", " ", "test", " ", "of", " ", "other", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "getattr", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "setattr", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "delattr", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "call", "Lst_", "=_", "[_", "]_", "\\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_", "#", " ", "Synthe", "size", " ", "all", " ", "the", " ", "other", " ", "All", "Test", "s", " ", "method", "s", " ", "from", " ", "the", " ", "names", " ", "in", " ", "testm", "eth", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "method", "\\u", "template_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "@", "track", "Call", "\\", "10", ";", "def", " ", "\\u\\u", "%", "(", "method", ")", "s", "\\u\\u", "(", "self", ",", " ", "*", "args", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "method_", "in_", "testm", "eth", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "method", "\\u", "template_", "%_", "locals_", "(_", ")_", "in_", "All", "Tests_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "method_", ",_", "method", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 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 ]
Unused import
numba/numba/numba/tests/test_dispatcher.py
[ { "content": "from __future__ import print_function, division, absolute_import\n\nimport errno\nimport imp\nimport os\nimport shutil\nimport stat\nimport subprocess\nimport sys\nimport tempfile\nimport threading\nimport warnings\n\nimport numpy as np\n\nfrom numba import unittest_support as unittest\nfrom numba import utils, vectorize, jit, generated_jit, types, appdirs\nfrom numba.errors import NumbaWarning\nfrom .support import TestCase, tag, temp_directory, import_dynamic\n\n\n\n\n\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 unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def dummy(x):\n return x", "metadata": "root.dummy", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def add(x, y):\n return x + y", "metadata": "root.add", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def addsub(x, y, z):\n return x - y + z", "metadata": "root.addsub", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def addsub_defaults(x, y=2, z=3):\n return x - y + z", "metadata": "root.addsub_defaults", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def star_defaults(x, y=2, *z):\n return x, y, z", "metadata": "root.star_defaults", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def generated_usecase(x, y=5):\n if isinstance(x, types.Complex):\n def impl(x, y):\n return x + y\n else:\n def impl(x, y):\n return x - y\n return impl", "metadata": "root.generated_usecase", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def bad_generated_usecase(x, y=5):\n if isinstance(x, types.Complex):\n def impl(x):\n return x\n else:\n def impl(x, y=6):\n return x - y\n return impl", "metadata": "root.bad_generated_usecase", "header": "['module', '___EOS___']", "index": 50 }, { "content": "class BaseTest(TestCase):\n\n jit_args = dict(nopython=True)\n", "metadata": "root.BaseTest", "header": "['module', '___EOS___']", "index": 60 }, { "content": " def compile_func(self, pyfunc):\n def check(*args, **kwargs):\n expected = pyfunc(*args, **kwargs)\n result = f(*args, **kwargs)\n self.assertPreciseEqual(result, expected)\n f = jit(**self.jit_args)(pyfunc)\n return f, check", "metadata": "root.BaseTest.compile_func", "header": "['class', 'BaseTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": "class TestDispatcher(BaseTest):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestDispatcher", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def test_no_argument(self):\n @jit\n def foo():\n return 1\n\n # Just make sure this doesn't crash\n foo()", "metadata": "root.TestDispatcher.test_no_argument", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_coerce_input_types(self):\n # Issue #486: do not allow unsafe conversions if we can still\n # compile other specializations.\n c_add = jit(nopython=True)(add)\n self.assertPreciseEqual(c_add(123, 456), add(123, 456))\n self.assertPreciseEqual(c_add(12.3, 45.6), add(12.3, 45.6))\n self.assertPreciseEqual(c_add(12.3, 45.6j), add(12.3, 45.6j))\n self.assertPreciseEqual(c_add(12300000000, 456), add(12300000000, 456))\n\n # Now force compilation of only a single specialization\n c_add = jit('(i4, i4)', nopython=True)(add)\n self.assertPreciseEqual(c_add(123, 456), add(123, 456))\n # Implicit (unsafe) conversion of float to int\n self.assertPreciseEqual(c_add(12.3, 45.6), add(12, 45))\n with self.assertRaises(TypeError):\n # Implicit conversion of complex to int disallowed\n c_add(12.3, 45.6j)", "metadata": "root.TestDispatcher.test_coerce_input_types", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 83 }, { "content": " def test_ambiguous_new_version(self):\n \"\"\"Test compiling new version in an ambiguous case\n \"\"\"\n @jit\n def foo(a, b):\n return a + b\n\n INT = 1\n FLT = 1.5\n self.assertAlmostEqual(foo(INT, FLT), INT + FLT)\n self.assertEqual(len(foo.overloads), 1)\n self.assertAlmostEqual(foo(FLT, INT), FLT + INT)\n self.assertEqual(len(foo.overloads), 2)\n self.assertAlmostEqual(foo(FLT, FLT), FLT + FLT)\n self.assertEqual(len(foo.overloads), 3)\n # The following call is ambiguous because (int, int) can resolve\n # to (float, int) or (int, float) with equal weight.\n self.assertAlmostEqual(foo(1, 1), INT + INT)\n self.assertEqual(len(foo.overloads), 4, \"didn't compile a new \"\n \"version\")", "metadata": "root.TestDispatcher.test_ambiguous_new_version", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 101 }, { "content": " def test_lock(self):\n \"\"\"\n Test that (lazy) compiling from several threads at once doesn't\n produce errors (see issue #908).\n \"\"\"\n errors = []\n\n @jit\n def foo(x):\n return x + 1\n\n def wrapper():\n try:\n self.assertEqual(foo(1), 2)\n except BaseException as e:\n errors.append(e)\n\n threads = [threading.Thread(target=wrapper) for i in range(16)]\n for t in threads:\n t.start()\n for t in threads:\n t.join()\n self.assertFalse(errors)", "metadata": "root.TestDispatcher.test_lock", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 122 }, { "content": " def test_explicit_signatures(self):\n f = jit(\"(int64,int64)\")(add)\n # Approximate match (unsafe conversion)\n self.assertPreciseEqual(f(1.5, 2.5), 3)\n self.assertEqual(len(f.overloads), 1, f.overloads)\n f = jit([\"(int64,int64)\", \"(float64,float64)\"])(add)\n # Exact signature matches\n self.assertPreciseEqual(f(1, 2), 3)\n self.assertPreciseEqual(f(1.5, 2.5), 4.0)\n # Approximate match (int32 -> float64 is a safe conversion)\n self.assertPreciseEqual(f(np.int32(1), 2.5), 3.5)\n # No conversion\n with self.assertRaises(TypeError) as cm:\n f(1j, 1j)\n self.assertIn(\"No matching definition\", str(cm.exception))\n self.assertEqual(len(f.overloads), 2, f.overloads)\n # A more interesting one...\n f = jit([\"(float32,float32)\", \"(float64,float64)\"])(add)\n self.assertPreciseEqual(f(np.float32(1), np.float32(2**-25)), 1.0)\n self.assertPreciseEqual(f(1, 2**-25), 1.0000000298023224)\n # Fail to resolve ambiguity between the two best overloads\n f = jit([\"(float32,float64)\",\n \"(float64,float32)\",\n \"(int64,int64)\"])(add)\n with self.assertRaises(TypeError) as cm:\n f(1.0, 2.0)\n # The two best matches are output in the error message, as well\n # as the actual argument types.\n self.assertRegexpMatches(\n str(cm.exception),\n r\"Ambiguous overloading for <function add [^>]*> \\(float64, float64\\):\\n\"\n r\"\\(float32, float64\\) -> float64\\n\"\n r\"\\(float64, float32\\) -> float64\"\n )\n # The integer signature is not part of the best matches\n self.assertNotIn(\"int64\", str(cm.exception))", "metadata": "root.TestDispatcher.test_explicit_signatures", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 146 }, { "content": " def test_signature_mismatch(self):\n tmpl = \"Signature mismatch: %d argument types given, but function takes 2 arguments\"\n with self.assertRaises(TypeError) as cm:\n jit(\"()\")(add)\n self.assertIn(tmpl % 0, str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n jit(\"(intc,)\")(add)\n self.assertIn(tmpl % 1, str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n jit(\"(intc,intc,intc)\")(add)\n self.assertIn(tmpl % 3, str(cm.exception))\n # With forceobj=True, an empty tuple is accepted\n jit(\"()\", forceobj=True)(add)\n with self.assertRaises(TypeError) as cm:\n jit(\"(intc,)\", forceobj=True)(add)\n self.assertIn(tmpl % 1, str(cm.exception))", "metadata": "root.TestDispatcher.test_signature_mismatch", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 183 }, { "content": " def test_matching_error_message(self):\n f = jit(\"(intc,intc)\")(add)\n with self.assertRaises(TypeError) as cm:\n f(1j, 1j)\n self.assertEqual(str(cm.exception),\n \"No matching definition for argument type(s) \"\n \"complex128, complex128\")", "metadata": "root.TestDispatcher.test_matching_error_message", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 200 }, { "content": " def test_disabled_compilation(self):\n @jit\n def foo(a):\n return a\n\n foo.compile(\"(float32,)\")\n foo.disable_compile()\n with self.assertRaises(RuntimeError) as raises:\n foo.compile(\"(int32,)\")\n self.assertEqual(str(raises.exception), \"compilation disabled\")\n self.assertEqual(len(foo.signatures), 1)", "metadata": "root.TestDispatcher.test_disabled_compilation", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 208 }, { "content": " def test_disabled_compilation_through_list(self):\n @jit([\"(float32,)\", \"(int32,)\"])\n def foo(a):\n return a\n\n with self.assertRaises(RuntimeError) as raises:\n foo.compile(\"(complex64,)\")\n self.assertEqual(str(raises.exception), \"compilation disabled\")\n self.assertEqual(len(foo.signatures), 2)", "metadata": "root.TestDispatcher.test_disabled_compilation_through_list", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_disabled_compilation_nested_call(self):\n @jit([\"(intp,)\"])\n def foo(a):\n return a\n\n @jit\n def bar():\n foo(1)\n foo(np.ones(1)) # no matching definition\n\n with self.assertRaises(TypeError) as raises:\n bar()\n m = \"No matching definition for argument type(s) array(float64, 1d, C)\"\n self.assertEqual(str(raises.exception), m)", "metadata": "root.TestDispatcher.test_disabled_compilation_nested_call", "header": "['class', 'TestDispatcher', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 230 }, { "content": "class TestSignatureHandling(BaseTest):\n \"\"\"\n Test support for various parameter passing styles.\n \"\"\"\n\n\n", "metadata": "root.TestSignatureHandling", "header": "['module', '___EOS___']", "index": 246 }, { "content": " @tag('important')\n def test_named_args(self):\n \"\"\"\n Test passing named arguments to a dispatcher.\n \"\"\"\n f, check = self.compile_func(addsub)\n check(3, z=10, y=4)\n check(3, 4, 10)\n check(x=3, y=4, z=10)\n # All calls above fall under the same specialization\n self.assertEqual(len(f.overloads), 1)\n # Errors\n with self.assertRaises(TypeError) as cm:\n f(3, 4, y=6, z=7)\n self.assertIn(\"too many arguments: expected 3, got 4\",\n str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f()\n self.assertIn(\"not enough arguments: expected 3, got 0\",\n str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f(3, 4, y=6)\n self.assertIn(\"missing argument 'z'\", str(cm.exception))", "metadata": "root.TestSignatureHandling.test_named_args", "header": "['class', 'TestSignatureHandling', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 251 }, { "content": " def test_default_args(self):\n \"\"\"\n Test omitting arguments with a default value.\n \"\"\"\n f, check = self.compile_func(addsub_defaults)\n check(3, z=10, y=4)\n check(3, 4, 10)\n check(x=3, y=4, z=10)\n # Now omitting some values\n check(3, z=10)\n check(3, 4)\n check(x=3, y=4)\n check(3)\n check(x=3)\n # Errors\n with self.assertRaises(TypeError) as cm:\n f(3, 4, y=6, z=7)\n self.assertIn(\"too many arguments: expected 3, got 4\",\n str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f()\n self.assertIn(\"not enough arguments: expected at least 1, got 0\",\n str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f(y=6, z=7)\n self.assertIn(\"missing argument 'x'\", str(cm.exception))", "metadata": "root.TestSignatureHandling.test_default_args", "header": "['class', 'TestSignatureHandling', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 275 }, { "content": " def test_star_args(self):\n \"\"\"\n Test a compiled function with starargs in the signature.\n \"\"\"\n f, check = self.compile_func(star_defaults)\n check(4)\n check(4, 5)\n check(4, 5, 6)\n check(4, 5, 6, 7)\n check(4, 5, 6, 7, 8)\n check(x=4)\n check(x=4, y=5)\n check(4, y=5)\n with self.assertRaises(TypeError) as cm:\n f(4, 5, y=6)\n self.assertIn(\"some keyword arguments unexpected\", str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f(4, 5, z=6)\n self.assertIn(\"some keyword arguments unexpected\", str(cm.exception))\n with self.assertRaises(TypeError) as cm:\n f(4, x=6)\n self.assertIn(\"some keyword arguments unexpected\", str(cm.exception))", "metadata": "root.TestSignatureHandling.test_star_args", "header": "['class', 'TestSignatureHandling', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 302 }, { "content": "class TestSignatureHandlingObjectMode(TestSignatureHandling):\n \"\"\"\n Sams as TestSignatureHandling, but in object mode.\n \"\"\"\n\n jit_args = dict(forceobj=True)", "metadata": "root.TestSignatureHandlingObjectMode", "header": "['module', '___EOS___']", "index": 326 }, { "content": "class TestGeneratedDispatcher(TestCase):\n \"\"\"\n Tests for @generated_jit.\n \"\"\"\n\n", "metadata": "root.TestGeneratedDispatcher", "header": "['module', '___EOS___']", "index": 334 }, { "content": " @tag('important')\n def test_generated(self):\n f = generated_jit(nopython=True)(generated_usecase)\n self.assertEqual(f(8), 8 - 5)\n self.assertEqual(f(x=8), 8 - 5)\n self.assertEqual(f(x=8, y=4), 8 - 4)\n self.assertEqual(f(1j), 5 + 1j)\n self.assertEqual(f(1j, 42), 42 + 1j)\n self.assertEqual(f(x=1j, y=7), 7 + 1j)", "metadata": "root.TestGeneratedDispatcher.test_generated", "header": "['class', 'TestGeneratedDispatcher', '(', 'TestCase', ')', ':', '___EOS___']", "index": 339 }, { "content": " def test_signature_errors(self):\n \"\"\"\n Check error reporting when implementation signature doesn't match\n generating function signature.\n \"\"\"\n f = generated_jit(nopython=True)(bad_generated_usecase)\n # Mismatching # of arguments\n with self.assertRaises(TypeError) as raises:\n f(1j)\n self.assertIn(\"should be compatible with signature '(x, y=5)', but has signature '(x)'\",\n str(raises.exception))\n # Mismatching defaults\n with self.assertRaises(TypeError) as raises:\n f(1)\n self.assertIn(\"should be compatible with signature '(x, y=5)', but has signature '(x, y=6)'\",\n str(raises.exception))", "metadata": "root.TestGeneratedDispatcher.test_signature_errors", "header": "['class', 'TestGeneratedDispatcher', '(', 'TestCase', ')', ':', '___EOS___']", "index": 349 }, { "content": "class TestDispatcherMethods(TestCase):\n\n\n\n\n\n", "metadata": "root.TestDispatcherMethods", "header": "['module', '___EOS___']", "index": 367 }, { "content": " def test_recompile(self):\n closure = 1\n\n @jit\n def foo(x):\n return x + closure\n self.assertPreciseEqual(foo(1), 2)\n self.assertPreciseEqual(foo(1.5), 2.5)\n self.assertEqual(len(foo.signatures), 2)\n closure = 2\n self.assertPreciseEqual(foo(1), 2)\n # Recompiling takes the new closure into account.\n foo.recompile()\n # Everything was recompiled\n self.assertEqual(len(foo.signatures), 2)\n self.assertPreciseEqual(foo(1), 3)\n self.assertPreciseEqual(foo(1.5), 3.5)", "metadata": "root.TestDispatcherMethods.test_recompile", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 369 }, { "content": " def test_recompile_signatures(self):\n # Same as above, but with an explicit signature on @jit.\n closure = 1\n\n @jit(\"int32(int32)\")\n def foo(x):\n return x + closure\n self.assertPreciseEqual(foo(1), 2)\n self.assertPreciseEqual(foo(1.5), 2)\n closure = 2\n self.assertPreciseEqual(foo(1), 2)\n # Recompiling takes the new closure into account.\n foo.recompile()\n self.assertPreciseEqual(foo(1), 3)\n self.assertPreciseEqual(foo(1.5), 3)", "metadata": "root.TestDispatcherMethods.test_recompile_signatures", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 387 }, { "content": " @tag('important')\n def test_inspect_llvm(self):\n # Create a jited function\n @jit\n def foo(explicit_arg1, explicit_arg2):\n return explicit_arg1 + explicit_arg2\n\n # Call it in a way to create 3 signatures\n foo(1, 1)\n foo(1.0, 1)\n foo(1.0, 1.0)\n\n # base call to get all llvm in a dict\n llvms = foo.inspect_llvm()\n self.assertEqual(len(llvms), 3)\n\n # make sure the function name shows up in the llvm\n for llvm_bc in llvms.values():\n # Look for the function name\n self.assertIn(\"foo\", llvm_bc)\n\n # Look for the argument names\n self.assertIn(\"explicit_arg1\", llvm_bc)\n self.assertIn(\"explicit_arg2\", llvm_bc)", "metadata": "root.TestDispatcherMethods.test_inspect_llvm", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 403 }, { "content": " def test_inspect_asm(self):\n # Create a jited function\n @jit\n def foo(explicit_arg1, explicit_arg2):\n return explicit_arg1 + explicit_arg2\n\n # Call it in a way to create 3 signatures\n foo(1, 1)\n foo(1.0, 1)\n foo(1.0, 1.0)\n\n # base call to get all llvm in a dict\n asms = foo.inspect_asm()\n self.assertEqual(len(asms), 3)\n\n # make sure the function name shows up in the llvm\n for asm in asms.values():\n # Look for the function name\n self.assertTrue(\"foo\" in asm)", "metadata": "root.TestDispatcherMethods.test_inspect_asm", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 428 }, { "content": " def test_inspect_types(self):\n @jit\n def foo(a, b):\n return a + b\n\n foo(1, 2)\n # Exercise the method\n foo.inspect_types(utils.StringIO())", "metadata": "root.TestDispatcherMethods.test_inspect_types", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 448 }, { "content": " def test_issue_with_array_layout_conflict(self):\n \"\"\"\n This test an issue with the dispatcher when an array that is both\n C and F contiguous is supplied as the first signature.\n The dispatcher checks for F contiguous first but the compiler checks\n for C contiguous first. This results in an C contiguous code inserted\n as F contiguous function.\n \"\"\"\n def pyfunc(A, i, j):\n return A[i, j]\n\n cfunc = jit(pyfunc)\n\n ary_c_and_f = np.array([[1.]])\n ary_c = np.array([[0., 1.], [2., 3.]], order='C')\n ary_f = np.array([[0., 1.], [2., 3.]], order='F')\n\n exp_c = pyfunc(ary_c, 1, 0)\n exp_f = pyfunc(ary_f, 1, 0)\n\n self.assertEqual(1., cfunc(ary_c_and_f, 0, 0))\n got_c = cfunc(ary_c, 1, 0)\n got_f = cfunc(ary_f, 1, 0)\n\n self.assertEqual(exp_c, got_c)\n self.assertEqual(exp_f, got_f)", "metadata": "root.TestDispatcherMethods.test_issue_with_array_layout_conflict", "header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']", "index": 457 }, { "content": "class TestCache(TestCase):\n\n here = os.path.dirname(__file__)\n # The source file that will be copied\n usecases_file = os.path.join(here, \"cache_usecases.py\")\n # Make sure this doesn't conflict with another module\n modname = \"caching_test_fodder\"\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.TestCache", "header": "['module', '___EOS___']", "index": 485 }, { "content": " def setUp(self):\n self.tempdir = temp_directory('test_dispatcher_cache')\n sys.path.insert(0, self.tempdir)\n self.modfile = os.path.join(self.tempdir, self.modname + \".py\")\n self.cache_dir = os.path.join(self.tempdir, \"__pycache__\")\n shutil.copy(self.usecases_file, self.modfile)\n self.maxDiff = None", "metadata": "root.TestCache.setUp", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 493 }, { "content": " def tearDown(self):\n sys.modules.pop(self.modname, None)\n sys.path.remove(self.tempdir)", "metadata": "root.TestCache.tearDown", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 501 }, { "content": " def import_module(self):\n # Import a fresh version of the test module. All jitted functions\n # in the test module will start anew and load overloads from\n # the on-disk cache if possible.\n old = sys.modules.pop(self.modname, None)\n if old is not None:\n # Make sure cached bytecode is removed\n if sys.version_info >= (3,):\n cached = [old.__cached__]\n else:\n if old.__file__.endswith(('.pyc', '.pyo')):\n cached = [old.__file__]\n else:\n cached = [old.__file__ + 'c', old.__file__ + 'o']\n for fn in cached:\n try:\n os.unlink(fn)\n except OSError as e:\n if e.errno != errno.ENOENT:\n raise\n mod = import_dynamic(self.modname)\n self.assertEqual(mod.__file__.rstrip('co'), self.modfile)\n return mod", "metadata": "root.TestCache.import_module", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 505 }, { "content": " def cache_contents(self):\n try:\n return [fn for fn in os.listdir(self.cache_dir)\n if not fn.endswith(('.pyc', \".pyo\"))]\n except OSError as e:\n if e.errno != errno.ENOENT:\n raise\n return []", "metadata": "root.TestCache.cache_contents", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 529 }, { "content": " def get_cache_mtimes(self):\n return dict((fn, os.path.getmtime(os.path.join(self.cache_dir, fn)))\n for fn in sorted(self.cache_contents()))", "metadata": "root.TestCache.get_cache_mtimes", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 538 }, { "content": " def check_pycache(self, n):\n c = self.cache_contents()\n self.assertEqual(len(c), n, c)", "metadata": "root.TestCache.check_pycache", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 542 }, { "content": " def dummy_test(self):\n pass", "metadata": "root.TestCache.dummy_test", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 546 }, { "content": " def run_in_separate_process(self):\n # Cached functions can be run from a distinct process.\n # Also stresses issue #1603: uncached function calling cached function\n # shouldn't fail compiling.\n code = \"\"\"if 1:\n import sys\n\n sys.path.insert(0, %(tempdir)r)\n mod = __import__(%(modname)r)\n assert mod.add_usecase(2, 3) == 6\n assert mod.add_objmode_usecase(2, 3) == 6\n assert mod.outer_uncached(3, 2) == 2\n assert mod.outer(3, 2) == 2\n assert mod.generated_usecase(3, 2) == 1\n packed_rec = mod.record_return(mod.packed_arr, 1)\n assert tuple(packed_rec) == (2, 43.5), packed_rec\n aligned_rec = mod.record_return(mod.aligned_arr, 1)\n assert tuple(aligned_rec) == (2, 43.5), aligned_rec\n \"\"\" % dict(tempdir=self.tempdir, modname=self.modname,\n test_class=self.__class__.__name__)\n\n popen = subprocess.Popen([sys.executable, \"-c\", code],\n stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n out, err = popen.communicate()\n if popen.returncode != 0:\n raise AssertionError(\"process failed with code %s: stderr follows\\n%s\\n\"\n % (popen.returncode, err.decode()))", "metadata": "root.TestCache.run_in_separate_process", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 549 }, { "content": " def check_module(self, mod):\n self.check_pycache(0)\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_pycache(2) # 1 index, 1 data\n self.assertPreciseEqual(f(2.5, 3), 6.5)\n self.check_pycache(3) # 1 index, 2 data\n\n f = mod.add_objmode_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_pycache(5) # 2 index, 3 data\n self.assertPreciseEqual(f(2.5, 3), 6.5)\n self.check_pycache(6) # 2 index, 4 data", "metadata": "root.TestCache.check_module", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 577 }, { "content": " def check_hits(self, func, hits, misses=None):\n st = func.stats\n self.assertEqual(sum(st.cache_hits.values()), hits, st.cache_hits)\n if misses is not None:\n self.assertEqual(sum(st.cache_misses.values()), misses,\n st.cache_misses)", "metadata": "root.TestCache.check_hits", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 591 }, { "content": " @tag('important')\n def test_caching(self):\n self.check_pycache(0)\n mod = self.import_module()\n self.check_pycache(0)\n\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_pycache(2) # 1 index, 1 data\n self.assertPreciseEqual(f(2.5, 3), 6.5)\n self.check_pycache(3) # 1 index, 2 data\n self.check_hits(f, 0, 2)\n\n f = mod.add_objmode_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_pycache(5) # 2 index, 3 data\n self.assertPreciseEqual(f(2.5, 3), 6.5)\n self.check_pycache(6) # 2 index, 4 data\n self.check_hits(f, 0, 2)\n\n f = mod.record_return\n rec = f(mod.aligned_arr, 1)\n self.assertPreciseEqual(tuple(rec), (2, 43.5))\n rec = f(mod.packed_arr, 1)\n self.assertPreciseEqual(tuple(rec), (2, 43.5))\n self.check_pycache(9) # 3 index, 6 data\n self.check_hits(f, 0, 2)\n\n f = mod.generated_usecase\n self.assertPreciseEqual(f(3, 2), 1)\n self.assertPreciseEqual(f(3j, 2), 2 + 3j)\n\n # Check the code runs ok from another process\n self.run_in_separate_process()", "metadata": "root.TestCache.test_caching", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 598 }, { "content": " def test_inner_then_outer(self):\n # Caching inner then outer function is ok\n mod = self.import_module()\n self.assertPreciseEqual(mod.inner(3, 2), 6)\n self.check_pycache(2) # 1 index, 1 data\n # Uncached outer function shouldn't fail (issue #1603)\n f = mod.outer_uncached\n self.assertPreciseEqual(f(3, 2), 2)\n self.check_pycache(2) # 1 index, 1 data\n mod = self.import_module()\n f = mod.outer_uncached\n self.assertPreciseEqual(f(3, 2), 2)\n self.check_pycache(2) # 1 index, 1 data\n # Cached outer will create new cache entries\n f = mod.outer\n self.assertPreciseEqual(f(3, 2), 2)\n self.check_pycache(4) # 2 index, 2 data\n self.assertPreciseEqual(f(3.5, 2), 2.5)\n self.check_pycache(6) # 2 index, 4 data", "metadata": "root.TestCache.test_inner_then_outer", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 633 }, { "content": " def test_outer_then_inner(self):\n # Caching outer then inner function is ok\n mod = self.import_module()\n self.assertPreciseEqual(mod.outer(3, 2), 2)\n self.check_pycache(4) # 2 index, 2 data\n self.assertPreciseEqual(mod.outer_uncached(3, 2), 2)\n self.check_pycache(4) # same\n mod = self.import_module()\n f = mod.inner\n self.assertPreciseEqual(f(3, 2), 6)\n self.check_pycache(4) # same\n self.assertPreciseEqual(f(3.5, 2), 6.5)\n self.check_pycache(5) # 2 index, 3 data", "metadata": "root.TestCache.test_outer_then_inner", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 653 }, { "content": " def test_no_caching(self):\n mod = self.import_module()\n\n f = mod.add_nocache_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_pycache(0)", "metadata": "root.TestCache.test_no_caching", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 667 }, { "content": " def test_looplifted(self):\n # Loop-lifted functions can't be cached and raise a warning\n mod = self.import_module()\n\n with warnings.catch_warnings(record=True) as w:\n warnings.simplefilter('always', NumbaWarning)\n\n f = mod.looplifted\n self.assertPreciseEqual(f(4), 6)\n self.check_pycache(0)\n\n self.assertEqual(len(w), 1)\n self.assertEqual(str(w[0].message),\n 'Cannot cache compiled function \"looplifted\" '\n 'as it uses lifted loops')", "metadata": "root.TestCache.test_looplifted", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 674 }, { "content": " def test_ctypes(self):\n # Functions using a ctypes pointer can't be cached and raise\n # a warning.\n mod = self.import_module()\n\n with warnings.catch_warnings(record=True) as w:\n warnings.simplefilter('always', NumbaWarning)\n\n f = mod.use_c_sin\n self.assertPreciseEqual(f(0.0), 0.0)\n self.check_pycache(0)\n\n self.assertEqual(len(w), 1)\n self.assertIn('Cannot cache compiled function \"use_c_sin\"',\n str(w[0].message))", "metadata": "root.TestCache.test_ctypes", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 690 }, { "content": " def test_closure(self):\n mod = self.import_module()\n\n with warnings.catch_warnings(record=True) as w:\n warnings.simplefilter('always', NumbaWarning)\n\n f = mod.closure1\n self.assertPreciseEqual(f(3), 6)\n f = mod.closure2\n self.assertPreciseEqual(f(3), 8)\n self.check_pycache(0)\n\n self.assertEqual(len(w), 2)\n for item in w:\n self.assertIn('Cannot cache compiled function \"closure\"',\n str(item.message))", "metadata": "root.TestCache.test_closure", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 706 }, { "content": " def test_cache_reuse(self):\n mod = self.import_module()\n mod.add_usecase(2, 3)\n mod.add_usecase(2.5, 3.5)\n mod.add_objmode_usecase(2, 3)\n mod.outer_uncached(2, 3)\n mod.outer(2, 3)\n mod.record_return(mod.packed_arr, 0)\n mod.record_return(mod.aligned_arr, 1)\n mod.generated_usecase(2, 3)\n mtimes = self.get_cache_mtimes()\n # Two signatures compiled\n self.check_hits(mod.add_usecase, 0, 2)\n\n mod2 = self.import_module()\n self.assertIsNot(mod, mod2)\n f = mod2.add_usecase\n f(2, 3)\n self.check_hits(f, 1, 0)\n f(2.5, 3.5)\n self.check_hits(f, 2, 0)\n f = mod2.add_objmode_usecase\n f(2, 3)\n self.check_hits(f, 1, 0)\n\n # The files haven't changed\n self.assertEqual(self.get_cache_mtimes(), mtimes)\n\n self.run_in_separate_process()\n self.assertEqual(self.get_cache_mtimes(), mtimes)", "metadata": "root.TestCache.test_cache_reuse", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 723 }, { "content": " def test_cache_invalidate(self):\n mod = self.import_module()\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n\n # This should change the functions' results\n with open(self.modfile, \"a\") as f:\n f.write(\"\\nZ = 10\\n\")\n\n mod = self.import_module()\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 15)\n f = mod.add_objmode_usecase\n self.assertPreciseEqual(f(2, 3), 15)", "metadata": "root.TestCache.test_cache_invalidate", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 754 }, { "content": " def test_recompile(self):\n # Explicit call to recompile() should overwrite the cache\n mod = self.import_module()\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n\n mod = self.import_module()\n f = mod.add_usecase\n mod.Z = 10\n self.assertPreciseEqual(f(2, 3), 6)\n f.recompile()\n self.assertPreciseEqual(f(2, 3), 15)\n\n # Freshly recompiled version is re-used from other imports\n mod = self.import_module()\n f = mod.add_usecase\n self.assertPreciseEqual(f(2, 3), 15)", "metadata": "root.TestCache.test_recompile", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 769 }, { "content": " def test_same_names(self):\n # Function with the same names should still disambiguate\n mod = self.import_module()\n f = mod.renamed_function1\n self.assertPreciseEqual(f(2), 4)\n f = mod.renamed_function2\n self.assertPreciseEqual(f(2), 8)", "metadata": "root.TestCache.test_same_names", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 787 }, { "content": " def _test_pycache_fallback(self):\n \"\"\"\n With a disabled __pycache__, test there is a working fallback\n (e.g. on the user-wide cache dir)\n \"\"\"\n mod = self.import_module()\n f = mod.add_usecase\n # Remove this function's cache files at the end, to avoid accumulation\n # accross test calls.\n self.addCleanup(shutil.rmtree, f.stats.cache_path, ignore_errors=True)\n\n self.assertPreciseEqual(f(2, 3), 6)\n # It's a cache miss since the file was copied to a new temp location\n self.check_hits(f, 0, 1)\n\n # Test re-use\n mod2 = self.import_module()\n f = mod2.add_usecase\n self.assertPreciseEqual(f(2, 3), 6)\n self.check_hits(f, 1, 0)\n\n # The __pycache__ is empty (otherwise the test's preconditions\n # wouldn't be met)\n self.check_pycache(0)", "metadata": "root.TestCache._test_pycache_fallback", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 795 }, { "content": " @unittest.skipIf(os.name == \"nt\",\n \"cannot easily make a directory read-only on Windows\")\n def test_non_creatable_pycache(self):\n # Make it impossible to create the __pycache__ directory\n old_perms = os.stat(self.tempdir).st_mode\n os.chmod(self.tempdir, 0o500)\n self.addCleanup(os.chmod, self.tempdir, old_perms)\n\n self._test_pycache_fallback()", "metadata": "root.TestCache.test_non_creatable_pycache", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 820 }, { "content": " @unittest.skipIf(os.name == \"nt\",\n \"cannot easily make a directory read-only on Windows\")\n def test_non_writable_pycache(self):\n # Make it impossible to write to the __pycache__ directory\n pycache = os.path.join(self.tempdir, '__pycache__')\n os.mkdir(pycache)\n old_perms = os.stat(pycache).st_mode\n os.chmod(pycache, 0o500)\n self.addCleanup(os.chmod, pycache, old_perms)\n\n self._test_pycache_fallback()", "metadata": "root.TestCache.test_non_writable_pycache", "header": "['class', 'TestCache', '(', 'TestCase', ')', ':', '___EOS___']", "index": 830 } ]
[ { "span": "import imp", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import stat", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 }, { "span": "import tempfile", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 15 }, { "span": "from numba import utils, vectorize, jit, generated_jit, types, appdirs", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 70 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\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_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numba_", "import_", "unittest", "\\u", "support_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "import_", "utils_", ",_", "vectorize", "_", ",_", "jit_", ",_", "generat", "ed", "\\u", "jit_", ",_", "types_", ",_", "appd", "irs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "errors_", "import_", "Num", "ba", "Warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "support_", "import_", "Test", "Case_", ",_", "tag_", ",_", "temp", "\\u", "directory_", ",_", "import", "\\u", "dynamic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dummy_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "y_", "\\u\\u\\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_", "adds", "ub_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "-_", "y_", "+_", "z_", "\\u\\u\\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_", "adds", "ub", "\\u", "defaults_", "(_", "x_", ",_", "y_", "=_", "2_", ",_", "z_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "-_", "y_", "+_", "z_", "\\u\\u\\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_", "star", "\\u", "defaults_", "(_", "x_", ",_", "y_", "=_", "2_", ",_", "*_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", ",_", "y_", ",_", "z_", "\\u\\u\\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_", "generat", "ed", "\\u", "usec", "ase_", "(_", "x_", ",_", "y_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "x_", ",_", "types_", "._", "Complex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "impl_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "impl_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "-_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "impl_", "\\u\\u\\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_", "bad", "\\u", "generat", "ed", "\\u", "usec", "ase_", "(_", "x_", ",_", "y_", "=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "x_", ",_", "types_", "._", "Complex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "impl_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "impl_", "(_", "x_", ",_", "y_", "=_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "-_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "impl_", "\\u\\u\\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_", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jit", "\\u", "args_", "=_", "dict_", "(_", "nop", "ython_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compile", "\\u", "func_", "(_", "self_", ",_", "pyfu", "nc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "check_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected_", "=_", "pyfu", "nc_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "f_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "result_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "jit_", "(_", "**_", "self_", "._", "jit", "\\u", "args_", ")_", "(_", "pyfu", "nc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", ",_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "no", "\\u", "argument_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "make", " ", "sure", " ", "this", " ", "doe", "sn", "'", "t", " ", "crash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "coerce", "\\u", "input", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Issue", " ", "#", "486", ":", " ", "do", " ", "not", " ", "allow", " ", "unsafe", " ", "conversions", " ", "if", " ", "we", " ", "can", " ", "still", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compile", " ", "other", " ", "special", "izatio", "ns", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c\\u", "add_", "=_", "jit_", "(_", "nop", "ython_", "=_", "True_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "123_", ",_", "456_", ")_", ",_", "add_", "(_", "123_", ",_", "456_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "12.3", "_", ",_", "45.", "6_", ")_", ",_", "add_", "(_", "12.3", "_", ",_", "45.", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "12.3", "_", ",_", "45.", "6", "j_", ")_", ",_", "add_", "(_", "12.3", "_", ",_", "45.", "6", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "123", "00000000", "_", ",_", "456_", ")_", ",_", "add_", "(_", "123", "00000000", "_", ",_", "456_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "force", " ", "compilation", " ", "of", " ", "only", " ", "a", " ", "single", " ", "special", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "add_", "=_", "jit_", "(_", "'(", "i", "4", ",", " ", "i", "4", ")'_", ",_", "nop", "ython_", "=_", "True_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "123_", ",_", "456_", ")_", ",_", "add_", "(_", "123_", ",_", "456_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Implicit", " ", "(", "unsafe", ")", " ", "conve", "rsi", "on", " ", "of", " ", "float", " ", "to", " ", "int_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "c\\u", "add_", "(_", "12.3", "_", ",_", "45.", "6_", ")_", ",_", "add_", "(_", "12_", ",_", "45_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Implicit", " ", "conve", "rsi", "on", " ", "of", " ", "complex", " ", "to", " ", "int", " ", "disallow", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c\\u", "add_", "(_", "12.3", "_", ",_", "45.", "6", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "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\\u", "ambiguous", "\\u", "new", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "compil", "ing", " ", "new", " ", "version", " ", "in", " ", "an", " ", "ambiguous", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "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_", "INT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FL", "T_", "=_", "1.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "foo_", "(_", "INT_", ",_", "FL", "T_", ")_", ",_", "INT_", "+_", "FL", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "overload", "s_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "foo_", "(_", "FL", "T_", ",_", "INT_", ")_", ",_", "FL", "T_", "+_", "INT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "overload", "s_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "foo_", "(_", "FL", "T_", ",_", "FL", "T_", ")_", ",_", "FL", "T_", "+_", "FL", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "overload", "s_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "follow", "ing", " ", "call", " ", "is", " ", "ambiguous", " ", "bec", "aus", "e", " ", "(", "int", ",", " ", "int", ")", " ", "can", " ", "resolve_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "(", "float", ",", " ", "int", ")", " ", "or", " ", "(", "int", ",", " ", "float", ")", " ", "with", " ", "equal", " ", "weight", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "foo_", "(_", "1_", ",_", "1_", ")_", ",_", "INT_", "+_", "INT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "overload", "s_", ")_", ",_", "4_", ",_", "\"", "did", "n", "'", "t", " ", "compile", " ", "a", " ", "new", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "(", "lazy", ")", " ", "compil", "ing", " ", "from", " ", "sever", "al", " ", "thread", "s", " ", "at", " ", "onc", "e", " ", "doe", "sn", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "produce", " ", "error", "s", " ", "(", "see", " ", "issue", " ", "#", "908", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wrapper_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "threads_", "=_", "[_", "threading_", "._", "Thread_", "(_", "target_", "=_", "wrapper_", ")_", "for_", "i_", "in_", "range_", "(_", "16_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "explicit", "\\u", "signatures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "jit_", "(_", "\"(", "int", "64", ",", "int", "64", ")\"_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Approx", "imat", "e", " ", "match", " ", "(", "unsafe", " ", "conve", "rsi", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "1.5_", ",_", "2.5_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "f_", "._", "overload", "s_", ")_", ",_", "1_", ",_", "f_", "._", "overload", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "jit_", "(_", "[_", "\"(", "int", "64", ",", "int", "64", ")\"_", ",_", "\"(", "float", "64", ",", "float", "64", ")\"_", "]_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exa", "ct", " ", "signa", "ture", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "1.5_", ",_", "2.5_", ")_", ",_", "4.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Approx", "imat", "e", " ", "match", " ", "(", "int", "32", " ", "->", " ", "float", "64", " ", "is", " ", "a", " ", "safe", " ", "conve", "rsi", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "np_", "._", "int32_", "(_", "1_", ")_", ",_", "2.5_", ")_", ",_", "3.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "conversion_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "1j_", ",_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "No", " ", "matchi", "ng", " ", "definit", "ion", "\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "f_", "._", "overload", "s_", ")_", ",_", "2_", ",_", "f_", "._", "overload", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "more", " ", "interesting", " ", "one", "..._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "jit_", "(_", "[_", "\"(", "float", "32", ",", "float", "32", ")\"_", ",_", "\"(", "float", "64", ",", "float", "64", ")\"_", "]_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "np_", "._", "float32_", "(_", "1_", ")_", ",_", "np_", "._", "float32_", "(_", "2_", "**_", "-_", "25_", ")_", ")_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "1_", ",_", "2_", "**_", "-_", "25_", ")_", ",_", "1.000000", "029", "802", "322", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fail", " ", "to", " ", "resolve", " ", "ambi", "guit", "y", " ", "bet", "ween", " ", "the", " ", "two", " ", "best", " ", "overload", "s_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "jit_", "(_", "[_", "\"(", "float", "32", ",", "float", "64", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "float", "64", ",", "float", "32", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "int", "64", ",", "int", "64", ")\"_", "]_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "1.0_", ",_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "two", " ", "best", " ", "matche", "s", " ", "are", " ", "output", " ", "in", " ", "the", " ", "error", " ", "message", ",", " ", "as", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "the", " ", "actual", " ", "argu", "ment", " ", "types", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Rege", "xp", "Matches_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "cm_", "._", "exception_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"", "Ambi", "guous", " ", "overload", "ing", " ", "for", " ", "<", "function", " ", "add", " ", "[", "^", ">]", "*>", " ", "\\\\(", "float", "64", ",", " ", "float", "64", "\\\\)", ":\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "(", "float", "32", ",", " ", "float", "64", "\\\\)", " ", "->", " ", "float", "64", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "(", "float", "64", ",", " ", "float", "32", "\\\\)", " ", "->", " ", "float", "64", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "integ", "er", " ", "signa", "ture", " ", "is", " ", "not", " ", "part", " ", "of", " ", "the", " ", "best", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "int", "64", "\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "signa", "ture", "\\u", "mismatch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpl_", "=_", "\"", "Sign", "ature", " ", "mism", "atch", ":", " ", "%", "d", " ", "argu", "ment", " ", "types", " ", "give", "n", ",", " ", "but", " ", "function", " ", "take", "s", " ", "2", " ", "argu", "ment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jit_", "(_", "\"(", ")\"_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "tmpl_", "%_", "0_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jit_", "(_", "\"(", "int", "c", ",)", "\"_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "tmpl_", "%_", "1_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jit_", "(_", "\"(", "int", "c", ",", "int", "c", ",", "int", "c", ")\"_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "tmpl_", "%_", "3_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "With", " ", "force", "obj", "=", "Tru", "e", ",", " ", "an", " ", "empty", " ", "tuple", " ", "is", " ", "accepted_", "\\u\\u\\uNL\\u\\u\\u_", "jit_", "(_", "\"(", ")\"_", ",_", "force", "obj_", "=_", "True_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jit_", "(_", "\"(", "int", "c", ",)", "\"_", ",_", "force", "obj_", "=_", "True_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "tmpl_", "%_", "1_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "matchi", "ng", "\\u", "error", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "jit_", "(_", "\"(", "int", "c", ",", "int", "c", ")\"_", ")_", "(_", "add_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "1j_", ",_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "cm_", "._", "exception_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "matchi", "ng", " ", "definit", "ion", " ", "for", " ", "argu", "ment", " ", "type", "(", "s", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "complex", "128", ",", " ", "complex", "128", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disable", "d\\u", "compilation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "foo_", "._", "compile_", "(_", "\"(", "float", "32", ",)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "._", "disable", "\\u", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "._", "compile_", "(_", "\"(", "int", "32", ",)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "raises_", "._", "exception_", ")_", ",_", "\"", "compilation", " ", "disable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "signatures_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disable", "d\\u", "compilation", "\\u", "through", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "(_", "[_", "\"(", "float", "32", ",)", "\"_", ",_", "\"(", "int", "32", ",)", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "._", "compile_", "(_", "\"(", "complex", "64", ",)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "raises_", "._", "exception_", ")_", ",_", "\"", "compilation", " ", "disable", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "signatures_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disable", "d\\u", "compilation", "\\u", "nest", "ed", "\\u", "call_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "(_", "[_", "\"(", "intp", ",)", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "bar_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "(_", "np_", "._", "ones_", "(_", "1_", ")_", ")_", "#", " ", "no", " ", "matchi", "ng", " ", "definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "\"", "No", " ", "matchi", "ng", " ", "definit", "ion", " ", "for", " ", "argu", "ment", " ", "type", "(", "s", ")", " ", "array", "(", "float", "64", ",", " ", "1d", ",", " ", "C", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "raises_", "._", "exception_", ")_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Sign", "ature", "Hand", "ling_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "support", " ", "for", " ", "vari", "ous", " ", "parameter", " ", "passi", "ng", " ", "style", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sign", "ature", "Hand", "ling_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "tag_", "(_", "'", "importa", "nt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "named", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "passi", "ng", " ", "named", " ", "argu", "ment", "s", " ", "to", " ", "a", " ", "dispatcher", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", ",_", "check_", "=_", "self_", "._", "compile", "\\u", "func_", "(_", "adds", "ub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ",_", "z_", "=_", "10_", ",_", "y_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ",_", "4_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "3_", ",_", "y_", "=_", "4_", ",_", "z_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "calls", " ", "above", " ", "fall", " ", "under", " ", "the", " ", "same", " ", "special", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "f_", "._", "overload", "s_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Errors_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "3_", ",_", "4_", ",_", "y_", "=_", "6_", ",_", "z_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "too", " ", "many", " ", "argu", "ment", "s", ":", " ", "expected", " ", "3", ",", " ", "got", " ", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "not", " ", "eno", "ugh", " ", "argu", "ment", "s", ":", " ", "expected", " ", "3", ",", " ", "got", " ", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "3_", ",_", "4_", ",_", "y_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "missi", "ng", " ", "argu", "ment", " ", "'", "z", "'\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sign", "ature", "Hand", "ling_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "omit", "ting", " ", "argu", "ment", "s", " ", "with", " ", "a", " ", "default", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", ",_", "check_", "=_", "self_", "._", "compile", "\\u", "func_", "(_", "adds", "ub", "\\u", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ",_", "z_", "=_", "10_", ",_", "y_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ",_", "4_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "3_", ",_", "y_", "=_", "4_", ",_", "z_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "omit", "ting", " ", "some", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "3_", ",_", "z_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "3_", ",_", "y_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Errors_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "3_", ",_", "4_", ",_", "y_", "=_", "6_", ",_", "z_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "too", " ", "many", " ", "argu", "ment", "s", ":", " ", "expected", " ", "3", ",", " ", "got", " ", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "not", " ", "eno", "ugh", " ", "argu", "ment", "s", ":", " ", "expected", " ", "at", " ", "leas", "t", " ", "1", ",", " ", "got", " ", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "y_", "=_", "6_", ",_", "z_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "missi", "ng", " ", "argu", "ment", " ", "'", "x", "'\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sign", "ature", "Hand", "ling_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "star", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "a", " ", "compile", "d", " ", "function", " ", "with", " ", "star", "args", " ", "in", " ", "the", " ", "signa", "ture", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", ",_", "check_", "=_", "self_", "._", "compile", "\\u", "func_", "(_", "star", "\\u", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "5_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "x_", "=_", "4_", ",_", "y_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "y_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "4_", ",_", "5_", ",_", "y_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "some", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "unexpected", "\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "4_", ",_", "5_", ",_", "z_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "some", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "unexpected", "\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "4_", ",_", "x_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "some", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "unexpected", "\"_", ",_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Sign", "ature", "Hand", "ling", "Object", "Mode_", "(_", "Test", "Sign", "ature", "Hand", "ling_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sam", "s", " ", "as", " ", "Test", "Sign", "ature", "Hand", "ling", ",", " ", "but", " ", "in", " ", "object", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jit", "\\u", "args_", "=_", "dict_", "(_", "force", "obj_", "=_", "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_", "class_", "Test", "Generate", "d", "Dispatcher_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "@", "generat", "ed", "\\u", "jit", ".", "\\", "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_", "Test", "Generate", "d", "Dispatcher_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "tag_", "(_", "'", "importa", "nt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "generated_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "generat", "ed", "\\u", "jit_", "(_", "nop", "ython_", "=_", "True_", ")_", "(_", "generat", "ed", "\\u", "usec", "ase_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "8_", ")_", ",_", "8_", "-_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "x_", "=_", "8_", ")_", ",_", "8_", "-_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "x_", "=_", "8_", ",_", "y_", "=_", "4_", ")_", ",_", "8_", "-_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "1j_", ")_", ",_", "5_", "+_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "1j_", ",_", "42_", ")_", ",_", "42_", "+_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "x_", "=_", "1j_", ",_", "y_", "=_", "7_", ")_", ",_", "7_", "+_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Generate", "d", "Dispatcher_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "signa", "ture", "\\u", "errors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "error", " ", "reporting", " ", "whe", "n", " ", "implementation", " ", "signa", "ture", " ", "doe", "sn", "'", "t", " ", "match", "\\", "10", ";", " ", " ", " ", " ", "generat", "ing", " ", "function", " ", "signa", "ture", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "generat", "ed", "\\u", "jit_", "(_", "nop", "ython_", "=_", "True_", ")_", "(_", "bad", "\\u", "generat", "ed", "\\u", "usec", "ase_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mismatch", "ing", " ", "#", " ", "of", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "1j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "shou", "ld", " ", "be", " ", "compatible", " ", "with", " ", "signa", "ture", " ", "'(", "x", ",", " ", "y", "=", "5", ")'", ",", " ", "but", " ", "has", " ", "signa", "ture", " ", "'(", "x", ")'", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "raises_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mismatch", "ing", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", "as_", "raises_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "shou", "ld", " ", "be", " ", "compatible", " ", "with", " ", "signa", "ture", " ", "'(", "x", ",", " ", "y", "=", "5", ")'", ",", " ", "but", " ", "has", " ", "signa", "ture", " ", "'(", "x", ",", " ", "y", "=", "6", ")'", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "raises_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Dispatcher", "Methods_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "recom", "pile", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "closure_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "closure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1.5_", ")_", ",_", "2.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "signatures_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closure_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reco", "mpi", "ling", " ", "take", "s", " ", "the", " ", "new", " ", "clos", "ure", " ", "int", "o", " ", "account", "._", "\\u\\u\\uNL\\u\\u\\u_", "foo_", "._", "recom", "pile", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Every", "thing", " ", "was", " ", "recom", "pile", "d_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foo_", "._", "signatures_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1.5_", ")_", ",_", "3.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recom", "pile", "\\u", "signatures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sam", "e", " ", "as", " ", "above", ",", " ", "but", " ", "with", " ", "an", " ", "explicit", " ", "signa", "ture", " ", "on", " ", "@", "jit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "closure_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "jit_", "(_", "\"", "int", "32", "(", "int", "32", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "+_", "closure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1.5_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closure_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reco", "mpi", "ling", " ", "take", "s", " ", "the", " ", "new", " ", "clos", "ure", " ", "int", "o", " ", "account", "._", "\\u\\u\\uNL\\u\\u\\u_", "foo_", "._", "recom", "pile", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "foo_", "(_", "1.5_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tag_", "(_", "'", "importa", "nt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "inspect", "\\u", "llvm", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "jit", "ed", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "explicit", "\\u", "arg1_", ",_", "explicit", "\\u", "arg2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "explicit", "\\u", "arg1_", "+_", "explicit", "\\u", "arg2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "it", " ", "in", " ", "a", " ", "way", " ", "to", " ", "create", " ", "3", " ", "signatures_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "foo_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "(_", "1.0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "(_", "1.0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "call", " ", "to", " ", "get", " ", "all", " ", "llvm", " ", "in", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "llvm", "s_", "=_", "foo_", "._", "inspect", "\\u", "llvm", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "llvm", "s_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "function", " ", "name", " ", "show", "s", " ", "up", " ", "in", " ", "the", " ", "llvm", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "llvm", "\\u", "bc_", "in_", "llvm", "s_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "the", " ", "function", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "\"", "foo", "\"_", ",_", "llvm", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "the", " ", "argu", "ment", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "explicit", "\\u", "arg", "1", "\"_", ",_", "llvm", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "explicit", "\\u", "arg", "2", "\"_", ",_", "llvm", "\\u", "bc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "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", "inspect", "\\u", "asm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "jit", "ed", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "explicit", "\\u", "arg1_", ",_", "explicit", "\\u", "arg2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "explicit", "\\u", "arg1_", "+_", "explicit", "\\u", "arg2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "it", " ", "in", " ", "a", " ", "way", " ", "to", " ", "create", " ", "3", " ", "signatures_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "foo_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "(_", "1.0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo_", "(_", "1.0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "call", " ", "to", " ", "get", " ", "all", " ", "llvm", " ", "in", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "asm", "s_", "=_", "foo_", "._", "inspect", "\\u", "asm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "asm", "s_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "function", " ", "name", " ", "show", "s", " ", "up", " ", "in", " ", "the", " ", "llvm", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "asm_", "in_", "asm", "s_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "the", " ", "function", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "\"", "foo", "\"_", "in_", "asm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "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", "inspect", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "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_", "foo_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exercise", " ", "the", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "foo_", "._", "inspect", "\\u", "types_", "(_", "utils_", "._", "String", "IO_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dispatcher", "Methods_", "(_", "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", "with", "\\u", "array", "\\u", "layout", "\\u", "conflict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "test", " ", "an", " ", "issue", " ", "with", " ", "the", " ", "dispatcher", " ", "whe", "n", " ", "an", " ", "array", " ", "tha", "t", " ", "is", " ", "bot", "h", "\\", "10", ";", " ", " ", " ", " ", "C", " ", "and", " ", "F", " ", "contiguous", " ", "is", " ", "supplie", "d", " ", "as", " ", "the", " ", "first", " ", "signa", "ture", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "dispatcher", " ", "checks", " ", "for", " ", "F", " ", "contiguous", " ", "first", " ", "but", " ", "the", " ", "compiler", " ", "checks", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "C", " ", "contiguous", " ", "first", ".", " ", "Thi", "s", " ", "results", " ", "in", " ", "an", " ", "C", " ", "contiguous", " ", "code", " ", "inserted", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "F", " ", "contiguous", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pyfu", "nc_", "(_", "A_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "A_", "[_", "i_", ",_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfunc_", "=_", "jit_", "(_", "pyfu", "nc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ary", "\\u", "c\\u", "and", "\\u", "f_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "1._", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ary", "\\u", "c_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0._", ",_", "1._", "]_", ",_", "[_", "2._", ",_", "3._", "]_", "]_", ",_", "order_", "=_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ary", "\\u", "f_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0._", ",_", "1._", "]_", ",_", "[_", "2._", ",_", "3._", "]_", "]_", ",_", "order_", "=_", "'", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "c_", "=_", "pyfu", "nc_", "(_", "ary", "\\u", "c_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "f_", "=_", "pyfu", "nc_", "(_", "ary", "\\u", "f_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1._", ",_", "cfunc_", "(_", "ary", "\\u", "c\\u", "and", "\\u", "f_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "got", "\\u", "c_", "=_", "cfunc_", "(_", "ary", "\\u", "c_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "got", "\\u", "f_", "=_", "cfunc_", "(_", "ary", "\\u", "f_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exp", "\\u", "c_", ",_", "got", "\\u", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exp", "\\u", "f_", ",_", "got", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "here_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "source", " ", "file", " ", "tha", "t", " ", "will", " ", "be", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "usec", "ases", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "here_", ",_", "\"", "cache", "\\u", "usec", "ases", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "this", " ", "doe", "sn", "'", "t", " ", "confl", "ict", " ", "with", " ", "anot", "her", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "modname_", "=_", "\"", "caching", "\\u", "test\\u", "fo", "dde", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Cache_", "(_", "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 ", " _", "self_", "._", "tempdir_", "=_", "temp", "\\u", "directory_", "(_", "'", "test\\u", "dispatcher", "\\u", "cache", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "self_", "._", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mod", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "self_", "._", "modname_", "+_", "\".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "\"\\u\\u", "pyca", "che", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "self_", "._", "usec", "ases", "\\u", "file_", ",_", "self_", "._", "mod", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "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 ", " _", "sys_", "._", "modules_", "._", "pop_", "(_", "self_", "._", "modname_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "remove_", "(_", "self_", "._", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "module_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Import", " ", "a", " ", "fresh", " ", "version", " ", "of", " ", "the", " ", "test", " ", "module", ".", " ", " ", "All", " ", "jit", "ted", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "test", " ", "module", " ", "will", " ", "start", " ", "ane", "w", " ", "and", " ", "load", " ", "overload", "s", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "on", "-", "disk", " ", "cache", " ", "if", " ", "possib", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old_", "=_", "sys_", "._", "modules_", "._", "pop_", "(_", "self_", "._", "modname_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "cache", "d", " ", "bytecode", " ", "is", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cached_", "=_", "[_", "old_", "._", "\\u\\u", "cache", "d\\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 ", " _", "if_", "old_", "._", "\\u\\u", "file\\u\\u_", "._", "endswith_", "(_", "(_", "'.", "pyc", "'_", ",_", "'.", "pyo", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cached_", "=_", "[_", "old_", "._", "\\u\\u", "file\\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 ", " ", "_", "cached_", "=_", "[_", "old_", "._", "\\u\\u", "file\\u\\u_", "+_", "'", "c", "'_", ",_", "old_", "._", "\\u\\u", "file\\u\\u_", "+_", "'", "o", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "unlink_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "e_", "._", "errno_", "!=_", "errno_", "._", "ENOENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod_", "=_", "import", "\\u", "dynamic_", "(_", "self_", "._", "modname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mod_", "._", "\\u\\u", "file\\u\\u_", "._", "rstrip_", "(_", "'", "co", "'_", ")_", ",_", "self_", "._", "mod", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cache", "\\u", "contents_", "(_", "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_", "[_", "fn_", "for_", "fn_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "cache", "\\u", "dir_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "fn_", "._", "endswith_", "(_", "(_", "'.", "pyc", "'_", ",_", "\".", "pyo", "\"_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "!=_", "errno_", "._", "ENOENT_", ":_", "\\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_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "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_", "get", "\\u", "cache", "\\u", "mti", "mes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", "(_", "fn_", ",_", "os_", "._", "path_", "._", "getmtime_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cache", "\\u", "dir_", ",_", "fn_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fn_", "in_", "sorted_", "(_", "self_", "._", "cache", "\\u", "contents_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "pyca", "che_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "cache", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "c_", ")_", ",_", "n_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dummy", "\\u", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "in", "\\u", "separate", "\\u", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cache", "d", " ", "function", "s", " ", "can", " ", "be", " ", "run", " ", "from", " ", "a", " ", "distinct", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "stress", "es", " ", "issue", " ", "#", "160", "3", ":", " ", "unca", "ched", " ", "function", " ", "calling", " ", "cache", "d", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "fail", " ", "compil", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "if", " ", "1", ":", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "sys", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "%", "(", "tempdi", "r", ")", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "mod", " ", "=", " ", "\\u\\u", "import", "\\u\\u", "(%", "(", "mod", "name", ")", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "mod", ".", "add", "\\u", "usec", "ase", "(", "2", ",", " ", "3", ")", " ", "==", " ", "6", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "mod", ".", "add", "\\u", "obj", "mode", "\\u", "usec", "ase", "(", "2", ",", " ", "3", ")", " ", "==", " ", "6", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "mod", ".", "outer", "\\u", "unca", "ched", "(", "3", ",", " ", "2", ")", " ", "==", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "mod", ".", "outer", "(", "3", ",", " ", "2", ")", " ", "==", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "mod", ".", "generat", "ed", "\\u", "usec", "ase", "(", "3", ",", " ", "2", ")", " ", "==", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "pack", "ed", "\\u", "rec", " ", "=", " ", "mod", ".", "record", "\\u", "return", "(", "mod", ".", "pack", "ed", "\\u", "arr", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "tuple", "(", "pack", "ed", "\\u", "rec", ")", " ", "==", " ", "(", "2", ",", " ", "43.", "5", "),", " ", "pack", "ed", "\\u", "rec", "\\", "10", ";", " ", " ", " ", " ", "aligned", "\\u", "rec", " ", "=", " ", "mod", ".", "record", "\\u", "return", "(", "mod", ".", "aligned", "\\u", "arr", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "assert", " ", "tuple", "(", "aligned", "\\u", "rec", ")", " ", "==", " ", "(", "2", ",", " ", "43.", "5", "),", " ", "aligned", "\\u", "rec", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "dict_", "(_", "tempdir_", "=_", "self_", "._", "tempdir_", ",_", "modname_", "=_", "self_", "._", "modname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "class_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "popen_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "sys_", "._", "executable_", ",_", "\"-", "c", "\"_", ",_", "code_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "err_", "=_", "popen_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "popen_", "._", "returncode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "process", " ", "fail", "ed", " ", "with", " ", "code", " ", "%", "s", ":", " ", "std", "err", " ", "follow", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "popen_", "._", "returncode_", ",_", "err_", "._", "decode_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "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_", "check", "\\u", "module_", "(_", "self_", ",_", "mod_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "2_", ")_", "#", " ", "1", " ", "index", ",", " ", "1", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2.5_", ",_", "3_", ")_", ",_", "6.5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "3_", ")_", "#", " ", "1", " ", "index", ",", " ", "2", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "obj", "mode", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "5_", ")_", "#", " ", "2", " ", "index", ",", " ", "3", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2.5_", ",_", "3_", ")_", ",_", "6.5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "6_", ")_", "#", " ", "2", " ", "index", ",", " ", "4", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "hits_", "(_", "self_", ",_", "func_", ",_", "hits_", ",_", "misses", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "func_", "._", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sum_", "(_", "st_", "._", "cache", "\\u", "hits_", "._", "values_", "(_", ")_", ")_", ",_", "hits_", ",_", "st_", "._", "cache", "\\u", "hits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "misses", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "sum_", "(_", "st_", "._", "cache", "\\u", "misses", "_", "._", "values_", "(_", ")_", ")_", ",_", "misses", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "st_", "._", "cache", "\\u", "misses", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "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_", "@_", "tag_", "(_", "'", "importa", "nt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "caching", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "2_", ")_", "#", " ", "1", " ", "index", ",", " ", "1", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2.5_", ",_", "3_", ")_", ",_", "6.5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "3_", ")_", "#", " ", "1", " ", "index", ",", " ", "2", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "obj", "mode", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "5_", ")_", "#", " ", "2", " ", "index", ",", " ", "3", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2.5_", ",_", "3_", ")_", ",_", "6.5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "6_", ")_", "#", " ", "2", " ", "index", ",", " ", "4", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "record", "\\u", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "f_", "(_", "mod_", "._", "aligned", "\\u", "arr_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "tuple_", "(_", "rec_", ")_", ",_", "(_", "2_", ",_", "43.", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "f_", "(_", "mod_", "._", "pack", "ed", "\\u", "arr_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "tuple_", "(_", "rec_", ")_", ",_", "(_", "2_", ",_", "43.", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "9_", ")_", "#", " ", "3", " ", "index", ",", " ", "6", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "generat", "ed", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ",_", "2_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3", "j_", ",_", "2_", ")_", ",_", "2_", "+_", "3", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "code", " ", "runs", " ", "ok", " ", "from", " ", "anot", "her", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "\\u", "in", "\\u", "separate", "\\u", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "inner", "\\u", "then", "\\u", "outer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Caching", " ", "inner", " ", "then", " ", "outer", " ", "function", " ", "is", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "mod_", "._", "inner_", "(_", "3_", ",_", "2_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "2_", ")_", "#", " ", "1", " ", "index", ",", " ", "1", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unc", "ache", "d", " ", "outer", " ", "function", " ", "shou", "ld", "n", "'", "t", " ", "fail", " ", "(", "issue", " ", "#", "160", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "outer", "\\u", "unca", "ched", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ",_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "2_", ")_", "#", " ", "1", " ", "index", ",", " ", "1", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "outer", "\\u", "unca", "ched", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ",_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "2_", ")_", "#", " ", "1", " ", "index", ",", " ", "1", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cache", "d", " ", "outer", " ", "will", " ", "create", " ", "new", " ", "cache", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "outer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ",_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "4_", ")_", "#", " ", "2", " ", "index", ",", " ", "2", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3.5_", ",_", "2_", ")_", ",_", "2.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "6_", ")_", "#", " ", "2", " ", "index", ",", " ", "4", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "outer", "\\u", "then", "\\u", "inner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Caching", " ", "outer", " ", "then", " ", "inner", " ", "function", " ", "is", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "mod_", "._", "outer_", "(_", "3_", ",_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "4_", ")_", "#", " ", "2", " ", "index", ",", " ", "2", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "mod_", "._", "outer", "\\u", "unca", "ched", "_", "(_", "3_", ",_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "4_", ")_", "#", " ", "same_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "inner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ",_", "2_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "4_", ")_", "#", " ", "same_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3.5_", ",_", "2_", ")_", ",_", "6.5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "5_", ")_", "#", " ", "2", " ", "index", ",", " ", "3", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "caching", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "noca", "che", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop", "lift", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Loop", "-", "lift", "ed", " ", "function", "s", " ", "can", "'", "t", " ", "be", " ", "cache", "d", " ", "and", " ", "raise", " ", "a", " ", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ",_", "Num", "ba", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "loop", "lift", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "4_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "w_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "w_", "[_", "0_", "]_", "._", "message_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cann", "ot", " ", "cache", " ", "compile", "d", " ", "function", " ", "\"", "loop", "lift", "ed", "\"", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "as", " ", "it", " ", "use", "s", " ", "lift", "ed", " ", "loop", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ctypes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Function", "s", " ", "usi", "ng", " ", "a", " ", "ctype", "s", " ", "point", "er", " ", "can", "'", "t", " ", "be", " ", "cache", "d", " ", "and", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ",_", "Num", "ba", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "use", "\\u", "c\\u", "sin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "0.0_", ")_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "w_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "Cann", "ot", " ", "cache", " ", "compile", "d", " ", "function", " ", "\"", "use", "\\u", "c\\u", "sin", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "w_", "[_", "0_", "]_", "._", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "closure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", "record_", "=_", "True_", ")_", "as_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ",_", "Num", "ba", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "mod_", "._", "clos", "ure", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "clos", "ure", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "3_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "w_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "'", "Cann", "ot", " ", "cache", " ", "compile", "d", " ", "function", " ", "\"", "clos", "ure", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "item_", "._", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "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", "cache", "\\u", "reuse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "add", "\\u", "usec", "ase_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "add", "\\u", "usec", "ase_", "(_", "2.5_", ",_", "3.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "add", "\\u", "obj", "mode", "\\u", "usec", "ase_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "outer", "\\u", "unca", "ched", "_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "outer_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "record", "\\u", "return_", "(_", "mod_", "._", "pack", "ed", "\\u", "arr_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "record", "\\u", "return_", "(_", "mod_", "._", "aligned", "\\u", "arr_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "generat", "ed", "\\u", "usec", "ase_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mti", "mes_", "=_", "self_", "._", "get", "\\u", "cache", "\\u", "mti", "mes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tw", "o", " ", "signa", "tures", " ", "compiled_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "mod_", "._", "add", "\\u", "usec", "ase_", ",_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "2_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "mod_", ",_", "mod", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod", "2_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "2.5_", ",_", "3.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "2_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod", "2_", "._", "add", "\\u", "obj", "mode", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "files", " ", "have", "n", "'", "t", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "get", "\\u", "cache", "\\u", "mti", "mes_", "(_", ")_", ",_", "mti", "mes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "\\u", "in", "\\u", "separate", "\\u", "process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "get", "\\u", "cache", "\\u", "mti", "mes_", "(_", ")_", ",_", "mti", "mes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cache", "\\u", "invalidate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "change", " ", "the", " ", "function", "s", "'", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "mod", "file_", ",_", "\"", "a", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"\\\\", "n", "Z", " ", "=", " ", "10", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "obj", "mode", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recom", "pile", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exp", "licit", " ", "call", " ", "to", " ", "recom", "pile", "()", " ", "shou", "ld", " ", "overwrit", "e", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "Z_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "recom", "pile", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fre", "shl", "y", " ", "recom", "pile", "d", " ", "version", " ", "is", " ", "re", "-", "used", " ", "from", " ", "other", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "same", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Function", " ", "with", " ", "the", " ", "same", " ", "names", " ", "shou", "ld", " ", "still", " ", "disambiguat", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "renamed", "\\u", "function", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "renamed", "\\u", "function", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "pyca", "che", "\\u", "fallback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "With", " ", "a", " ", "disable", "d", " ", "\\u\\u", "pyca", "che", "\\u\\u", ",", " ", "test", " ", "there", " ", "is", " ", "a", " ", "working", " ", "fall", "back", "\\", "10", ";", " ", " ", " ", " ", "(", "e", ".", "g", ".", " ", "on", " ", "the", " ", "user", "-", "wide", " ", "cache", " ", "dir", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "this", " ", "function", "'", "s", " ", "cache", " ", "files", " ", "at", " ", "the", " ", "end", ",", " ", "to", " ", "avoid", " ", "accum", "ulation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "acc", "ross", " ", "test", " ", "calls", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "shutil_", "._", "rmtree_", ",_", "f_", "._", "stats_", "._", "cache", "\\u", "path_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "cache", " ", "miss", " ", "sinc", "e", " ", "the", " ", "file", " ", "was", " ", "copie", "d", " ", "to", " ", "a", " ", "new", " ", "temp", " ", "location_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "re", "-", "use_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "2_", "=_", "self_", "._", "import", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "mod", "2_", "._", "add", "\\u", "usec", "ase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Precis", "e", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "hits_", "(_", "f_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "\\u\\u", "pyca", "che", "\\u\\u", " ", "is", " ", "empty", " ", "(", "other", "wis", "e", " ", "the", " ", "test", "'", "s", " ", "precondition", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", "n", "'", "t", " ", "be", " ", "met", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "pyca", "che_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "os_", "._", "name_", "==_", "\"", "nt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cann", "ot", " ", "easi", "ly", " ", "make", " ", "a", " ", "director", "y", " ", "read", "-", "only", " ", "on", " ", "Window", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "non", "\\u", "creat", "able", "\\u", "pyca", "che_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "it", " ", "impossible", " ", "to", " ", "create", " ", "the", " ", "\\u\\u", "pyca", "che", "\\u\\u", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "perms_", "=_", "os_", "._", "stat_", "(_", "self_", "._", "tempdir_", ")_", "._", "st", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "self_", "._", "tempdir_", ",_", "0o", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "os_", "._", "chmod_", ",_", "self_", "._", "tempdir_", ",_", "old", "\\u", "perms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "pyca", "che", "\\u", "fallback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cache_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "os_", "._", "name_", "==_", "\"", "nt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cann", "ot", " ", "easi", "ly", " ", "make", " ", "a", " ", "director", "y", " ", "read", "-", "only", " ", "on", " ", "Window", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "non", "\\u", "writ", "able", "\\u", "pyca", "che_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "it", " ", "impossible", " ", "to", " ", "write", " ", "to", " ", "the", " ", "\\u\\u", "pyca", "che", "\\u\\u", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyca", "che_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "'\\u", "\\u", "pyca", "che", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "pyca", "che_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "perms_", "=_", "os_", "._", "stat_", "(_", "pyca", "che_", ")_", "._", "st", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "pyca", "che_", ",_", "0o", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "os_", "._", "chmod_", ",_", "pyca", "che_", ",_", "old", "\\u", "perms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "pyca", "che", "\\u", "fallback_",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
datastax/python-driver/tests/integration/long/__init__.py
[ { "content": "# Copyright 2013-2016 DataStax, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\ntry:\n from ccmlib import common\nexcept ImportError as e:\n raise unittest.SkipTest('ccm is a dependency for integration tests:', e)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from ccmlib import common", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Data", "Sta", "x", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "cc", "mli", "b_", "import_", "common_", "\\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 ", " _", "raise_", "unittest_", "._", "Ski", "p", "Test_", "(_", "'", "cc", "m", " ", "is", " ", "a", " ", "dependen", "cy", " ", "for", " ", "integrati", "on", " ", "tests", ":'_", ",_", "e_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
hazelcast/hazelcast-python-client/examples/transaction.py
[ { "content": "import logging\n\nimport sys\nfrom os.path import dirname\n\nsys.path.append(dirname(dirname(__file__)))\nimport hazelcast\n\nif __name__ == '__main__':\n logging.basicConfig(format='%(asctime)s%(msecs)03d [%(name)s] %(levelname)s: %(message)s', datefmt=\"%H:%M%:%S,\")\n logging.getLogger().setLevel(logging.DEBUG)\n logger = logging.getLogger(\"main\")\n\n client = hazelcast.HazelcastClient()\n\n t = client.new_transaction()\n t.begin()\n try:\n map = t.get_map(\"test\")\n print(map)\n t.commit()\n except:\n logger.exception(\"Exception in transaction\")\n t.rollback()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "dirname_", "(_", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "haz", "el", "cast_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "format_", "=_", "'%", "(", "asc", "time", ")", "s", "%", "(", "msec", "s", ")", "03", "d", " ", "[", "%", "(", "name", ")", "s", "]", " ", "%", "(", "level", "name", ")", "s", ":", " ", "%", "(", "message", ")", "s", "'_", ",_", "datefmt_", "=_", "\"%", "H", ":", "%", "M", "%", ":", "%", "S", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "main", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "haz", "el", "cast_", "._", "Ha", "zel", "cast", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "client_", "._", "new", "\\u", "transaction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map_", "=_", "t_", "._", "get", "\\u", "map_", "(_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "commit_", "(_", ")_", "\\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_", "._", "exception_", "(_", "\"", "Except", "ion", " ", "in", " ", "transaction", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "rollback_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Comparison of identical values
billpmurphy/hask/hask/Data/List.py
[ { "content": "@sig(H[(Eq, \"a\")]/ [\"a\"] >> [[\"a\"]])\ndef group(xs):\n \"\"\"\n group :: Eq a => [a] -> [[a]]\n\n The group function takes a list and returns a list of lists such that the\n concatenation of the result is equal to the argument. Moreover, each\n sublist in the result contains only equal elements.\n It is a special case of groupBy, which allows the programmer to supply\n their own equality test.\n \"\"\"\n return groupBy(xs, (__==__))", "metadata": "root.group", "header": "['module', '___EOS___']", "index": 657 } ]
[ { "span": "__==__)", "start_line": 668, "start_column": 24, "end_line": 668, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "identical_", "values_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "sig_", "(_", "H_", "[_", "(_", "Eq_", ",_", "\"", "a", "\"_", ")_", "]_", "/_", "[_", "\"", "a", "\"_", "]_", ">>_", "[_", "[_", "\"", "a", "\"_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "group_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "group", " ", "::", " ", "Eq", " ", "a", " ", "=>", " ", "[", "a", "]", " ", "->", " ", "[[", "a", "]]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "group", " ", "function", " ", "take", "s", " ", "a", " ", "list", " ", "and", " ", "return", "s", " ", "a", " ", "list", " ", "of", " ", "lists", " ", "suc", "h", " ", "tha", "t", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "concate", "nati", "on", " ", "of", " ", "the", " ", "result", " ", "is", " ", "equal", " ", "to", " ", "the", " ", "argu", "ment", ".", " ", "Mor", "eo", "ver", ",", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "subli", "st", " ", "in", " ", "the", " ", "result", " ", "contain", "s", " ", "only", " ", "equal", " ", "element", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "a", " ", "special", " ", "case", " ", "of", " ", "group", "By", ",", " ", "whi", "ch", " ", "allow", "s", " ", "the", " ", "programme", "r", " ", "to", " ", "supply", "\\", "10", ";", " ", " ", " ", " ", "thei", "r", " ", "own", " ", "equality", " ", "test", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "group", "By_", "(_", "xs_", ",_", "(_", "\\u\\u_", "==_", "\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 0, 1, 1, 2, 2, 2 ]
Unused import
karesansui/karesansui/karesansui/gadget/hostby1staticrouteby1.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport web\nimport simplejson as json\n\n#import karesansui\nfrom karesansui.lib.rest import Rest, auth\nfrom karesansui.db.access.machine import findbyhost1\n\nfrom karesansui.lib.utils import preprint_r, base64_encode, base64_decode\n\nfrom karesansui.lib.conf import read_conf, write_conf\nfrom karesansui.lib.parser.staticroute import staticrouteParser as Parser\nfrom karesansui.lib.networkaddress import NetworkAddress\n\nfrom karesansui.gadget.hostby1staticroute import validates_staticroute\n\nfrom karesansui.lib.checker import *\n\n\nurls = (\n '/host/(\\d+)/staticroute/([a-zA-Z0-9\\=]{2,})/?(\\.html|\\.part|\\.json)?$', HostBy1StaticRouteBy1,\n\n )\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HostBy1StaticRouteBy1(Rest):\n", "metadata": "root.HostBy1StaticRouteBy1", "header": "['module', '___EOS___']", "index": 42 }, { "content": " @auth\n def _GET(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n b64name = param[1]\n if not (b64name and host_id):\n return web.badrequest()\n\n name = base64_decode(str(b64name))\n\n (target, device) = name.split(\"@\")\n\n net = NetworkAddress(target)\n ipaddr = net.ipaddr\n netmask = net.netmask\n netlen = net.netlen\n\n gateway = _('N/A')\n flags = _('N/A')\n ref = _('N/A')\n use = _('N/A')\n metric = _('N/A')\n\n parser = Parser()\n status = parser.do_status()\n for _k,_v in status.iteritems():\n for _k2,_v2 in _v.iteritems():\n if name == \"%s@%s\" % (_k2,_k,):\n gateway = _v2['gateway']\n flags = _v2['flags']\n ref = _v2['ref']\n use = _v2['use']\n metric = _v2['metric']\n\n route = dict(name=name,\n ipaddr=ipaddr,\n netmask=netmask,\n netlen=netlen,\n device=device,\n gateway=gateway,\n flags=flags,\n ref=ref,\n use=use,\n metric=metric,\n )\n\n self.view.route = route\n return True", "metadata": "root.HostBy1StaticRouteBy1._GET", "header": "['class', 'HostBy1StaticRouteBy1', '(', 'Rest', ')', ':', '___EOS___']", "index": 43 }, { "content": " @auth\n def _DELETE(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n \n b64name = param[1]\n if not (b64name and host_id):\n return web.badrequest()\n\n host = findbyhost1(self.orm, host_id)\n\n name = base64_decode(str(b64name))\n\n (target, device) = name.split(\"@\")\n\n net = NetworkAddress(target)\n ipaddr = net.ipaddr\n netmask = net.netmask\n netlen = net.netlen\n target = \"%s/%s\" % (ipaddr,netlen,)\n\n modules = [\"staticroute\"]\n\n dop = read_conf(modules, self, host)\n if dop is False:\n return web.internalerror('Internal Server Error. (Timeout)')\n\n dop.delete(\"staticroute\", [device,target])\n\n from karesansui.lib.parser.staticroute import PARSER_COMMAND_ROUTE\n if net.netlen == 32:\n command = \"%s del -host %s dev %s\" % (PARSER_COMMAND_ROUTE,ipaddr,device,)\n else:\n command = \"%s del -net %s netmask %s dev %s\" % (PARSER_COMMAND_ROUTE,ipaddr,netmask,device,)\n extra_args = {\"post-command\": command}\n\n retval = write_conf(dop, self, host, extra_args=extra_args)\n if retval is False:\n return web.internalerror('Internal Server Error. (Adding Task)')\n\n return web.accepted()", "metadata": "root.HostBy1StaticRouteBy1._DELETE", "header": "['class', 'HostBy1StaticRouteBy1', '(', 'Rest', ')', ':', '___EOS___']", "index": 93 } ]
[ { "span": "import simplejson as json", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 25 }, { "span": "from karesansui.lib.utils import preprint_r, base64_encode, base64_decode", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 73 }, { "span": "from karesansui.gadget.hostby1staticroute import validates_staticroute", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 70 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "kar", "esa", "nsu", "i_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "rest_", "import_", "Rest", "_", ",_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "find", "by", "host", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "prep", "rint", "\\u", "r_", ",_", "base64", "\\u", "encode_", ",_", "base64", "\\u", "decode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "conf_", "import_", "read", "\\u", "conf_", ",_", "write", "\\u", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "parser_", "._", "static", "route_", "import_", "static", "route", "Parser_", "as_", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "network", "address_", "import_", "Network", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "gadget", "_", "._", "host", "by", "1s", "tati", "cro", "ute", "_", "import_", "validates", "\\u", "static", "route_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "checker_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "urls_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "host", "/(", "\\\\", "d", "+)", "/", "static", "route", "/([", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\", "=", "]{", "2", ",}", ")/", "?(", "\\\\.", "html", "|\\\\", ".", "part", "|\\\\", ".", "json", ")?", "$'_", ",_", "Host", "By", "1", "Static", "Route", "By", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Host", "By", "1", "Static", "Route", "By", "1_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Host", "By", "1", "Static", "Route", "By", "1_", "(_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "b64", "name_", "=_", "param_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "b64", "name_", "and_", "host", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "base64", "\\u", "decode_", "(_", "str_", "(_", "b64", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "target_", ",_", "device_", ")_", "=_", "name_", "._", "split_", "(_", "\"@\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "net_", "=_", "Network", "Address_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipaddr_", "=_", "net_", "._", "ipaddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "netmask_", "=_", "net_", "._", "netmask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "len_", "=_", "net_", "._", "net", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "\\u_", "(_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "\\u_", "(_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "=_", "\\u_", "(_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use_", "=_", "\\u_", "(_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric_", "=_", "\\u_", "(_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "parser_", "._", "do", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "k_", ",_", "\\u", "v_", "in_", "status_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "k2_", ",_", "\\u", "v2_", "in_", "\\u", "v_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "\"%", "s", "@", "%", "s", "\"_", "%_", "(_", "\\u", "k2_", ",_", "\\u", "k_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gateway_", "=_", "\\u", "v2_", "[_", "'", "gateway", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "\\u", "v2_", "[_", "'", "flags", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "=_", "\\u", "v2_", "[_", "'", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use_", "=_", "\\u", "v2_", "[_", "'", "use", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric_", "=_", "\\u", "v2_", "[_", "'", "metric", "'_", "]_", "\\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_", "route_", "=_", "dict_", "(_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipaddr_", "=_", "ipaddr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "netmask_", "=_", "netmask_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "len_", "=_", "net", "len_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device_", "=_", "device_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "gateway_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use_", "=_", "use_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric_", "=_", "metric_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "route_", "=_", "route_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "By", "1", "Static", "Route", "By", "1_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "DELETE_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b64", "name_", "=_", "param_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "b64", "name_", "and_", "host", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "base64", "\\u", "decode_", "(_", "str_", "(_", "b64", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "target_", ",_", "device_", ")_", "=_", "name_", "._", "split_", "(_", "\"@\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "net_", "=_", "Network", "Address_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipaddr_", "=_", "net_", "._", "ipaddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "netmask_", "=_", "net_", "._", "netmask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "len_", "=_", "net_", "._", "net", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "ipaddr_", ",_", "net", "len_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modules_", "=_", "[_", "\"", "static", "route", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dop", "_", "=_", "read", "\\u", "conf_", "(_", "modules_", ",_", "self_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dop", "_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "internal", "error_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", ".", " ", "(", "Time", "out", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dop", "_", "._", "delete_", "(_", "\"", "static", "route", "\"_", ",_", "[_", "device_", ",_", "target_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "parser_", "._", "static", "route_", "import_", "PARSE", "R", "\\u", "COMMA", "ND", "\\u", "ROUTE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "net_", "._", "net", "len_", "==_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"%", "s", " ", "del", " ", "-", "host", " ", "%", "s", " ", "dev", " ", "%", "s", "\"_", "%_", "(_", "PARSE", "R", "\\u", "COMMA", "ND", "\\u", "ROUTE", "_", ",_", "ipaddr_", ",_", "device_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "\"%", "s", " ", "del", " ", "-", "net", " ", "%", "s", " ", "net", "mask", " ", "%", "s", " ", "dev", " ", "%", "s", "\"_", "%_", "(_", "PARSE", "R", "\\u", "COMMA", "ND", "\\u", "ROUTE", "_", ",_", "ipaddr_", ",_", "netmask_", ",_", "device_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "args_", "=_", "{_", "\"", "post", "-", "command", "\"_", ":_", "command_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retval_", "=_", "write", "\\u", "conf_", "(_", "dop", "_", ",_", "self_", ",_", "host_", ",_", "extra", "\\u", "args_", "=_", "extra", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retval_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "internal", "error_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", ".", " ", "(", "Add", "ing", " ", "Task", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "web_", "._", "accepted_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
harryliu/edwin/edwinAgent/common/database_tera.py
[ { "content": "def closeConnection_jdbc():\n logger = logging.getLogger(__name__)\n #global connection\n try:\n _ = threadVar.connection\n except:\n threadVar.connection = None\n\n if (threadVar.connection is not None) and (threadVar.connection.closed == False):\n threadVar.connection.close()\n logger.info(\"Disconnect tera database.\")\n threadVar.connection = None", "metadata": "root.closeConnection_jdbc", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def closeConnection_odbc():\n logger = logging.getLogger(__name__)\n #global connection\n try:\n _ = threadVar.connection\n except:\n threadVar.connection = None\n\n if (threadVar.connection is not None) and (threadVar.connection.connected):\n threadVar.connection.close()\n logger.info(\"Disconnect Teradata database.\")\n threadVar.connection = None", "metadata": "root.closeConnection_odbc", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def openConnection_jdbc():\n logger = logging.getLogger(__name__)\n #global connection\n try:\n _ = threadVar.connection\n except:\n threadVar.connection = None\n\n if threadVar.connection is None:\n logger.info('To get database Teradata connection')\n threadVar.connection = zxJDBC.connect(conf.tera_url_jdbc, conf.tera_uid_jdbc, conf.tera_pwd_jdbc, conf.tera_driver_jdbc)\n logger.info('Teradata connection: %s', (threadVar.connection,))\n return threadVar.connection", "metadata": "root.openConnection_jdbc", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def openConnection_odbc():\n logger = logging.getLogger(__name__)\n #global connection\n try:\n _ = threadVar.connection\n except:\n threadVar.connection = None\n\n if threadVar.connection is None:\n logger.info('To get database Teradata connection')\n threadVar.connection = pypyodbc.connect(conf.tera_url_odbc)\n logger.info('Teradata connection: %s', (threadVar.connection,))\n return threadVar.connection", "metadata": "root.openConnection_odbc", "header": "['module', '___EOS___']", "index": 62 } ]
[ { "span": "except:", "start_line": 24, "start_column": 4, "end_line": 24, "end_column": 11 }, { "span": "except:", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 11 }, { "span": "except:", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 11 }, { "span": "except:", "start_line": 67, "start_column": 4, "end_line": 67, "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_", "def_", "close", "Connect", "ion", "\\u", "jdbc", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "thread", "Var_", "._", "connection_", "\\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 ", " _", "thread", "Var_", "._", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "thread", "Var_", "._", "connection_", "is_", "not_", "None_", ")_", "and_", "(_", "thread", "Var_", "._", "connection_", "._", "closed_", "==_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thread", "Var_", "._", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Disconnect", " ", "tera", " ", "databa", "se", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "Var_", "._", "connection_", "=_", "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_", "close", "Connect", "ion", "\\u", "odb", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "thread", "Var_", "._", "connection_", "\\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 ", " _", "thread", "Var_", "._", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "thread", "Var_", "._", "connection_", "is_", "not_", "None_", ")_", "and_", "(_", "thread", "Var_", "._", "connection_", "._", "connected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thread", "Var_", "._", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Disconnect", " ", "Ter", "adat", "a", " ", "databa", "se", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "Var_", "._", "connection_", "=_", "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_", "open", "Connect", "ion", "\\u", "jdbc", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "thread", "Var_", "._", "connection_", "\\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 ", " _", "thread", "Var_", "._", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "thread", "Var_", "._", "connection_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "To", " ", "get", " ", "databa", "se", " ", "Ter", "adat", "a", " ", "connecti", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "Var_", "._", "connection_", "=_", "zx", "JD", "BC_", "._", "connect_", "(_", "conf_", "._", "tera", "\\u", "url", "\\u", "jdbc", "_", ",_", "conf_", "._", "tera", "\\u", "uid", "\\u", "jdbc", "_", ",_", "conf_", "._", "tera", "\\u", "pwd", "\\u", "jdbc", "_", ",_", "conf_", "._", "tera", "\\u", "driver", "\\u", "jdbc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Ter", "adat", "a", " ", "connecti", "on", ":", " ", "%", "s", "'_", ",_", "(_", "thread", "Var_", "._", "connection_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "thread", "Var_", "._", "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_", "def_", "open", "Connect", "ion", "\\u", "odb", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "thread", "Var_", "._", "connection_", "\\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 ", " _", "thread", "Var_", "._", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "thread", "Var_", "._", "connection_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "To", " ", "get", " ", "databa", "se", " ", "Ter", "adat", "a", " ", "connecti", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread", "Var_", "._", "connection_", "=_", "pypy", "odb", "c_", "._", "connect_", "(_", "conf_", "._", "tera", "\\u", "url", "\\u", "odb", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Ter", "adat", "a", " ", "connecti", "on", ":", " ", "%", "s", "'_", ",_", "(_", "thread", "Var_", "._", "connection_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "thread", "Var_", "._", "connection_", "\\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, 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, 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, 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 ]
Imprecise assert
bread-and-pepper/django-userena/userena/tests/tests_views.py
[ { "content": " def test_retry_activation_ask(self):\n \"\"\" Ask for a new activation link \"\"\"\n # First, register an account.\n userena_settings.USERENA_ACTIVATION_RETRY = True\n self.client.post(reverse('userena_signup'),\n data={'username': 'alice',\n 'email': '[email protected]',\n 'password1': 'swordfish',\n 'password2': 'swordfish',\n 'tos': 'on'})\n user = User.objects.get(email='[email protected]')\n user.date_joined = datetime.today() - timedelta(days=30)\n user.save()\n old_key = user.userena_signup.activation_key\n response = self.client.get(reverse('userena_activate_retry',\n kwargs={'activation_key': old_key}))\n\n # We must reload the object from database to get the new key\n user = User.objects.get(email='[email protected]')\n self.assertContains(response, \"Account re-activation succeeded\")\n\n self.assertNotEqual(old_key, user.userena_signup.activation_key)\n user = User.objects.get(email='[email protected]')\n self.assertTrue(not user.is_active)\n\n self.assertEqual(len(mail.outbox), 2)\n self.assertEqual(mail.outbox[1].to, ['[email protected]'])\n self.assertTrue(mail.outbox[1].body.find(\"activate your account \")>-1)\n\n response = self.client.get(reverse('userena_activate',\n kwargs={'activation_key': user.userena_signup.activation_key}))\n self.assertRedirects(response,\n reverse('userena_profile_detail', kwargs={'username': user.username}))\n\n user = User.objects.get(email='[email protected]')\n self.assertTrue(user.is_active)\n userena_settings.USERENA_ACTIVATION_RETRY = False", "metadata": "root.UserenaViewsTests.test_retry_activation_ask", "header": "['class', 'UserenaViewsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_signup_view_signout(self):\n \"\"\" Check that a newly signed user shouldn't be signed in. \"\"\"\n # User should be signed in\n self.assertTrue(self.client.login(username='john', password='blowfish'))\n # Post a new, valid signup\n response = self.client.post(reverse('userena_signup'),\n data={'username': 'alice',\n 'email': '[email protected]',\n 'password1': 'blueberry',\n 'password2': 'blueberry',\n 'tos': 'on'})\n\n # And should now be signed out\n self.assertFalse(len(self.client.session.keys()) > 0)", "metadata": "root.UserenaViewsTests.test_signup_view_signout", "header": "['class', 'UserenaViewsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 173 } ]
[ { "span": "self.assertTrue(mail.outbox[1].body.find(\"activate your account \")>-1)", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 78 }, { "span": "self.assertFalse(len(self.client.session.keys()) > 0)", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 61 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "User", "ena", "View", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "retr", "y", "\\u", "activation", "\\u", "ask_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "As", "k", " ", "for", " ", "a", " ", "new", " ", "activation", " ", "link", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "register", " ", "an", " ", "account", "._", "\\u\\u\\uNL\\u\\u\\u_", "user", "ena", "\\u", "settings_", "._", "USER", "EN", "A", "\\u", "ACTIVAT", "ION", "\\u", "RETRY", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "'", "user", "ena", "\\u", "signup", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "'", "user", "name", "'_", ":_", "'", "alic", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "alic", "e", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "1", "'_", ":_", "'", "sword", "fish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "2", "'_", ":_", "'", "sword", "fish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tos", "'_", ":_", "'", "on", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "'", "alic", "e", "@", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "date", "\\u", "joined_", "=_", "datetime_", "._", "today_", "(_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "key_", "=_", "user_", "._", "user", "ena", "\\u", "signup", "_", "._", "activation", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "user", "ena", "\\u", "activat", "e\\u", "retr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "activation", "\\u", "key", "'_", ":_", "old", "\\u", "key_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "must", " ", "relo", "ad", " ", "the", " ", "object", " ", "from", " ", "databa", "se", " ", "to", " ", "get", " ", "the", " ", "new", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "'", "alic", "e", "@", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "response_", ",_", "\"", "Account", " ", "re", "-", "activation", " ", "succe", "eded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "old", "\\u", "key_", ",_", "user_", "._", "user", "ena", "\\u", "signup", "_", "._", "activation", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "'", "alic", "e", "@", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "not_", "user_", "._", "is", "\\u", "active_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mail_", "._", "outbox_", "[_", "1_", "]_", "._", "to_", ",_", "[_", "'", "alic", "e", "@", "example", ".", "com", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mail_", "._", "outbox_", "[_", "1_", "]_", "._", "body_", "._", "find_", "(_", "\"", "activat", "e", " ", "your", " ", "account", " ", "\"_", ")_", ">_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "reverse_", "(_", "'", "user", "ena", "\\u", "activat", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "activation", "\\u", "key", "'_", ":_", "user_", "._", "user", "ena", "\\u", "signup", "_", "._", "activation", "\\u", "key_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Redirects_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "user", "ena", "\\u", "profile", "\\u", "deta", "il", "'_", ",_", "kwargs_", "=_", "{_", "'", "user", "name", "'_", ":_", "user_", "._", "username_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "'", "alic", "e", "@", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "user_", "._", "is", "\\u", "active_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "ena", "\\u", "settings_", "._", "USER", "EN", "A", "\\u", "ACTIVAT", "ION", "\\u", "RETRY", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "ena", "View", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "signup", "\\u", "view", "\\u", "signo", "ut_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "tha", "t", " ", "a", " ", "newl", "y", " ", "sign", "ed", " ", "user", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "sign", "ed", " ", "in", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", " ", "shou", "ld", " ", "be", " ", "sign", "ed", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "john", "'_", ",_", "password_", "=_", "'", "blow", "fish", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Post", " ", "a", " ", "new", ",", " ", "valid", " ", "signup", "_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "reverse_", "(_", "'", "user", "ena", "\\u", "signup", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "'", "user", "name", "'_", ":_", "'", "alic", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "alic", "e", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "1", "'_", ":_", "'", "blue", "berry", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "2", "'_", ":_", "'", "blue", "berry", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tos", "'_", ":_", "'", "on", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "shou", "ld", " ", "now", " ", "be", " ", "sign", "ed", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "len_", "(_", "self_", "._", "client_", "._", "session_", "._", "keys_", "(_", ")_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
bitxbay/BitXBay/electrum_main.py
[ { "content": "def main():\n global guiWindow\n parser = arg_parser()\n options, args = parser.parse_args()\n if options.portable and options.wallet_path is None:\n options.electrum_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')\n\n # config is an object passed to the various constructors (wallet, interface, gui)\n if is_android:\n config_options = {\n 'portable': True,\n 'verbose': True,\n 'gui': 'android',\n 'auto_cycle': True,\n }\n else:\n config_options = eval(str(options))\n for k, v in config_options.items():\n if v is None:\n config_options.pop(k)\n\n set_verbosity(config_options.get('verbose'))\n\n config = SimpleConfig(config_options)\n cmd = ''\n if len(args) == 0:\n url = None\n cmd = 'gui'\n elif len(args) == 1 and re.match('^bitcoin:', args[0]):\n url = args[0]\n cmd = 'gui'\n else:\n pass\n cmd = args[0]\n\n if cmd == 'gui':\n gui_name = 'stdio'#config.get('gui', 'classic')\n if gui_name in ['lite', 'classic']:\n gui_name = 'qt'\n try:\n gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui'])\n except ImportError:\n traceback.print_exc(file=sys.stdout)\n sys.exit()\n #sys.exit(\"Error: Unknown GUI: \" + gui_name )\n\n # network interface\n if not options.offline:\n network = Network(config)\n network.start()\n else:\n network = None\n\n guiWindow = gui = gui.ElectrumGui(config, network)\n gui.main(url)\n\n if network:\n network.stop()\n\n # we use daemon threads, their termination is enforced.\n # this sleep command gives them time to terminate cleanly.\n time.sleep(0.1)\n sys.exit(0)\n\n if cmd not in known_commands:\n cmd = 'help'\n\n cmd = known_commands[cmd]\n\n # instanciate wallet for command-line\n storage = WalletStorage(config)\n\n\n if cmd.name in ['create', 'restore']:\n if storage.file_exists:\n sys.exit(\"Error: Remove the existing wallet first!\")\n if options.password is not None:\n password = options.password\n elif cmd.name == 'restore' and options.mpk:\n password = None\n else:\n password = prompt_password(\"Password (hit return if you do not wish to encrypt your wallet):\")\n\n # if config.server is set, the user either passed the server on command line\n # or chose it previously already. if he didn't pass a server on the command line,\n # we just pick up a random one.\n if not config.get('server'):\n config.set_key('server', pick_random_server())\n\n #fee = options.tx_fee if options.tx_fee else raw_input(\"fee (default:%s):\" % (str(Decimal(wallet.fee)/100000000)))\n #gap = options.gap_limit if options.gap_limit else raw_input(\"gap limit (default 5):\")\n #if fee:\n # wallet.set_fee(float(fee)*100000000)\n #if gap:\n # wallet.change_gap_limit(int(gap))\n\n if cmd.name == 'restore':\n if options.mpk:\n wallet = Wallet.from_mpk(options.mpk, storage)\n else:\n import getpass\n seed = getpass.getpass(prompt=\"seed:\", stream=None) if options.concealed else raw_input(\"seed:\")\n wallet = Wallet.from_seed(str(seed),storage)\n if not wallet:\n sys.exit(\"Error: Invalid seed\")\n wallet.save_seed(password)\n\n if not options.offline:\n network = Network(config)\n network.start()\n wallet.start_threads(network)\n print_msg(\"Recovering wallet...\")\n wallet.restore(lambda x: x)\n if wallet.is_found():\n print_msg(\"Recovery successful\")\n else:\n print_msg(\"Warning: Found no history for this wallet\")\n else:\n wallet.synchronize()\n print_msg(\"Warning: This wallet was restored offline. It may contain more addresses than displayed.\")\n\n else:\n wallet = Wallet(storage)\n wallet.init_seed(None)\n wallet.save_seed(password)\n wallet.synchronize()\n print_msg(\"Your wallet generation seed is:\\n\\\"%s\\\"\" % wallet.get_mnemonic(password))\n print_msg(\"Please keep it in a safe place; if you lose it, you will not be able to restore your wallet.\")\n\n print_msg(\"Wallet saved in '%s'\" % wallet.storage.path)\n\n # terminate\n sys.exit(0)\n\n\n if cmd.name not in ['create', 'restore'] and cmd.requires_wallet and not storage.file_exists:\n print_msg(\"Error: Wallet file not found.\")\n print_msg(\"Type 'electrum create' to create a new wallet, or provide a path to a wallet with the -w option\")\n sys.exit(0)\n\n\n if cmd.requires_wallet:\n wallet = Wallet(storage)\n else:\n wallet = None\n\n\n # important warning\n if cmd.name in ['dumpprivkey', 'dumpprivkeys']:\n print_msg(\"WARNING: ALL your private keys are secret.\")\n print_msg(\"Exposing a single private key can compromise your entire wallet!\")\n print_msg(\"In particular, DO NOT use 'redeem private key' services proposed by third parties.\")\n\n # commands needing password\n if cmd.requires_password:\n if wallet.seed == '':\n seed = ''\n password = None\n elif wallet.use_encryption:\n password = prompt_password('Password:', False)\n if not password:\n print_msg(\"Error: Password required\")\n sys.exit(1)\n # check password\n try:\n seed = wallet.get_seed(password)\n except Exception:\n print_msg(\"Error: This password does not decode this wallet.\")\n sys.exit(1)\n else:\n password = None\n seed = wallet.get_seed(None)\n else:\n password = None\n\n # add missing arguments, do type conversions\n if cmd.name == 'importprivkey':\n # See if they specificed a key on the cmd line, if not prompt\n if len(args) == 1:\n args[1] = prompt_password('Enter PrivateKey (will not echo):', False)\n\n elif cmd.name == 'signrawtransaction':\n args = [cmd, args[1], json.loads(args[2]) if len(args) > 2 else [], json.loads(args[3]) if len(args) > 3 else []]\n\n elif cmd.name == 'createmultisig':\n args = [cmd, int(args[1]), json.loads(args[2])]\n\n elif cmd.name == 'createrawtransaction':\n args = [cmd, json.loads(args[1]), json.loads(args[2])]\n\n elif cmd.name == 'listaddresses':\n args = [cmd, options.show_all, options.show_labels]\n\n elif cmd.name in ['payto', 'mktx']:\n domain = [options.from_addr] if options.from_addr else None\n args = ['mktx', args[1], Decimal(args[2]), Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain]\n\n elif cmd.name in ['paytomany', 'mksendmanytx']:\n domain = [options.from_addr] if options.from_addr else None\n outputs = []\n for i in range(1, len(args), 2):\n if len(args) < i+2:\n print_msg(\"Error: Mismatched arguments.\")\n sys.exit(1)\n outputs.append((args[i], Decimal(args[i+1])))\n args = ['mksendmanytx', outputs, Decimal(options.tx_fee) if options.tx_fee else None, options.change_addr, domain]\n\n elif cmd.name == 'help':\n if len(args) < 2:\n print_help(parser)\n\n # check the number of arguments\n if len(args) - 1 < cmd.min_args:\n print_msg(\"Not enough arguments\")\n print_msg(\"Syntax:\", cmd.syntax)\n sys.exit(1)\n\n if cmd.max_args >= 0 and len(args) - 1 > cmd.max_args:\n print_msg(\"too many arguments\", args)\n print_msg(\"Syntax:\", cmd.syntax)\n sys.exit(1)\n\n if cmd.max_args < 0:\n if len(args) > cmd.min_args + 1:\n message = ' '.join(args[cmd.min_args:])\n print_msg(\"Warning: Final argument was reconstructed from several arguments:\", repr(message))\n args = args[0:cmd.min_args] + [message]\n\n\n\n # run the command\n if cmd.name == 'deseed':\n if not wallet.seed:\n print_msg(\"Error: This wallet has no seed\")\n else:\n ns = wallet.storage.path + '.seedless'\n print_msg(\"Warning: you are going to create a seedless wallet'\\nIt will be saved in '%s'\" % ns)\n if raw_input(\"Are you sure you want to continue? (y/n) \") in ['y', 'Y', 'yes']:\n wallet.storage.path = ns\n wallet.seed = ''\n wallet.storage.put('seed', '', True)\n wallet.use_encryption = False\n wallet.storage.put('use_encryption', wallet.use_encryption, True)\n for k in wallet.imported_keys.keys():\n wallet.imported_keys[k] = ''\n wallet.storage.put('imported_keys', wallet.imported_keys, True)\n print_msg(\"Done.\")\n else:\n print_msg(\"Action canceled.\")\n\n elif cmd.name == 'getconfig':\n key = args[1]\n out = config.get(key)\n print_msg(out)\n\n elif cmd.name == 'setconfig':\n key, value = args[1:3]\n try:\n value = ast.literal_eval(value)\n except:\n pass\n config.set_key(key, value, True)\n print_msg(True)\n\n elif cmd.name == 'password':\n new_password = prompt_password('New password:')\n wallet.update_password(password, new_password)\n\n else:\n run_command(cmd, password, args)\n\n\n time.sleep(0.1)\n sys.exit(0)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 135 } ]
[ { "span": "seed ", "start_line": 291, "start_column": 12, "end_line": 291, "end_column": 16 }, { "span": "seed ", "start_line": 300, "start_column": 16, "end_line": 300, "end_column": 20 }, { "span": "seed ", "start_line": 306, "start_column": 12, "end_line": 306, "end_column": 16 } ]
[]
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 ", " _", "global_", "gui", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "arg", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "portab", "le_", "and_", "options_", "._", "walle", "t", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "electr", "um", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "electr", "um", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "config", " ", "is", " ", "an", " ", "object", " ", "pass", "ed", " ", "to", " ", "the", " ", "vari", "ous", " ", "construct", "ors", " ", "(", "walle", "t", ",", " ", "interface", ",", " ", "gui", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "android", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "portab", "le", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verbo", "se", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gui", "'_", ":_", "'", "android", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auto", "\\u", "cycle", "'_", ":_", "True_", ",_", "\\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 ", " _", "config", "\\u", "options_", "=_", "eval_", "(_", "str_", "(_", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "config", "\\u", "options_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "options_", "._", "pop_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "verbosity_", "(_", "config", "\\u", "options_", "._", "get_", "(_", "'", "verbo", "se", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Simple", "Config_", "(_", "config", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "gui", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "1_", "and_", "re_", "._", "match_", "(_", "'", "^", "bitcoin", ":'_", ",_", "args_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "gui", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "==_", "'", "gui", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui", "\\u", "name_", "=_", "'", "std", "io", "'_", "#", "config", ".", "get", "('", "gui", "',", " ", "'", "classic", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gui", "\\u", "name_", "in_", "[_", "'", "lite", "'_", ",_", "'", "classic", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui", "\\u", "name_", "=_", "'", "qt", "'_", "\\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 ", " _", "gui_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "electr", "um", "\\u", "gui", ".'_", "+_", "gui", "\\u", "name_", ",_", "froml", "ist_", "=_", "[_", "'", "electr", "um", "\\u", "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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", "file_", "=_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sys", ".", "exit", "(\"", "Error", ":", " ", "Un", "know", "n", " ", "GU", "I", ":", " ", "\"", " ", "+", " ", "gui", "\\u", "name", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "network", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Network_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gui", "Window_", "=_", "gui_", "=_", "gui_", "._", "Elect", "rum", "Gui_", "(_", "config_", ",_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gui_", "._", "main_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "use", " ", "daemon", " ", "thread", "s", ",", " ", "thei", "r", " ", "termination", " ", "is", " ", "enforce", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "sleep", " ", "command", " ", "give", "s", " ", "them", " ", "time", " ", "to", " ", "terminate", " ", "clean", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "not_", "in_", "know", "n", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", "help", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "know", "n", "\\u", "commands_", "[_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instan", "ciat", "e", " ", "walle", "t", " ", "for", " ", "command", "-", "line_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "=_", "Wall", "et", "Storage_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cmd_", "._", "name_", "in_", "[_", "'", "create", "'_", ",_", "'", "restore", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "storage_", "._", "file", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "\"", "Error", ":", " ", "Remove", " ", "the", " ", "exist", "ing", " ", "walle", "t", " ", "first", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "password_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "options_", "._", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "restore", "'_", "and_", "options_", "._", "mp", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "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 ", " _", "password_", "=_", "prompt", "\\u", "password_", "(_", "\"", "Passw", "ord", " ", "(", "hit", " ", "return", " ", "if", " ", "you", " ", "do", " ", "not", " ", "wish", " ", "to", " ", "encrypt", " ", "your", " ", "walle", "t", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "config", ".", "server", " ", "is", " ", "set", ",", " ", "the", " ", "user", " ", "eit", "her", " ", "pass", "ed", " ", "the", " ", "server", " ", "on", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "chos", "e", " ", "it", " ", "previ", "ously", " ", "alr", "ead", "y", ".", " ", "if", " ", "he", " ", "did", "n", "'", "t", " ", "pass", " ", "a", " ", "server", " ", "on", " ", "the", " ", "command", " ", "line", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "just", " ", "pick", " ", "up", " ", "a", " ", "random", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "config_", "._", "get_", "(_", "'", "server", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "set\\u", "key_", "(_", "'", "server", "'_", ",_", "pick", "\\u", "random", "\\u", "server_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fe", "e", " ", "=", " ", "options", ".", "tx", "\\u", "fe", "e", " ", "if", " ", "options", ".", "tx", "\\u", "fe", "e", " ", "else", " ", "raw", "\\u", "input", "(\"", "fe", "e", " ", "(", "default", ":", "%", "s", "):", "\"", " ", "%", " ", "(", "str", "(", "Deci", "mal", "(", "walle", "t", ".", "fe", "e", ")/", "100000000", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gap", " ", "=", " ", "options", ".", "gap", "\\u", "limit", " ", "if", " ", "options", ".", "gap", "\\u", "limit", " ", "else", " ", "raw", "\\u", "input", "(\"", "gap", " ", "limit", " ", "(", "default", " ", "5", "):", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "fe", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "walle", "t", ".", "set\\u", "fe", "e", "(", "float", "(", "fe", "e", ")*", "100000000", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "gap", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "walle", "t", ".", "change", "\\u", "gap", "\\u", "limit", "(", "int", "(", "gap", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "restore", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "mp", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "._", "from", "\\u", "mp", "k_", "(_", "options_", "._", "mp", "k_", ",_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "getpass_", "._", "getpass_", "(_", "prompt_", "=_", "\"", "seed", ":\"_", ",_", "stream_", "=_", "None_", ")_", "if_", "options_", "._", "conce", "ale", "d_", "else_", "raw", "\\u", "input_", "(_", "\"", "seed", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "=_", "Wallet_", "._", "from", "\\u", "seed_", "(_", "str_", "(_", "seed_", ")_", ",_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "wallet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sys_", "._", "exit_", "(_", "\"", "Error", ":", " ", "Inva", "lid", " ", "seed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wallet_", "._", "save", "\\u", "seed_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "offline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Network_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "start", "\\u", "threads_", "(_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Recover", "ing", " ", "walle", "t", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "restore_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wallet_", "._", "is", "\\u", "found_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print", "\\u", "msg_", "(_", "\"", "Recover", "y", " ", "success", "ful", "\"_", ")_", "\\u\\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", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Foun", "d", " ", "no", " ", "histo", "ry", " ", "for", " ", "this", " ", "walle", "t", "\"_", ")_", "\\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 ", " _", "wallet_", "._", "synchronize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Thi", "s", " ", "walle", "t", " ", "was", " ", "restore", "d", " ", "offline", ".", " ", "It", " ", "may", " ", "contain", " ", "more", " ", "addresse", "s", " ", "than", " ", "displaye", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "init", "\\u", "seed_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "save", "\\u", "seed_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "synchronize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "You", "r", " ", "walle", "t", " ", "generat", "ion", " ", "seed", " ", "is", ":\\\\", "n", "\\\\\"", "%", "s", "\\\\\"\"_", "%_", "wallet_", "._", "get", "\\u", "mnemonic_", "(_", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Ple", "ase", " ", "keep", " ", "it", " ", "in", " ", "a", " ", "safe", " ", "place", ";", " ", "if", " ", "you", " ", "lose", " ", "it", ",", " ", "you", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "restore", " ", "your", " ", "walle", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Wall", "et", " ", "saved", " ", "in", " ", "'%", "s", "'\"_", "%_", "wallet_", "._", "storage_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "terminate_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\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_", "cmd_", "._", "name_", "not_", "in_", "[_", "'", "create", "'_", ",_", "'", "restore", "'_", "]_", "and_", "cmd_", "._", "require", "s", "\\u", "wallet_", "and_", "not_", "storage_", "._", "file", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Wall", "et", " ", "file", " ", "not", " ", "found", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Type", " ", "'", "electr", "um", " ", "create", "'", " ", "to", " ", "create", " ", "a", " ", "new", " ", "walle", "t", ",", " ", "or", " ", "provide", " ", "a", " ", "path", " ", "to", " ", "a", " ", "walle", "t", " ", "with", " ", "the", " ", "-", "w", " ", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\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_", "cmd_", "._", "require", "s", "\\u", "wallet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "Wallet_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "importa", "nt", " ", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "in_", "[_", "'", "dump", "priv", "key", "'_", ",_", "'", "dump", "priv", "keys", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "WARN", "ING", ":", " ", "ALL", " ", "your", " ", "private", " ", "keys", " ", "are", " ", "secret", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Expos", "ing", " ", "a", " ", "single", " ", "private", " ", "key", " ", "can", " ", "compr", "omi", "se", " ", "your", " ", "entire", " ", "walle", "t", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "In", " ", "partic", "ular", ",", " ", "DO", " ", "NOT", " ", "use", " ", "'", "rede", "em", " ", "private", " ", "key", "'", " ", "service", "s", " ", "proposed", " ", "by", " ", "third", " ", "parties", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "command", "s", " ", "need", "ing", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "require", "s", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "wallet_", "._", "seed_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seed_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "wallet_", "._", "use", "\\u", "encryption_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "prompt", "\\u", "password_", "(_", "'", "Passw", "ord", ":'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Passw", "ord", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "password_", "\\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 ", " _", "seed_", "=_", "wallet_", "._", "get", "\\u", "seed_", "(_", "password_", ")_", "\\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 ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Thi", "s", " ", "password", " ", "doe", "s", " ", "not", " ", "decode", " ", "this", " ", "walle", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\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 ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "wallet_", "._", "get", "\\u", "seed_", "(_", "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 ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "missi", "ng", " ", "argu", "ment", "s", ",", " ", "do", " ", "type", " ", "conversions", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "import", "priv", "key", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "the", "y", " ", "specific", "ed", " ", "a", " ", "key", " ", "on", " ", "the", " ", "cmd", " ", "line", ",", " ", "if", " ", "not", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "1_", "]_", "=_", "prompt", "\\u", "password_", "(_", "'", "Enter", " ", "Priva", "te", "Key", " ", "(", "will", " ", "not", " ", "echo", "):'_", ",_", "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_", "elif_", "cmd_", "._", "name_", "==_", "'", "sign", "rawt", "ransact", "ion", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "args_", "[_", "1_", "]_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "if_", "len_", "(_", "args_", ")_", ">_", "2_", "else_", "[_", "]_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "3_", "]_", ")_", "if_", "len_", "(_", "args_", ")_", ">_", "3_", "else_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "create", "multisi", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "int_", "(_", "args_", "[_", "1_", "]_", ")_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "create", "rawt", "ransact", "ion", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "1_", "]_", ")_", ",_", "json_", "._", "loads_", "(_", "args_", "[_", "2_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "lista", "ddress", "es", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "cmd_", ",_", "options_", "._", "show", "\\u", "all_", ",_", "options_", "._", "show", "\\u", "labels_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "in_", "[_", "'", "pay", "to", "'_", ",_", "'", "mkt", "x", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "[_", "options_", "._", "from", "\\u", "addr_", "]_", "if_", "options_", "._", "from", "\\u", "addr_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "'", "mkt", "x", "'_", ",_", "args_", "[_", "1_", "]_", ",_", "Decimal_", "(_", "args_", "[_", "2_", "]_", ")_", ",_", "Decimal_", "(_", "options_", "._", "tx", "\\u", "fee_", ")_", "if_", "options_", "._", "tx", "\\u", "fee_", "else_", "None_", ",_", "options_", "._", "change", "\\u", "addr_", ",_", "domain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "in_", "[_", "'", "pay", "toma", "ny", "'_", ",_", "'", "mks", "end", "many", "tx", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "[_", "options_", "._", "from", "\\u", "addr_", "]_", "if_", "options_", "._", "from", "\\u", "addr_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outputs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "args_", ")_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "<_", "i_", "+_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Mismatch", "ed", " ", "argu", "ment", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outputs_", "._", "append_", "(_", "(_", "args_", "[_", "i_", "]_", ",_", "Decimal_", "(_", "args_", "[_", "i_", "+_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "'", "mks", "end", "many", "tx", "'_", ",_", "outputs_", ",_", "Decimal_", "(_", "options_", "._", "tx", "\\u", "fee_", ")_", "if_", "options_", "._", "tx", "\\u", "fee_", "else_", "None_", ",_", "options_", "._", "change", "\\u", "addr_", ",_", "domain_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "help", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "number", " ", "of", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "-_", "1_", "<_", "cmd_", "._", "min", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Not", " ", "eno", "ugh", " ", "argu", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Syntax", ":\"_", ",_", "cmd_", "._", "syntax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "max", "\\u", "args_", ">=_", "0_", "and_", "len_", "(_", "args_", ")_", "-_", "1_", ">_", "cmd_", "._", "max", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Syntax", ":\"_", ",_", "cmd_", "._", "syntax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "max", "\\u", "args_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", ">_", "cmd_", "._", "min", "\\u", "args_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", " ", "'_", "._", "join_", "(_", "args_", "[_", "cmd_", "._", "min", "\\u", "args_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "Final", " ", "argu", "ment", " ", "was", " ", "reconstruct", "ed", " ", "from", " ", "sever", "al", " ", "argu", "ment", "s", ":\"_", ",_", "repr_", "(_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "[_", "0_", ":_", "cmd_", "._", "min", "\\u", "args_", "]_", "+_", "[_", "message_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "._", "name_", "==_", "'", "dese", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "wallet_", "._", "seed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "msg_", "(_", "\"", "Error", ":", " ", "Thi", "s", " ", "walle", "t", " ", "has", " ", "no", " ", "seed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "=_", "wallet_", "._", "storage_", "._", "path_", "+_", "'.", "seed", "less", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Warn", "ing", ":", " ", "you", " ", "are", " ", "goi", "ng", " ", "to", " ", "create", " ", "a", " ", "seed", "less", " ", "walle", "t", "'\\\\", "n", "It", " ", "will", " ", "be", " ", "saved", " ", "in", " ", "'%", "s", "'\"_", "%_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raw", "\\u", "input_", "(_", "\"", "Are", " ", "you", " ", "sure", " ", "you", " ", "want", " ", "to", " ", "continue", "?", " ", "(", "y", "/", "n", ")", " ", "\"_", ")_", "in_", "[_", "'", "y", "'_", ",_", "'", "Y", "'_", ",_", "'", "ye", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "._", "storage_", "._", "path_", "=_", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "seed_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "seed", "'_", ",_", "''_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "use", "\\u", "encryption_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "use", "\\u", "encrypt", "ion", "'_", ",_", "wallet_", "._", "use", "\\u", "encryption_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "wallet_", "._", "import", "ed", "\\u", "keys_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "wallet_", "._", "import", "ed", "\\u", "keys_", "[_", "k_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wallet_", "._", "storage_", "._", "put_", "(_", "'", "import", "ed", "\\u", "keys", "'_", ",_", "wallet_", "._", "import", "ed", "\\u", "keys_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "\"", "Don", "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 ", " _", "print", "\\u", "msg_", "(_", "\"", "Action", " ", "cancel", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "getcon", "fig", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "config_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "setc", "onfi", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "value_", "=_", "args_", "[_", "1_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "ast_", "._", "literal", "\\u", "eval_", "(_", "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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "set\\u", "key_", "(_", "key_", ",_", "value_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "msg_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "._", "name_", "==_", "'", "password", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "password_", "=_", "prompt", "\\u", "password_", "(_", "'", "New", " ", "password", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "update", "\\u", "password_", "(_", "password_", ",_", "new", "\\u", "password_", ")_", "\\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 ", " _", "run", "\\u", "command_", "(_", "cmd_", ",_", "password_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Comparison of constants
codelikeagirlcny/python-lessons-cny/code-exercises-etc/section_01_(basics)/data_types.py
[ { "content": "\n# Data types: int, float, bool, str\n\n# In Simple Math and Variable Assignment, we saw ints and floats in action.\n# Here's a quick refresher.\n\n# ints are whole numbers\nprint 5 + 2, 5 - 3, 5 * 5, 5 / 2 # 7, 2, 25, 2\n\n# floats are decimal numbers\nprint 5.4 + 2.1, 5.0 - 3, 5.7 * 5.2, 5 / 2.0 # 7.5, 2.0, 29.64, 2.5\n\n# boolean values store True or False (yes or no)\nprint 5 > 4 # True\nprint 3 + 3 <= 1 # False\n\n# Comparison Operators Sneak Peek\n# > greater than\n# < less than\n# >= greater than or equal to\n# <= less than or equal to\n# != not equal to\n# == is equal to\n\n# strings are covered in greater detail in Section 2\n# But essentially, they contain words, or really, anything you could type on a keyboard\nprint \"Yep, all those print statements you saw before? Those things between the quotes are strings! Yes, I'm a string, too. \"\n\nprint \"Python usually isn't too strict about data types, but there are some things you can't do.\"\n\n# Uncomment out the next line to get an error!\n#print \"This line here will cause an error, because you can't add strings to numbers. This is Lesson Section #\" + 1\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "5 > 4 ", "start_line": 13, "start_column": 6, "end_line": 13, "end_column": 11 }, { "span": "3 + 3 <= 1 ", "start_line": 14, "start_column": 6, "end_line": 14, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", " ", "types", ":", " ", "int", ",", " ", "float", ",", " ", "bool", ",", " ", "str_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "Simple", " ", "Math", " ", "and", " ", "Varia", "ble", " ", "Assign", "ment", ",", " ", "we", " ", "saw", " ", "ints", " ", "and", " ", "float", "s", " ", "in", " ", "action", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", "'", "s", " ", "a", " ", "quick", " ", "refreshe", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ints", " ", "are", " ", "whole", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "5_", "+_", "2_", ",_", "5_", "-_", "3_", ",_", "5_", "*_", "5_", ",_", "5_", "/_", "2_", "#", " ", "7", ",", " ", "2", ",", " ", "25", ",", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "float", "s", " ", "are", " ", "decima", "l", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "5.4", "_", "+_", "2.1_", ",_", "5.0_", "-_", "3_", ",_", "5.7", "_", "*_", "5.2", "_", ",_", "5_", "/_", "2.0_", "#", " ", "7.5", ",", " ", "2.0", ",", " ", "29.", "64", ",", " ", "2.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "boolean", " ", "values", " ", "store", " ", "Tru", "e", " ", "or", " ", "Fal", "se", " ", "(", "ye", "s", " ", "or", " ", "no", ")_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "5_", ">_", "4_", "#", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "3_", "+_", "3_", "<=_", "1_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compari", "son", " ", "Operators", " ", "Sn", "eak", " ", "Pe", "ek_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", ">", " ", " ", " ", " ", "great", "er", " ", "than_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "<", " ", " ", " ", " ", "less", " ", "than_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", ">=", " ", " ", " ", "great", "er", " ", "than", " ", "or", " ", "equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "<=", " ", " ", " ", "less", " ", "than", " ", "or", " ", "equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "!=", " ", " ", " ", "not", " ", "equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "==", " ", " ", " ", "is", " ", "equal", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "string", "s", " ", "are", " ", "covered", " ", "in", " ", "great", "er", " ", "deta", "il", " ", "in", " ", "Sect", "ion", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "t", " ", "essential", "ly", ",", " ", "the", "y", " ", "contain", " ", "words", ",", " ", "or", " ", "reall", "y", ",", " ", "anyt", "hing", " ", "you", " ", "coul", "d", " ", "type", " ", "on", " ", "a", " ", "keyboard_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Ye", "p", ",", " ", "all", " ", "tho", "se", " ", "print", " ", "statem", "ents", " ", "you", " ", "saw", " ", "bef", "ore", "?", " ", "Tho", "se", " ", "thing", "s", " ", "bet", "ween", " ", "the", " ", "quote", "s", " ", "are", " ", "string", "s", "!", " ", "Ye", "s", ",", " ", "I", "'", "m", " ", "a", " ", "string", ",", " ", "too", ".", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Pyth", "on", " ", "usual", "ly", " ", "isn", "'", "t", " ", "too", " ", "strict", " ", "abo", "ut", " ", "data", " ", "types", ",", " ", "but", " ", "there", " ", "are", " ", "some", " ", "thing", "s", " ", "you", " ", "can", "'", "t", " ", "do", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "out", " ", "the", " ", "next", " ", "line", " ", "to", " ", "get", " ", "an", " ", "error", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Thi", "s", " ", "line", " ", "here", " ", "will", " ", "caus", "e", " ", "an", " ", "error", ",", " ", "bec", "aus", "e", " ", "you", " ", "can", "'", "t", " ", "add", " ", "string", "s", " ", "to", " ", "numbers", ".", " ", "Thi", "s", " ", "is", " ", "Less", "on", " ", "Sect", "ion", " ", "#\"", " ", "+", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
yyuu/botornado/botornado/connection.py
[ { "content": "# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/\n# Copyright (c) 2010 Google\n# Copyright (c) 2008 rPath, Inc.\n# Copyright (c) 2009 The Echo Nest Corporation\n# Copyright (c) 2010, Eucalyptus Systems, Inc.\n# Copyright (c) 2011, Nexenta Systems Inc.\n# All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish, dis-\n# tribute, sublicense, and/or sell copies of the Software, and to permit\n# persons to whom the Software is furnished to do so, subject to the fol-\n# lowing conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-\n# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n# 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\n# IN THE SOFTWARE.\n\n#\n# Parts of this code were copied or derived from sample code supplied by AWS.\n# The following notice applies to that code.\n#\n# This software code is made available \"AS IS\" without warranties of any\n# kind. You may copy, display, modify and redistribute the software\n# code either by itself or as incorporated into your code; provided that\n# you do not remove any proprietary notices. Your use of this software\n# code is at your own risk and you waive any claim against Amazon\n# Digital Services, Inc. or its affiliates with respect to your use of\n# this software code. (c) 2006 Amazon Digital Services, Inc. or its\n# affiliates.\n\n\"\"\"\nHandles basic connections to AWS\n\"\"\"\n\nfrom __future__ import with_statement\nimport base64\nimport errno\nimport httplib\nimport os\nimport Queue\nimport random\nimport re\nimport socket\nimport sys\nimport time\nimport urllib, urlparse\nimport xml.sax\n\nimport boto.auth\nimport boto.auth_handler\nimport boto\nimport boto.utils\nimport boto.handler\nimport boto.cacerts\n\nfrom boto import config, UserAgent\nfrom boto.exception import AWSConnectionError, BotoClientError, BotoServerError\nfrom boto.provider import Provider\nfrom boto.resultset import ResultSet\n\nfrom boto.connection import *\nimport StringIO\nimport httplib\nimport mimetools\nimport tornado.httpclient\nimport tornado.httputil\n\n\n\n\n\n\n\n# vim:set ft=python sw=4 :\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AsyncHTTPConnection(object):\n \"\"\"\n a wrapper class to tornado.httpclient.AsyncHTTPClient\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AsyncHTTPConnection", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def __init__(self, host, port=None, strict=None, timeout=20.0, http_client=None, **kwargs):\n \"\"\"\n \"\"\"\n self.method = 'GET'\n self.host = host\n self.port = port\n self.path = '/'\n self.headers = []\n self.body = None\n self.timeout = timeout\n self.http_client = http_client if http_client else tornado.httpclient.AsyncHTTPClient(**kwargs)", "metadata": "root.AsyncHTTPConnection.__init__", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 81 }, { "content": " def __repr__(self):\n return '<AsyncHTTPConnection: %s>' % (repr(self.getrequest()))", "metadata": "root.AsyncHTTPConnection.__repr__", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 93 }, { "content": " def request(self, method, path, body=None, headers=None):\n self.path = path\n self.method = method\n if body is not None:\n if hasattr(body,'read'): # file-like object\n self.body = body.read()\n else:\n self.body = body if body else None\n if headers is not None:\n self.headers += [ (k, headers[k]) for k in headers ]", "metadata": "root.AsyncHTTPConnection.request", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def getrequest(self, scheme='http'):\n if self.port and (( scheme == 'http' and self.port != 80 ) or ( scheme == 'https' and self.port != 443 )):\n host = \"%s:%d\" % (self.host, self.port)\n else:\n host = self.host\n url = urlparse.urlunsplit((scheme, host, self.path, '', ''))\n headers = tornado.httputil.HTTPHeaders()\n for (k,v) in self.headers:\n headers.add(k, v)\n request = tornado.httpclient.HTTPRequest(\n url, method=self.method, headers=headers, body=self.body,\n connect_timeout=self.timeout, request_timeout=self.timeout,\n validate_cert=False, # FIXME: disable validation since we could not validate S3 certs\n )\n return request", "metadata": "root.AsyncHTTPConnection.getrequest", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def getresponse(self, callback=None):\n def fetched(tornado_response):\n if callable(callback):\n callback(AsyncHTTPResponse(tornado_response))\n self.http_client.fetch(self.getrequest(), callback=fetched)", "metadata": "root.AsyncHTTPConnection.getresponse", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " def set_debuglevel(self, level):\n pass", "metadata": "root.AsyncHTTPConnection.set_debuglevel", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def connect(self):\n pass", "metadata": "root.AsyncHTTPConnection.connect", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": " def close(self):\n pass", "metadata": "root.AsyncHTTPConnection.close", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": " def putrequest(self, method, path, **kwargs):\n self.method = method\n self.path = path", "metadata": "root.AsyncHTTPConnection.putrequest", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 138 }, { "content": " def putheader(self, header, argument):\n self.headers.append((header, argument))", "metadata": "root.AsyncHTTPConnection.putheader", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def endheaders(self):\n pass", "metadata": "root.AsyncHTTPConnection.endheaders", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 145 }, { "content": " def send(self, data):\n if self.body is not None and data:\n self.body += data\n else:\n self.body = data if data else None", "metadata": "root.AsyncHTTPConnection.send", "header": "['class', 'AsyncHTTPConnection', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": "class AsyncHTTPSConnection(AsyncHTTPConnection):", "metadata": "root.AsyncHTTPSConnection", "header": "['module', '___EOS___']", "index": 154 }, { "content": " def getrequest(self, scheme='https'):\n return AsyncHTTPConnection.getrequest(self, scheme=scheme)", "metadata": "root.AsyncHTTPSConnection.getrequest", "header": "['class', 'AsyncHTTPSConnection', '(', 'AsyncHTTPConnection', ')', ':', '___EOS___']", "index": 155 }, { "content": "class AsyncHTTPResponse(object):\n \"\"\"\n a wrapper class to tornado.httpclient.HTTPResponse\n \"\"\"\n\n\n\n\n\n msg = property(_get_msg)", "metadata": "root.AsyncHTTPResponse", "header": "['module', '___EOS___']", "index": 158 }, { "content": " def __init__(self, tornado_response):\n self.response = tornado_response\n self._msg = None\n self.version = 10\n self.status = self.response.code\n self.reason = self.response.error.message if self.response.error else ''", "metadata": "root.AsyncHTTPResponse.__init__", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def __repr__(self):\n return '<AsyncHTTPResponse: %s>' % (repr(self.response))", "metadata": "root.AsyncHTTPResponse.__repr__", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 169 }, { "content": " def read(self, amt=None):\n return self.response.body", "metadata": "root.AsyncHTTPResponse.read", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 172 }, { "content": " def getheader(self, name, default=None):\n return self.response.headers.get(name, default)", "metadata": "root.AsyncHTTPResponse.getheader", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def getheaders(self):\n return map(lambda (k,v): (k,v), self.response.headers.get_all())", "metadata": "root.AsyncHTTPResponse.getheaders", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 178 }, { "content": " def _get_msg(self):\n if self._msg is None:\n fp = StringIO.StringIO(\"\\r\\n\".join(map(lambda (k,v): \"%s: %s\" % (k,v), self.response.headers.get_all())))\n self._msg = mimetools.Message(fp)\n return self._msg", "metadata": "root.AsyncHTTPResponse._get_msg", "header": "['class', 'AsyncHTTPResponse', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": "class AsyncConnection(object):\n\n", "metadata": "root.AsyncConnection", "header": "['module', '___EOS___']", "index": 188 }, { "content": " def __init__(self, http_client=None, **kwargs):\n self._httpclient = http_client if http_client else tornado.httpclient.AsyncHTTPClient(**kwargs)", "metadata": "root.AsyncConnection.__init__", "header": "['class', 'AsyncConnection', '(', 'object', ')', ':', '___EOS___']", "index": 189 }, { "content": " def get_http_connection(self, host, is_secure):\n \"\"\"\n Gets a connection from the pool for the named host. Returns\n None if there is no connection that can be reused.\n \"\"\"\n if is_secure:\n return AsyncHTTPSConnection(host, http_client=self._httpclient)\n else:\n return AsyncHTTPConnection(host, http_client=self._httpclient)", "metadata": "root.AsyncConnection.get_http_connection", "header": "['class', 'AsyncConnection', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def _mexe(self, request, sender=None, callback=None):\n boto.log.debug('Method: %s' % request.method)\n boto.log.debug('Path: %s' % request.path)\n boto.log.debug('Data: %s' % request.body)\n boto.log.debug('Headers: %s' % request.headers)\n boto.log.debug('Host: %s' % request.host)\n\n connection = self.get_http_connection(request.host, self.is_secure)\n request.authorize(connection=self)\n\n if callable(sender):\n sender(connection, request.method, request.path,\n request.body, request.headers, callback)\n else:\n connection.request(request.method, request.path, request.body,\n request.headers)\n connection.getresponse(callback=callback)", "metadata": "root.AsyncConnection._mexe", "header": "['class', 'AsyncConnection', '(', 'object', ')', ':', '___EOS___']", "index": 202 }, { "content": "class AsyncAWSAuthConnection(AsyncConnection, boto.connection.AWSAuthConnection):\n", "metadata": "root.AsyncAWSAuthConnection", "header": "['module', '___EOS___']", "index": 220 }, { "content": " def __init__(self, host, http_client=None, http_client_params={}, **kwargs):\n AsyncConnection.__init__(self, http_client=http_client, **http_client_params)\n boto.connection.AWSAuthConnection.__init__(self, host, **kwargs)", "metadata": "root.AsyncAWSAuthConnection.__init__", "header": "['class', 'AsyncAWSAuthConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSAuthConnection', ')', ':', '___EOS___']", "index": 221 }, { "content": " def make_request(self, method, path, headers=None, data='', host=None, auth_path=None, sender=None, callback=None, **kwargs):\n request = self.build_base_http_request(method, path, auth_path,\n {}, headers, data, host)\n self._mexe(request, sender=sender, callback=callback)", "metadata": "root.AsyncAWSAuthConnection.make_request", "header": "['class', 'AsyncAWSAuthConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSAuthConnection', ')', ':', '___EOS___']", "index": 225 }, { "content": "class AsyncAWSQueryConnection(AsyncConnection, boto.connection.AWSQueryConnection):\n\n\n\n", "metadata": "root.AsyncAWSQueryConnection", "header": "['module', '___EOS___']", "index": 230 }, { "content": " def __init__(self, http_client=None, http_client_params={}, **kwargs):\n AsyncConnection.__init__(self, http_client=http_client, **http_client_params)\n boto.connection.AWSQueryConnection.__init__(self, **kwargs)", "metadata": "root.AsyncAWSQueryConnection.__init__", "header": "['class', 'AsyncAWSQueryConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSQueryConnection', ')', ':', '___EOS___']", "index": 231 }, { "content": " def make_request(self, action, params, path, verb, callback=None):\n request = self.build_base_http_request(verb, path, None,\n params, {}, '', self.server_name())\n if action:\n request.params['Action'] = action\n request.params['Version'] = self.APIVersion\n self._mexe(request, callback=callback)", "metadata": "root.AsyncAWSQueryConnection.make_request", "header": "['class', 'AsyncAWSQueryConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSQueryConnection', ')', ':', '___EOS___']", "index": 235 }, { "content": " def get_list(self, action, params, markers, path='/',\n parent=None, verb='GET', callback=None):\n if not parent:\n parent = self\n def list_got(response):\n body = response.read()\n boto.log.debug(body)\n if not body:\n boto.log.error('Null body %s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n elif response.status == 200:\n rs = ResultSet(markers)\n h = boto.handler.XmlHandler(rs, parent)\n xml.sax.parseString(body, h)\n if callable(callback):\n callback(rs)\n else:\n boto.log.error('%s %s' % (response.status, response.reason))\n boto.log.error('%s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n self.make_request(action, params, path, verb, callback=list_got)", "metadata": "root.AsyncAWSQueryConnection.get_list", "header": "['class', 'AsyncAWSQueryConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSQueryConnection', ')', ':', '___EOS___']", "index": 243 }, { "content": " def get_object(self, action, params, cls, path='/',\n parent=None, verb='GET', callback=None):\n if not parent:\n parent = self\n def object_got(response):\n body = response.read()\n boto.log.debug(body)\n if not body:\n boto.log.error('Null body %s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n elif response.status == 200:\n obj = cls(parent)\n h = boto.handler.XmlHandler(obj, parent)\n xml.sax.parseString(body, h)\n if callable(callback):\n callback(obj)\n else:\n boto.log.error('%s %s' % (response.status, response.reason))\n boto.log.error('%s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n self.make_request(action, params, path, verb, callback=object_got)", "metadata": "root.AsyncAWSQueryConnection.get_object", "header": "['class', 'AsyncAWSQueryConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSQueryConnection', ')', ':', '___EOS___']", "index": 265 }, { "content": " def get_status(self, action, params, path='/', parent=None, verb='GET', callback=None):\n if not parent:\n parent = self\n def status_got(response):\n body = response.read()\n boto.log.debug(body)\n if not body:\n boto.log.error('Null body %s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n elif response.status == 200:\n rs = ResultSet()\n h = boto.handler.XmlHandler(rs, parent)\n xml.sax.parseString(body, h)\n if callable(callback):\n callback(rs.status)\n else:\n boto.log.error('%s %s' % (response.status, response.reason))\n boto.log.error('%s' % body)\n raise self.ResponseError(response.status, response.reason, body)\n self.make_request(action, params, path, verb, callback=status_got)", "metadata": "root.AsyncAWSQueryConnection.get_status", "header": "['class', 'AsyncAWSQueryConnection', '(', 'AsyncConnection', ',', 'boto', '.', 'connection', '.', 'AWSQueryConnection', ')', ':', '___EOS___']", "index": 287 } ]
[ { "span": "import base64", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 13 }, { "span": "import errno", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 12 }, { "span": "import httplib", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 14 }, { "span": "import os", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 9 }, { "span": "import Queue", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 12 }, { "span": "import random", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 13 }, { "span": "import re", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 9 }, { "span": "import socket", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 13 }, { "span": "import sys", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 10 }, { "span": "import time", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 11 }, { "span": "import urllib, urlparse", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 23 }, { "span": "from boto import config, UserAgent", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 34 }, { "span": "from boto.exception import AWSConnectionError, BotoClientError, BotoServerError", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 79 }, { "span": "from boto.provider import Provider", "start_line": 67, "start_column": 0, "end_line": 67, "end_column": 34 }, { "span": "import httplib", "start_line": 72, "start_column": 0, "end_line": 72, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2010", " ", "Mit", "ch", " ", "Gar", "naa", "t", " ", "http", "://", "gar", "naa", "t", ".", "org", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Goo", "gle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2008", " ", "r", "Path", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", " ", "The", " ", "Ech", "o", " ", "Nest", " ", "Cor", "porat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", ",", " ", "Euc", "aly", "ptu", "s", " ", "System", "s", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2011", ",", " ", "Ne", "xen", "ta", " ", "System", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "dis", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tribut", "e", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "fol", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "low", "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", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "IL", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IT", "Y", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Part", "s", " ", "of", " ", "this", " ", "code", " ", "wer", "e", " ", "copie", "d", " ", "or", " ", "derive", "d", " ", "from", " ", "sample", " ", "code", " ", "supplie", "d", " ", "by", " ", "AW", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "follow", "ing", " ", "notice", " ", "appli", "es", " ", "to", " ", "tha", "t", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Thi", "s", " ", "software", " ", "code", " ", "is", " ", "made", " ", "avail", "able", " ", "\"", "AS", " ", "IS", "\"", " ", "with", "out", " ", "warr", "anti", "es", " ", "of", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "kind", ".", " ", " ", "You", " ", "may", " ", "copy", ",", " ", "display", ",", " ", "modif", "y", " ", "and", " ", "redis", "tribut", "e", " ", "the", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "code", " ", "eit", "her", " ", "by", " ", "its", "elf", " ", "or", " ", "as", " ", "inco", "rpor", "ated", " ", "int", "o", " ", "your", " ", "code", ";", " ", "provided", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "you", " ", "do", " ", "not", " ", "remove", " ", "any", " ", "prop", "rie", "tar", "y", " ", "notice", "s", ".", " ", " ", "You", "r", " ", "use", " ", "of", " ", "this", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "code", " ", "is", " ", "at", " ", "your", " ", "own", " ", "risk", " ", "and", " ", "you", " ", "wai", "ve", " ", "any", " ", "claim", " ", "against", " ", "Ama", "zon", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Digit", "al", " ", "Service", "s", ",", " ", "Inc", ".", " ", "or", " ", "its", " ", "affi", "liat", "es", " ", "with", " ", "respec", "t", " ", "to", " ", "your", " ", "use", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "this", " ", "software", " ", "code", ".", " ", "(", "c", ")", " ", "2006", " ", "Ama", "zon", " ", "Digit", "al", " ", "Service", "s", ",", " ", "Inc", ".", " ", "or", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "affi", "liat", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Handle", "s", " ", "basic", " ", "connections", " ", "to", " ", "AW", "S", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "sax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto_", "._", "auth", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto_", "._", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto_", "._", "cacert", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "boto_", "import_", "config_", ",_", "User", "Agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "exception_", "import_", "AW", "SC", "onnect", "ion", "Error_", ",_", "Bot", "o", "Client", "Error_", ",_", "Bot", "o", "Server", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "provider_", "import_", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "results", "et_", "import_", "Result", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "boto_", "._", "connection_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mime", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tornado_", "._", "httpc", "lient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tornado_", "._", "http", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "ft", "=", "python", " ", "sw", "=", "4", " ", ":_", "\\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_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "wrapp", "er", " ", "class", " ", "to", " ", "torn", "ado", ".", "httpc", "lien", "t", ".", "Async", "HTTP", "Client", "\\", "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_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", ",_", "port_", "=_", "None_", ",_", "strict_", "=_", "None_", ",_", "timeout_", "=_", "20.0_", ",_", "http", "\\u", "client_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method_", "=_", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "client_", "=_", "http", "\\u", "client_", "if_", "http", "\\u", "client_", "else_", "tornado_", "._", "httpc", "lient_", "._", "Async", "HTTP", "Client_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "Async", "HTTP", "Connect", "ion", ":", " ", "%", "s", ">'_", "%_", "(_", "repr_", "(_", "self_", "._", "getre", "quest_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "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_", "=_", "None_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "body_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "body_", ",_", "'", "read", "'_", ")_", ":_", "#", " ", "file", "-", "like", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "=_", "body_", "._", "read_", "(_", ")_", "\\u\\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_", "._", "body_", "=_", "body_", "if_", "body_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "headers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "headers_", "+=_", "[_", "(_", "k_", ",_", "headers_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "headers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "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_", "getre", "quest_", "(_", "self_", ",_", "scheme_", "=_", "'", "http", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "port_", "and_", "(_", "(_", "scheme_", "==_", "'", "http", "'_", "and_", "self_", "._", "port_", "!=_", "80_", ")_", "or_", "(_", "scheme_", "==_", "'", "https", "'_", "and_", "self_", "._", "port_", "!=_", "443_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "\"%", "s", ":", "%", "d", "\"_", "%_", "(_", "self_", "._", "host_", ",_", "self_", "._", "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 ", " _", "host_", "=_", "self_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "urlparse_", "._", "urlu", "nsp", "lit_", "(_", "(_", "scheme_", ",_", "host_", ",_", "self_", "._", "path_", ",_", "''_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "tornado_", "._", "http", "util_", "._", "HTTP", "Headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "self_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "._", "add_", "(_", "k_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ",_", "method_", "=_", "self_", "._", "method_", ",_", "headers_", "=_", "headers_", ",_", "body_", "=_", "self_", "._", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "connect", "\\u", "timeout_", "=_", "self_", "._", "timeout_", ",_", "request", "\\u", "timeout_", "=_", "self_", "._", "timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validat", "e\\u", "cert_", "=_", "False_", ",_", "#", " ", "FIX", "ME", ":", " ", "disable", " ", "validation", " ", "sinc", "e", " ", "we", " ", "coul", "d", " ", "not", " ", "validat", "e", " ", "S", "3", " ", "certs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getresponse_", "(_", "self_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fetched", "_", "(_", "torn", "ado", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callable_", "(_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "Async", "HTTP", "Response_", "(_", "torn", "ado", "\\u", "response_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "http", "\\u", "client_", "._", "fetch_", "(_", "self_", "._", "getre", "quest_", "(_", ")_", ",_", "callback_", "=_", "fetched", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "debugl", "evel_", "(_", "self_", ",_", "level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "request_", "(_", "self_", ",_", "method_", ",_", "path_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "header_", "(_", "self_", ",_", "header_", ",_", "argument_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "headers_", "._", "append_", "(_", "(_", "header_", ",_", "argument_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "end", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "body_", "is_", "not_", "None_", "and_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "+=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "=_", "data_", "if_", "data_", "else_", "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_", "Async", "HTTP", "SC", "onnect", "ion_", "(_", "Async", "HTTP", "Connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "SC", "onnect", "ion_", "(_", "Async", "HTTP", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "getre", "quest_", "(_", "self_", ",_", "scheme_", "=_", "'", "https", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Async", "HTTP", "Connection_", "._", "getre", "quest_", "(_", "self_", ",_", "scheme_", "=_", "scheme_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "wrapp", "er", " ", "class", " ", "to", " ", "torn", "ado", ".", "httpc", "lien", "t", ".", "HTTP", "Respons", "e", "\\", "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\\uDEDENT\\u\\u\\u_", "msg_", "=_", "property_", "(_", "\\u", "get", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "torn", "ado", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "=_", "torn", "ado", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "self_", "._", "response_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reason_", "=_", "self_", "._", "response_", "._", "error_", "._", "message_", "if_", "self_", "._", "response_", "._", "error_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "Async", "HTTP", "Respons", "e", ":", " ", "%", "s", ">'_", "%_", "(_", "repr_", "(_", "self_", "._", "response_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "amt_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getheader_", "(_", "self_", ",_", "name_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response_", "._", "headers_", "._", "get_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "geth", "eader", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "map_", "(_", "lambda_", "(_", "k_", ",_", "v_", ")_", ":_", "(_", "k_", ",_", "v_", ")_", ",_", "self_", "._", "response_", "._", "headers_", "._", "get", "\\u", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "HTTP", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "msg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "msg_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", "._", "join_", "(_", "map_", "(_", "lambda_", "(_", "k_", ",_", "v_", ")_", ":_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "k_", ",_", "v_", ")_", ",_", "self_", "._", "response_", "._", "headers_", "._", "get", "\\u", "all_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg_", "=_", "mime", "tools_", "._", "Message_", "(_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\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_", "class_", "Async", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Async", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "http", "\\u", "client_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "httpc", "lient_", "=_", "http", "\\u", "client_", "if_", "http", "\\u", "client_", "else_", "tornado_", "._", "httpc", "lient_", "._", "Async", "HTTP", "Client_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "http", "\\u", "connection_", "(_", "self_", ",_", "host_", ",_", "is", "\\u", "secure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "a", " ", "connecti", "on", " ", "from", " ", "the", " ", "pool", " ", "for", " ", "the", " ", "named", " ", "host", ".", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "if", " ", "there", " ", "is", " ", "no", " ", "connecti", "on", " ", "tha", "t", " ", "can", " ", "be", " ", "reus", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "secure_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Async", "HTTP", "SC", "onnect", "ion_", "(_", "host_", ",_", "http", "\\u", "client_", "=_", "self_", "._", "\\u", "httpc", "lient_", ")_", "\\u\\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_", "Async", "HTTP", "Connection_", "(_", "host_", ",_", "http", "\\u", "client_", "=_", "self_", "._", "\\u", "httpc", "lient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Connection_", "(_", "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", "me", "xe_", "(_", "self_", ",_", "request_", ",_", "sender_", "=_", "None_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boto_", "._", "log_", "._", "debug_", "(_", "'", "Meth", "od", ":", " ", "%", "s", "'_", "%_", "request_", "._", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "'", "Path", ":", " ", "%", "s", "'_", "%_", "request_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "'", "Data", ":", " ", "%", "s", "'_", "%_", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "'", "Head", "ers", ":", " ", "%", "s", "'_", "%_", "request_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "'", "Host", ":", " ", "%", "s", "'_", "%_", "request_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "=_", "self_", "._", "get", "\\u", "http", "\\u", "connection_", "(_", "request_", "._", "host_", ",_", "self_", "._", "is", "\\u", "secure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "authorize_", "(_", "connection_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "callable_", "(_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sender_", "(_", "connection_", ",_", "request_", "._", "method_", ",_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "body_", ",_", "request_", "._", "headers_", ",_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "._", "request_", "(_", "request_", "._", "method_", ",_", "request_", "._", "path_", ",_", "request_", "._", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "getresponse_", "(_", "callback_", "=_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Async", "AW", "SA", "uth", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SA", "uth", "Connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SA", "uth", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SA", "uth", "Connection_", ")_", ":_", "\\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_", ",_", "host_", ",_", "http", "\\u", "client_", "=_", "None_", ",_", "http", "\\u", "client", "\\u", "params_", "=_", "{_", "}_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Async", "Connection_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "http", "\\u", "client_", "=_", "http", "\\u", "client_", ",_", "**_", "http", "\\u", "client", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "connection_", "._", "AW", "SA", "uth", "Connection_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SA", "uth", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SA", "uth", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "request_", "(_", "self_", ",_", "method_", ",_", "path_", ",_", "headers_", "=_", "None_", ",_", "data_", "=_", "''_", ",_", "host_", "=_", "None_", ",_", "auth", "\\u", "path_", "=_", "None_", ",_", "sender_", "=_", "None_", ",_", "callback_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "build", "\\u", "base", "\\u", "http", "\\u", "request_", "(_", "method_", ",_", "path_", ",_", "auth", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "}_", ",_", "headers_", ",_", "data_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "me", "xe_", "(_", "request_", ",_", "sender_", "=_", "sender_", ",_", "callback_", "=_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\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_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\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_", ",_", "http", "\\u", "client_", "=_", "None_", ",_", "http", "\\u", "client", "\\u", "params_", "=_", "{_", "}_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Async", "Connection_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "http", "\\u", "client_", "=_", "http", "\\u", "client_", ",_", "**_", "http", "\\u", "client", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "request_", "(_", "self_", ",_", "action_", ",_", "params_", ",_", "path_", ",_", "verb_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "build", "\\u", "base", "\\u", "http", "\\u", "request_", "(_", "verb_", ",_", "path_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "{_", "}_", ",_", "''_", ",_", "self_", "._", "server", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "params_", "[_", "'", "Action", "'_", "]_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "params_", "[_", "'", "Version", "'_", "]_", "=_", "self_", "._", "API", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "me", "xe_", "(_", "request_", ",_", "callback_", "=_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "list_", "(_", "self_", ",_", "action_", ",_", "params_", ",_", "markers_", ",_", "path_", "=_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "None_", ",_", "verb_", "=_", "'", "GET", "'_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "got_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'", "Null", " ", "body", " ", "%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "status_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs_", "=_", "Result", "Set_", "(_", "markers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "boto_", "._", "handler_", "._", "Xm", "l", "Handler_", "(_", "rs_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "._", "sax_", "._", "parse", "String_", "(_", "body_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "callback_", "(_", "rs_", ")_", "\\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 ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "make", "\\u", "request_", "(_", "action_", ",_", "params_", ",_", "path_", ",_", "verb_", ",_", "callback_", "=_", "list", "\\u", "got_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "object_", "(_", "self_", ",_", "action_", ",_", "params_", ",_", "cls_", ",_", "path_", "=_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "None_", ",_", "verb_", "=_", "'", "GET", "'_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "object\\u", "got_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'", "Null", " ", "body", " ", "%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "status_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "cls_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "boto_", "._", "handler_", "._", "Xm", "l", "Handler_", "(_", "obj_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "._", "sax_", "._", "parse", "String_", "(_", "body_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "callback_", "(_", "obj_", ")_", "\\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 ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "make", "\\u", "request_", "(_", "action_", ",_", "params_", ",_", "path_", ",_", "verb_", ",_", "callback_", "=_", "object\\u", "got_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "AW", "SQ", "uer", "y", "Connection_", "(_", "Async", "Connection_", ",_", "boto_", "._", "connection_", "._", "AW", "SQ", "uer", "y", "Connection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "status_", "(_", "self_", ",_", "action_", ",_", "params_", ",_", "path_", "=_", "'/'_", ",_", "parent_", "=_", "None_", ",_", "verb_", "=_", "'", "GET", "'_", ",_", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "status", "\\u", "got_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "response_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "debug_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'", "Null", " ", "body", " ", "%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "status_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs_", "=_", "Result", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "boto_", "._", "handler_", "._", "Xm", "l", "Handler_", "(_", "rs_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "._", "sax_", "._", "parse", "String_", "(_", "body_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "callback_", "(_", "rs_", "._", "status_", ")_", "\\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 ", " _", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boto_", "._", "log_", "._", "error_", "(_", "'%", "s", "'_", "%_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "Respons", "e", "Error_", "(_", "response_", "._", "status_", ",_", "response_", "._", "reason_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "make", "\\u", "request_", "(_", "action_", ",_", "params_", ",_", "path_", ",_", "verb_", ",_", "callback_", "=_", "status", "\\u", "got_", ")_", "\\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, 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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
Netflix/aminator/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# aminator documentation build configuration file, created by\n# sphinx-quickstart on Thu Mar 14 18:38:34 2013.\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.insert(0, os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\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', 'sphinx.ext.coverage', 'sphinx.ext.viewcode']\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-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'aminator'\ncopyright = u'2013, Netflix, Inc.'\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 = '1.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '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 patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_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. See the documentation for\n# a list of builtin themes.\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_domain_indices = 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, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = 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# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'aminatordoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\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', 'aminator.tex', u'aminator Documentation',\n u'Netflix, Inc.', '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# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\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_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'aminator', u'aminator Documentation',\n [u'Netflix, Inc.'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output ------------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'aminator', u'aminator Documentation',\n u'Netflix, Inc.', 'aminator', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\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_", "#", " ", "amin", "ator", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Thu", " ", "Mar", " ", "14", " ", "1", "8", ":", "3", "8", ":", "3", "4", " ", "2013", "._", "\\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", ".", "insert", "(", "0", ",", " ", "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_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\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", "'_", ",_", "'", "sphinx", ".", "ext", ".", "covera", "ge", "'_", ",_", "'", "sphinx", ".", "ext", ".", "view", "code", "'_", "]_", "\\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", "-", "sig", "'_", "\\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", "'", "amin", "ator", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2013", ",", " ", "Net", "fli", "x", ",", " ", "Inc", ".'_", "\\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_", "=_", "'", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "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", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\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", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\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", "domain", "\\u", "indice", "s", " ", "=", " ", "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", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "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_", "#", " ", "Thi", "s", " ", "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", " ", "=", " ", "None_", "\\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_", "=_", "'", "amin", "ator", "doc", "'_", "\\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_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\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_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\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_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "amin", "ator", ".", "tex", "'_", ",_", "u", "'", "amin", "ator", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Net", "fli", "x", ",", " ", "Inc", ".'_", ",_", "'", "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_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\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", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "amin", "ator", "'_", ",_", "u", "'", "amin", "ator", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Net", "fli", "x", ",", " ", "Inc", ".'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "amin", "ator", "'_", ",_", "u", "'", "amin", "ator", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Net", "fli", "x", ",", " ", "Inc", ".'_", ",_", "'", "amin", "ator", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\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_", "#", "tex", "info", "\\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_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\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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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 ]
Unused import
zulip/zulip/zerver/migrations/0005_auto_20150920_1340.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('zerver', '0004_userprofile_left_side_userlist'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='realm',\n options={'permissions': (('administer', 'Administer a realm'), ('api_super_user', 'Can send messages as other users for mirroring'))},\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "zer", "ver", "'_", ",_", "'", "0004", "\\u", "userprofile", "\\u", "left", "\\u", "side", "\\u", "userl", "ist", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Options_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "real", "m", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "'", "permissi", "ons", "'_", ":_", "(_", "(_", "'", "admin", "iste", "r", "'_", ",_", "'", "Admi", "nist", "er", " ", "a", " ", "real", "m", "'_", ")_", ",_", "(_", "'", "api", "\\u", "super", "\\u", "user", "'_", ",_", "'", "Can", " ", "send", " ", "message", "s", " ", "as", " ", "other", " ", "users", " ", "for", " ", "mirror", "ing", "'_", ")_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
google/nogotofail/nogotofail/mitm/connection/handlers/data/smtp.py
[ { "content": " def on_response(self, response):\n if not self.first_server_chunk_received:\n self.first_server_chunk_received = True\n if (not self.first_client_chunk_received and\n (response.startswith(\"220 \") or response.startswith(\"220-\"))):\n self.smtp_detected = True\n\n if not self.smtp_detected:\n return response\n\n if self.ehlo_response_pending:\n # This is supposed to be a response to EHLO\n self.ehlo_response_pending = False\n if not response.startswith(\"250-\"):\n # Unexpected response to EHLO -- stop analyzing/attacking\n return response\n\n lines = [l.rstrip() for l in response.splitlines()]\n starttls_line_index = -1\n for i in range(len(lines)):\n line = lines[i]\n if line[4:].lower().startswith(\"starttls\"):\n starttls_line_index = i\n break\n else:\n # STARTTLS not found -- stop analyzing/attacking\n self.smtp_detected = False\n self.log(logging.DEBUG, \"No STARTTLS in EHLO response\")\n return response\n\n if starttls_line_index == len(lines) - 1:\n # STARTTLS line was the last line -- drop it and modify the\n # preceding line as required by the protocol.\n lines = lines[:starttls_line_index]\n lines[-1] = lines[-1][0:3] + \" \" + lines[-1][4:]\n else:\n # STARTTLS line was not the last line -- just drop it.\n lines = lines[:starttls_line_index] + lines[starttls_line_index + 1:]\n response = \"\\r\\n\".join(lines) + \"\\r\\n\"\n self.server_starttls_stripped = True\n self.log(logging.DEBUG, \"Stripped STARTTLS from EHLO response\")\n\n return response", "metadata": "root.SmtpStartTlsStripHandler.on_response", "header": "['class', 'SmtpStartTlsStripHandler', '(', 'DataHandler', ')', ':', '___EOS___']", "index": 44 } ]
[ { "span": "starttls_line_index ", "start_line": 62, "start_column": 12, "end_line": 62, "end_column": 31 } ]
[ { "span": "starttls_line_index ", "start_line": 66, "start_column": 20, "end_line": 66, "end_column": 39 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Sm", "tp", "Start", "Tl", "s", "Strip", "Handler_", "(_", "Data", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "\\u", "response_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "first", "\\u", "server", "\\u", "chunk", "\\u", "received_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "first", "\\u", "server", "\\u", "chunk", "\\u", "received_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "self_", "._", "first", "\\u", "client", "\\u", "chunk", "\\u", "received_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "response_", "._", "startswith_", "(_", "\"", "220", " ", "\"_", ")_", "or_", "response_", "._", "startswith_", "(_", "\"", "220", "-\"_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "smt", "p", "\\u", "detected_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "smt", "p", "\\u", "detected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "eh", "lo", "\\u", "response", "\\u", "pending_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "be", " ", "a", " ", "response", " ", "to", " ", "EH", "LO", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "eh", "lo", "\\u", "response", "\\u", "pending_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "response_", "._", "startswith_", "(_", "\"", "250", "-\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Une", "xpe", "cte", "d", " ", "response", " ", "to", " ", "EH", "LO", " ", "--", " ", "stop", " ", "analy", "zin", "g", "/", "attac", "king", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "[_", "l_", "._", "rstrip_", "(_", ")_", "for_", "l_", "in_", "response_", "._", "splitlines_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startt", "ls", "\\u", "line", "\\u", "index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "lines_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "lines_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "[_", "4_", ":_", "]_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "\"", "startt", "ls", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "startt", "ls", "\\u", "line", "\\u", "index_", "=_", "i_", "\\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_", "#", " ", "START", "TLS", " ", "not", " ", "found", " ", "--", " ", "stop", " ", "analy", "zin", "g", "/", "attac", "king", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "smt", "p", "\\u", "detected_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "logging_", "._", "DEBUG_", ",_", "\"", "No", " ", "START", "TLS", " ", "in", " ", "EH", "LO", " ", "response", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "startt", "ls", "\\u", "line", "\\u", "index_", "==_", "len_", "(_", "lines_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "START", "TLS", " ", "line", " ", "was", " ", "the", " ", "last", " ", "line", " ", "--", " ", "drop", " ", "it", " ", "and", " ", "modif", "y", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "preceding", " ", "line", " ", "as", " ", "require", "d", " ", "by", " ", "the", " ", "protoc", "ol", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "lines_", "[_", ":_", "startt", "ls", "\\u", "line", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "[_", "-_", "1_", "]_", "=_", "lines_", "[_", "-_", "1_", "]_", "[_", "0_", ":_", "3_", "]_", "+_", "\"", " ", "\"_", "+_", "lines_", "[_", "-_", "1_", "]_", "[_", "4_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "START", "TLS", " ", "line", " ", "was", " ", "not", " ", "the", " ", "last", " ", "line", " ", "--", " ", "just", " ", "drop", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "lines_", "[_", ":_", "startt", "ls", "\\u", "line", "\\u", "index_", "]_", "+_", "lines_", "[_", "startt", "ls", "\\u", "line", "\\u", "index_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "\"\\\\", "r", "\\\\", "n", "\"_", "._", "join_", "(_", "lines_", ")_", "+_", "\"\\\\", "r", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "startt", "ls", "\\u", "stripped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "logging_", "._", "DEBUG_", ",_", "\"", "Strip", "ped", " ", "START", "TLS", " ", "from", " ", "EH", "LO", " ", "response", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
matthew-brett/bibstuff/bibstuff/bibfile.py
[ { "content": "\"\"\"\n:mod:`bibstuff.bibfile` --- High Level BibTeX File Interface\n============================================================\n\nProvides two classes, BibFile and BibEntry for\naccessing the parts of a bibtex database.\nBibFile inherits from ``simpleparse.dispatchprocessor``.\nTo fill a BibFile instance, bfi, call bibgrammar.Parse(src, bfi).\n\n\n:author: Dylan Schwilk (esp. BibFile)\n:contact: http://www.schwilk.org\n:author: Alan G Isaac (esp. BibEntry)\n:contact: http://www.american.edu/cas/econ/faculty/isaac/isaac1.htm\n:copyright: 2006 by Dylan Schwilk and Alan G Isaac\n:license: MIT (see `license.txt`_)\n:date: 2006-08-05\n:requires: Python 2.4+\n:TODO: make this framework more general, perhaps along the lines of the btparse_ library in btOOL_.\n\n.. _btOOL: http://www.gerg.ca/software/btOOL/doc/btparse.html\n.. _btparse: http://www.gerg.ca/software/btOOL/doc/btparse.html\n.. _license.txt: ./license.txt\n\"\"\"\n__docformat__ = \"restructuredtext en\"\n__authors__ = [\"Dylan W. Schwilk\", \"Alan G. Isaac\"]\n__version__ = '1.13'\n__needs__ = '2.4'\n\n# options:\n# __strict__ = False allows empty citekeys\n__strict__ = False # should we be strict with bibtex format?\n\n\n####################### IMPORTS #####################################\n# import from standard library\nimport re\nimport sys\n\n# import dependencies\nfrom simpleparse.dispatchprocessor import dispatch, DispatchProcessor, getString, lines\n\n#bibstuff imports\nfrom bibstuff import bibgrammar\nfrom bibstuff.bibstyles.shared import reformat_para\nimport logging\nbibfile_logger = logging.getLogger('bibstuff_logger')\n#####################################################################\n\n############### GLOBAL VARIABLES ##################################\nmonths_en = ('January','February','March','April','May','June',\n 'July','August','September','October','November','December')\nmonthslower_en = [m.lower() for m in months_en]\nmonthmacros_en = [m[:3] for m in monthslower_en]\nMONTH_DICT = dict( zip(monthmacros_en, months_en) )\n#####################################################################\n\n\n\n\n# ----------------------------------------------------------\n# Bibfile\n# -------\n# Data storage for bibtex file\n# ----------------------------------------------------------\n\n\n# self test\n# -------------------------\n# usage: bibfile.py DATABASE_FILE\nif __name__ == \"__main__\":\n\timport sys\n\tif len(sys.argv) > 1 :\n\t\tsrc = open(sys.argv[1]).read()\n\t\tbfile = BibFile()\n\t\tbibgrammar.Parse(src, bfile)\n\t\tfor entry in bfile.entries :\n\t\t\tprint entry\n\n\telse :\n\t\tprint \"self test usage: bibfile.py DATABASE_FILE\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BibEntry(dict):\n\t\"\"\"\n\tStores a single bibliographic entry.\n\tProvides a dictionary interface to the fields:\n\tfield keys are case-insensitive and fields are stored\n\tin the order added.\n\t\n\t:note: 2006-08-10 use 'citekey' instead of 'key' since BibTeX allows a 'key' field\n\t:note: 2008-03-29 'entry_type' instead of 'type' since BibTeX allows a 'type' field\n\t\"\"\"\n\n\tentry_type = property(get_entry_type, set_entry_type, None, \"property: 'entry_type'\")\n\n\tcitekey = property(get_citekey,set_citekey,None,\"property: 'citekey'\")\n\n\tfields = property(get_fields, set_fields, None, \"property: 'fields'\")\n\n\n\n\n", "metadata": "root.BibEntry", "header": "['module', '___EOS___']", "index": 58 }, { "content": "\tdef __init__(self,*args,**kwargs):\n\t\tdict.__init__(self,*args,**kwargs)\n\t\tself._fields = []", "metadata": "root.BibEntry.__init__", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 68 }, { "content": "\tdef __repr__(self):\n\t\t\"\"\"return string representation of entry\n\t\t\n\t\t:note: 2006-08-11:eliminate final comma, handle months-> macro and journal macros\n\t\t\"\"\"\n\t\tstringrep = '@%s{%s,\\n' % (self.entry_type.upper() , self.citekey)\n\t\ttry:\n\t\t\tmlen = max( len(key_str) for key_str in self._fields ) # for pretty format\n\t\texcept ValueError: #no fields (not a true entry)\n\t\t\tmlen = 0\n\t\t\tbibfile_logger.warn(\"Entry apparently has no fields.\")\n\t\tfield_list = []\n\t\tfor key in self._fields:\n\t\t\taddbraces = True\n addquotes = False\n\t\t\tspacer = ' '*(mlen - len(key) )\n\t\t\tval = self[key]\n\t\t\t#handle crossref\n\t\t\tif key == 'crossref':\n\t\t\t\ttry: val = val['citekey'] #might be an entry\n\t\t\t\texcept TypeError: pass #->must be a string\n\t\t\telif key == 'journal':\n\t\t\t\tif val.isalpha() and val.islower(): #:TODO: allow punctuation!!\n\t\t\t\t\taddbraces = False #i.e., assume it is a macro\n\t\t\telif key == 'month':\n\t\t\t\t# always use month macros if possible\n\t\t\t\tif val.lower() in monthslower_en + monthmacros_en:\n\t\t\t\t\tval = val[:3].lower()\n\t\t\t\t\taddbraces = False\n\t\t\telif key in (\"year\",\"number\",\"volume\",\"chapter\"):\n\t\t\t\ttry:\n\t\t\t\t\taddbraces = not int(val)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n if '@' in val: # need to protect '@'\n addquotes = True\n if addquotes:\n val = '\"' + val + '\"'\n\t\t\telif addbraces:\n\t\t\t\tval = \"{\" + val + \"}\"\n\t\t\tfield_list.append(\" %-*s = %s\" % (mlen, key, val))\n\t\tstringrep += \",\\n\".join(field_list)\n\t\tstringrep += '\\n}\\n'\n\t\treturn stringrep", "metadata": "root.BibEntry.__repr__", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 71 }, { "content": "\tdef __setitem__(self, key, val):\n\t\tkey = key.lower()\n\t\tdict.__setitem__(self, key, val)\n\t\tif key == \"key\":\n\t\t\tbibfile_logger.info(\n\t\t\t\"Setting 'key' as an entry *field*. (Recall 'citekey' holds the entry id.)\")\n\t\tif key not in self._fields and key not in [\"citekey\",\"entry_type\"] and val:\n\t\t\tself._fields.append(key)", "metadata": "root.BibEntry.__setitem__", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 115 }, { "content": "\tdef __getitem__(self, field): #field is usually a BibTeX field but can be a citekey\n\t\tfield = field.lower()\n\t\tif field == \"key\":\n\t\t\tbibfile_logger.info(\n\t\t\t\"Seeking 'key' as an entry *field*. (Recall 'citekey' holds the entry id.)\")\n\t\ttry:\n\t\t\tresult = dict.__getitem__(self, field)\n\t\t#:TODO: rethink this decision (but it is used for formatting)\n\t\t#:note: 20080331 changed KeyError to return '' instead of None\n\t\texcept KeyError:\n\t\t\tcrossref = self.get('crossref', '')\n\t\t\tif isinstance(crossref, self.__class__):\n\t\t\t\tresult = crossref[field]\n\t\t\telse:\n\t\t\t\tresult = ''\n\t\t#:note: 20080331 add handling of month macros\n\t\tif field == 'month' and result in monthmacros_en:\n\t\t\tresult = MONTH_DICT[result]\n\t\treturn result", "metadata": "root.BibEntry.__getitem__", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 123 }, { "content": "\tdef __delitem__(self,key) :\n\t\tkey = key.lower()\n\t\ttry:\n\t\t\tdict.__delitem__(self, key)\n\t\texcept KeyError:\n\t\t\tpass\n\t\ttry:\n\t\t\tself._fields.remove(key)\n\t\texcept ValueError:\n\t\t\tpass", "metadata": "root.BibEntry.__delitem__", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 142 }, { "content": "\tdef set_entry_type(self, val):\n\t\tself[\"entry_type\"] = val.lower() #:note: entry_type stored as lowercase", "metadata": "root.BibEntry.set_entry_type", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 153 }, { "content": "\tdef get_entry_type(self):\n\t\treturn self[\"entry_type\"]", "metadata": "root.BibEntry.get_entry_type", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 155 }, { "content": "\tdef set_citekey(self, val):\n\t\tself[\"citekey\"] = val", "metadata": "root.BibEntry.set_citekey", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 159 }, { "content": "\tdef get_citekey(self):\n\t\treturn self[\"citekey\"]", "metadata": "root.BibEntry.get_citekey", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 161 }, { "content": "\tdef get_fields(self):\n\t\treturn self._fields", "metadata": "root.BibEntry.get_fields", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 165 }, { "content": "\tdef set_fields(self, lst):\n\t\tself._fields = lst", "metadata": "root.BibEntry.set_fields", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 167 }, { "content": "\tdef search_fields(self, string_or_compiled, field='', ignore_case=True):\n\t\t\"\"\"Return MatchObject if string_or_compiled found in entry else None.\n\t\tFind regular expression in entry.\n\t\tIf field is omitted, search is through all fields.\n\t\t\n\t\t:note: used by BibFile's find_re method, which is used in turn by bibsearch.py\n\t\t:Parameters:\n\t\t `string_or_compiled` : string to compile or compiled regex\n\t\t pattern for searching\n\t\t `field` : string\n\t\t field to search in self (default: search all fields)\n\t\t\"\"\"\n\t\tif isinstance(string_or_compiled, str):\n\t\t\tif ignore_case:\n\t\t\t\treo = re.compile(string_or_compiled, re.MULTILINE | re.IGNORECASE)\n\t\t\telse:\n\t\t\t\treo = re.compile(string_or_compiled, re.MULTILINE)\n\t\telse: #must have a compiled regular expression\n\t\t\treo = string_or_compiled\n\t\tif not field: #->try all fields (but not citekey)\n\t\t\tfor f in self.get_fields():\n\t\t\t\tfound = reo.search( self[f] )\n\t\t\t\tif found: break # no need to check more fields\n\t\t#:note: CAN test 'field in self' (even though an entry will not raise KeyError! see TODO above)\n\t\t# BUT do not test 'field in self' bc want test for empty fields below\n\t\telif self[field]:\n\t\t\tfound = reo.search( self[field] )\n\t\telse:\n\t\t\tif field in self:\n\t\t\t\tbibfile_logger.info(\"Empty field %s in entry\\n%s.\\n.\"%(self,field))\n\t\t\tfound = None\n\t\treturn found", "metadata": "root.BibEntry.search_fields", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 171 }, { "content": "\tdef format_names(self, names_formatter):\n\t\t\"\"\"return formatted BibName-object if possible else raw name\n\n\t\t:type `names_formatter`: NamesFormatter\n\t\t:note: called by CitationManager in format_citation\n\t\t:note: 2006-08-08 no longer sets a `_names` attribute\n\t\t:TODO: add default name_template useful for .bib files?\n\t\t\"\"\"\n\t\tbibfile_logger.debug(\"BibEntry.format_names: arg is:\"+str(names_formatter))\n\t\tnames = self.get_names() #get a BibName instance (or possibly, a string)\n\t\t#keep string if stuck with it\n\t\tif isinstance(names,str):\n\t\t\tresult = names\n\t\telse: #assume a BibName instance\n\t\t\t#ask BibName instance to format itself (and it asks a NamesFormatter to do it)\n\t\t\tresult = names.format(names_formatter)\n\t\tbibfile_logger.debug(\"BibEntry.format_names result = \"+str(result))\n\t\treturn result", "metadata": "root.BibEntry.format_names", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 204 }, { "content": "\tdef get_names(self, entry_formatter=None, try_fields=None):\n\t\t\"\"\"return (BibName-object if possible else string)\n\n\t\t:note: 2006-08-09 matching change to `make_names`, no longer sets `self._names`\n\t\t\"\"\"\n\t\tif entry_formatter is None:\n\t\t\tif not try_fields:\n\t\t\t\ttry_fields = ['author','editor','organization']\n\t\treturn self.make_names(entry_formatter, try_fields=try_fields)", "metadata": "root.BibEntry.get_names", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 223 }, { "content": "\tdef make_names(self, entry_formatter=None, try_fields=None):\n\t\t\"\"\"return (BibName-object if possible else string)\n\t\t(from \"raw\" names).\n\t\t\n\t\t:change: 2006-08-02 altered to return BibName instance and not set _names\n\t\t:note: self returns None if field missing (-> no KeyError)\n\t\t:note: this method introduces the only dependence on simpleparse (via bibname)\n\t\t:TODO: return BibName instance for each available name field??\n\t\t:Parameters:\n\t\t - `entry_formatter`: EntryFormatter instance to provide style information\n\t\t - `try_fields`: list of field names to try sequentially; none empty filed -> name\n\t\t\"\"\"\n\t\t# importing bibname here to avoid recursive import\n\t\tfrom bibstuff import bibname #ai: shd move all bibname into here? possibly\n\t\tif entry_formatter is None:\n\t\t\tfor field in try_fields:\n\t\t\t\traw_names = self[field]\n\t\t\t\tif raw_names:\n\t\t\t\t\tbreak\n\t\telse:\n\t\t\traw_names, field = entry_formatter.pick_raw_names(self,try_fields)\n\t\treturn bibname.BibName(raw_names,from_field=field) #names are in a BibName object", "metadata": "root.BibEntry.make_names", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 233 }, { "content": "\tdef format_with(self, entry_formatter):\n\t\tbibfile_logger.debug(\"BibEntry.format_with: arg is:\"+str(entry_formatter))\n\t\t#ask the EntryFormatter to do it\n\t\treturn entry_formatter.format_entry(self)", "metadata": "root.BibEntry.format_with", "header": "['class', 'BibEntry', '(', 'dict', ')', ':', '___EOS___']", "index": 256 }, { "content": "class BibFile( DispatchProcessor ):\n\t\"\"\"Stores parsed bibtex file. Access entries by key.\n\n\t:note: a BibFile object should simply *store* .bib file parts\n\t (a list of entries and a macro map) and provide access\n\t to these parts\n\t\"\"\"\n\n\t\t\n\n\t\"\"\"PRODUCTION FUNCTIONS:\n\tfor parsing, must provide a function for each production name.\n\t\"\"\"\n\n\n\n\n\n\t# macro name\n\n\t\t\t\t\n\t\n\n\t\t\n\n\n", "metadata": "root.BibFile", "header": "['module', '___EOS___']", "index": 267 }, { "content": "\tdef __init__(self) :\n\t\tself.entries = []\n\t\tself._macroMap = {}", "metadata": "root.BibFile.__init__", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 274 }, { "content": "\tdef get_entrylist(self, citekeys, discard=True):\n\t\t\"\"\"Return list, the BibEntry instances that were found\n\t\t(and None for entries not found, unless discarded).\n\t\t\"\"\"\n\t\tif not citekeys:\n\t\t\tbibfile_logger.warning(\"get_entrylist: No keys provided; returning empty cited-entry list.\")\n\t\t\treturn []\n\t\ttemp = [ (key,self.get_entry_by_citekey(key)) for key in citekeys ]\n\t\tbad_keys = [pair[0] for pair in temp if not pair[1]]\n\t\tif bad_keys and discard:\n\t\t\tbibfile_logger.warning(\"Database entries not found for the following keys:\\n\"+\"\\n\".join(bad_keys))\n\t\tif discard:\n\t\t\tresult = [pair[1] for pair in temp if pair[1]]\n\t\telse: #keep None when occurs in entry list\n\t\t\tresult = [pair[1] for pair in temp]\n\t\t#attach cross references\n\t\tfor entry in result:\n\t\t\tif entry:\n\t\t\t\tcrossref = entry.get('crossref', None)\n\t\t\t\tif isinstance(crossref, str):\n\t\t\t\t\tcrossref = self.get_entry_by_citekey(crossref)\n\t\t\t\t\tif crossref:\n\t\t\t\t\t\tentry['crossref'] = crossref\n\t\treturn result", "metadata": "root.BibFile.get_entrylist", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 278 }, { "content": "\tdef get_entry_by_citekey(self, citekey):\n\t\t\"\"\"Return entry or None.\"\"\"\n\t\tfor entry in self.entries:\n\t\t\tif entry.citekey == citekey:\n\t\t\t\treturn entry", "metadata": "root.BibFile.get_entry_by_citekey", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 303 }, { "content": "\tdef string(self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Return a string, stripping leading and trailing markers\"\"\"\n\t\treturn buffer[start+1:stop-1]", "metadata": "root.BibFile.string", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 313 }, { "content": "\tdef number(self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"return a number as a string\"\"\"\n\t\treturn buffer[start:stop]", "metadata": "root.BibFile.number", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 317 }, { "content": "\tdef entry_type( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Return the entry type\"\"\"\n\t\treturn getString((tag,start,stop,subtags), buffer)", "metadata": "root.BibFile.entry_type", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 321 }, { "content": "\tdef citekey( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Return the entry's citekey\"\"\"\n\t\treturn getString((tag,start,stop,subtags), buffer)", "metadata": "root.BibFile.citekey", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 325 }, { "content": "\tdef name(self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Return lookup on name or name if not in map.\"\"\"\n\t\treturn self._macroMap.get(buffer[start:stop],buffer[start:stop])", "metadata": "root.BibFile.name", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 330 }, { "content": "\tdef field(self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Process a bibentry field and return tuple of name, value.\"\"\"\n\t\tstr = ''\n\t\tfor t in subtags[1][3]:\n\t\t\tif(t) :\n\t\t\t\tstr += dispatch(self, t, buffer) # concatenate hashed together strings\n\t\treturn (dispatch(self, subtags[0], buffer), str)", "metadata": "root.BibFile.field", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 334 }, { "content": "\tdef entry( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Process the bibentry and its children.\n\t\t\"\"\"\n\t\tentry = BibEntry()\n\t\tentry.entry_type = dispatch(self, subtags[0], buffer)\n\t\tentry.citekey = dispatch(self, subtags[1], buffer)\n\t\tfor field in subtags[2][3] :\n\t\t\t#bibfile_logger.debug(\"entry: ready to add field: \"+str(dispatch(self, field, buffer)))\n\t\t\tk,v = dispatch(self, field, buffer)\n\t\t\t#:note: entry will force k to lowercase\n\t\t\tentry[k] = v\n\t\tself.entries.append(entry)", "metadata": "root.BibFile.entry", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 342 }, { "content": "\tdef macro( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Process a macro entry and add macros to macro map\"\"\"\n\t\tname, str = dispatch(self, subtags[0], buffer)\n\t\t\"\"\"\n\t\tthe_type = getString(subtags[0], buffer)\n\t\tif the_type.upper() != 'STRING' :\n\t\t\t# it looks like a macro, but is not: could be a regular entry with no key\n\t\t\tlineno = lines(0, start, buffer)+1\n\t\t\tbibfile_logger.warning(\"Entry at line %d has macro syntax, but entry_type is %s\" % (lineno , the_type))\n\t\t\tif not __strict__: # we can add a dummy key and treat this entry as a regular entry\n\t\t\t\tentry = BibEntry()\n\t\t\t\tentry.entry_type = dispatch(self, subtags[0], buffer)\n\t\t\t\tentry.citekey = 'KEY' # dummy key -- or should we be strict?\n\t\t\t\tfor field in subtags[1][3] :\n\t\t\t\t\tk,v = dispatch(self, field, buffer)\n\t\t\t\t\t#:note: entry will force k to lowercase\n\t\t\t\t\tentry[k] = v\n\t\t\t\tself.entries.append(entry)\n\t\t\t\tbibfile_logger.warning(\"Dummy key added to entry at line %d\" % lineno)\n\t\telse : # otherwise it is really a macro entry\n\t\t\tfor field in subtags[1][3]:\n\t\t\t\tname, str = dispatch(self, field, buffer)\n\t\t\t\tself._macroMap[name] = str \n\t\t\"\"\"\n\t\tself._macroMap[name] = str ", "metadata": "root.BibFile.macro", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 356 }, { "content": "\tdef preamble( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Process the given production and it's children\"\"\"\n\t\tthe_type = getString(subtags[0], buffer)\n\t\tlineno = lines(0,start,buffer)+1\n\t\tif the_type.upper() != 'PREAMBLE' :\n\t\t\tbibfile_logger.warning(\"Entry at line %d has preamble syntax but entry_type is %s\" % (lineno,the_type))\n\t\telse :\n\t\t\tbibfile_logger.warning(\"Preamble entry on line %d:\" % lineno + \"\\n\" + buffer[start:stop])", "metadata": "root.BibFile.preamble", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 383 }, { "content": "\tdef comment_entry( self, (tag,start,stop,subtags), buffer ):\n\t\t\"\"\"Process the given production and it's children\"\"\"\n\t\tthe_type = getString(subtags[0], buffer)\n\t\tlineno = lines(0,start,buffer)+1\n\t\tif the_type.upper() != 'COMMENT' :\n\t\t\tbibfile_logger.warning(\"Entry at line %d has comment syntax but entry_type is %s\" % (lineno,the_type))\n\t\telse :\n\t\t\tbibfile_logger.info(\"Comment entry on line %d:\" % lineno + \" \" + getString(subtags[1],buffer))", "metadata": "root.BibFile.comment_entry", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 392 }, { "content": "\tdef search_entries(self, string_or_compiled, field='', ignore_case=True):\n\t\t\"\"\"Return list of matching entries.\n\t\tSearch for regular expression in the fields of each entry.\n\t\tIf field is omitted, search is through all fields.\n\t\t\n\t\t:note: used by bibsearch.py\n\t\t:Parameters:\n\t\t `string_or_compiled` : string to compile or compiled regex\n\t\t pattern for searching\n\t\t `field` : string\n\t\t field to search in self (default: search all fields)\n\t\t\"\"\"\n\t\tif isinstance(string_or_compiled, str):\n\t\t\tif ignore_case:\n\t\t\t\treo = re.compile(string_or_compiled, re.MULTILINE | re.IGNORECASE)\n\t\t\telse:\n\t\t\t\treo = re.compile(string_or_compiled, re.MULTILINE)\n\t\telse: #->must have a compiled regular expression\n\t\t\treo = string_or_compiled\n\t\t\"\"\"\n\t\tFind regex in bib_entry.\n\t\tIf field is omitted, search is through all fields.\n\t\t\n\t\t:note: used by bibsearch.py\n\t\t\"\"\"\n\t\tls = [entry for entry in self.entries\n\t\t\tif entry.search_fields(string_or_compiled=reo, field=field, ignore_case=ignore_case)]\n\t\treturn ls", "metadata": "root.BibFile.search_entries", "header": "['class', 'BibFile', '(', 'DispatchProcessor', ')', ':', '___EOS___']", "index": 401 } ]
[ { "span": "from bibstuff.bibstyles.shared import reformat_para", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", ":", "mod", ":`", "bib", "stu", "ff", ".", "bib", "file", "`", " ", "---", " ", "Hig", "h", " ", "Leve", "l", " ", "Bi", "b", "Te", "X", " ", "File", " ", "Interface", "\\", "10", ";", "==============", "==============", "==============", "==============", "====", "\\", "10", ";", "\\", "10", ";", "Prov", "ides", " ", "two", " ", "classe", "s", ",", " ", "Bi", "b", "File", " ", "and", " ", "Bi", "b", "Entr", "y", " ", "for", "\\", "10", ";", "accessi", "ng", " ", "the", " ", "part", "s", " ", "of", " ", "a", " ", "bibtex", " ", "databa", "se", ".", "\\", "10", ";", "Bi", "b", "File", " ", "inherits", " ", "from", " ", "``", "simple", "parse", ".", "dispatch", "process", "or", "``.", "\\", "10", ";", "To", " ", "fill", " ", "a", " ", "Bi", "b", "File", " ", "instance", ",", " ", "bfi", ",", " ", "call", " ", "bib", "grammar", ".", "Pars", "e", "(", "src", ",", " ", "bfi", ").", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", ":", "author", ":", " ", "Dy", "lan", " ", "Sch", "wil", "k", " ", "(", "esp", ".", " ", "Bi", "b", "File", ")", "\\", "10", ";", ":", "contact", ":", " ", "http", "://", "www", ".", "sch", "wil", "k", ".", "org", "\\", "10", ";", ":", "author", ":", " ", "Ala", "n", " ", "G", " ", "Is", "aac", " ", "(", "esp", ".", " ", "Bi", "b", "Entr", "y", ")", "\\", "10", ";", ":", "contact", ":", " ", "http", "://", "www", ".", "amer", "ican", ".", "edu", "/", "cas", "/", "eco", "n", "/", "facult", "y", "/", "isa", "ac", "/", "isa", "ac", "1", ".", "ht", "m", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "2006", " ", "by", " ", "Dy", "lan", " ", "Sch", "wil", "k", " ", "and", " ", "Ala", "n", " ", "G", " ", "Is", "aac", "\\", "10", ";", ":", "license", ":", " ", "MIT", " ", "(", "see", " ", "`", "license", ".", "txt", "`\\u", ")", "\\", "10", ";", ":", "date", ":", " ", "2006", "-0", "8", "-0", "5", "\\", "10", ";", ":", "require", "s", ":", " ", "Pyth", "on", " ", "2.4", "+", "\\", "10", ";", ":", "TOD", "O", ":", " ", "make", " ", "this", " ", "frame", "work", " ", "more", " ", "genera", "l", ",", " ", "per", "hap", "s", " ", "along", " ", "the", " ", "lines", " ", "of", " ", "the", " ", "bt", "parse", "\\u", " ", "librar", "y", " ", "in", " ", "bt", "OO", "L", "\\u.", "\\", "10", ";", "\\", "10", ";", "..", " ", "\\u", "bt", "OO", "L", ":", " ", "http", "://", "www", ".", "ger", "g", ".", "ca", "/", "software", "/", "bt", "OO", "L", "/", "doc", "/", "bt", "parse", ".", "html", "\\", "10", ";", "..", " ", "\\u", "bt", "parse", ":", " ", "http", "://", "www", ".", "ger", "g", ".", "ca", "/", "software", "/", "bt", "OO", "L", "/", "doc", "/", "bt", "parse", ".", "html", "\\", "10", ";", "..", " ", "\\u", "license", ".", "txt", ":", " ", "./", "license", ".", "txt", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "\"", "restructur", "edt", "ext", " ", "en", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "\"", "Dy", "lan", " ", "W", ".", " ", "Sch", "wil", "k", "\"_", ",_", "\"", "Ala", "n", " ", "G", ".", " ", "Is", "aac", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.1", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "need", "s\\u\\u_", "=_", "'", "2.4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "options", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "strict", "\\u\\u", " ", "=", " ", "Fal", "se", " ", "allow", "s", " ", "empty", " ", "cite", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "strict", "\\u\\u_", "=_", "False_", "#", " ", "shou", "ld", " ", "we", " ", "be", " ", "strict", " ", "with", " ", "bibtex", " ", "format", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "#", " ", "IMPORT", "S", " ", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "from", " ", "standard", " ", "library_", "\\u\\u\\uNL\\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_", "#", " ", "import", " ", "dependencies_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "simple", "parse_", "._", "dispatch", "processor_", "import_", "dispatch_", ",_", "Dispa", "tch", "Processor_", ",_", "get", "String_", ",_", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "bib", "stu", "ff", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bib", "stuff_", "import_", "bib", "grammar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bib", "stuff_", "._", "bib", "styles_", "._", "shared_", "import_", "reformat", "\\u", "para_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bib", "file", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "bib", "stu", "ff", "\\u", "logg", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", " ", " ", "GLOB", "AL", " ", "VARIABLES", " ", " ", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "month", "s", "\\u", "en_", "=_", "(_", "'", "Januar", "y", "'_", ",_", "'", "Fe", "bru", "ary", "'_", ",_", "'", "March", "'_", ",_", "'", "Apri", "l", "'_", ",_", "'", "Ma", "y", "'_", ",_", "'", "Jun", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "ly", "'_", ",_", "'", "August", "'_", ",_", "'", "Sept", "ember", "'_", ",_", "'", "Oct", "obe", "r", "'_", ",_", "'", "Nove", "mber", "'_", ",_", "'", "Dece", "mber", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "slowe", "r", "\\u", "en_", "=_", "[_", "m_", "._", "lower_", "(_", ")_", "for_", "m_", "in_", "month", "s", "\\u", "en_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "macro", "s", "\\u", "en_", "=_", "[_", "m_", "[_", ":_", "3_", "]_", "for_", "m_", "in_", "month", "slowe", "r", "\\u", "en_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MONTH", "\\u", "DICT_", "=_", "dict_", "(_", "zip_", "(_", "month", "macro", "s", "\\u", "en_", ",_", "month", "s", "\\u", "en_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bi", "bfi", "le_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", " ", "storage", " ", "for", " ", "bibtex", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usage", ":", " ", "bib", "file", ".", "py", " ", "DATA", "BASE", "\\u", "FILE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "src_", "=_", "open_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bfi", "le_", "=_", "Bi", "b", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bib", "grammar_", "._", "Parse_", "(_", "src_", ",_", "bfi", "le_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry_", "in_", "bfi", "le_", "._", "entries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "\"", "self", " ", "test", " ", "usage", ":", " ", "bib", "file", ".", "py", " ", "DATA", "BASE", "\\u", "FILE", "\"_", "\\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_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "Stor", "es", " ", "a", " ", "single", " ", "biblio", "graphic", " ", "entry", ".", "\\", "10", ";", "\t", "Prov", "ides", " ", "a", " ", "dictionar", "y", " ", "interface", " ", "to", " ", "the", " ", "fields", ":", "\\", "10", ";", "\t", "field", " ", "keys", " ", "are", " ", "case", "-", "inse", "nsitive", " ", "and", " ", "fields", " ", "are", " ", "store", "d", "\\", "10", ";", "\t", "in", " ", "the", " ", "order", " ", "adde", "d", ".", "\\", "10", ";", "\t", "\\", "10", ";", "\t", ":", "note", ":", " ", "2006", "-0", "8", "-1", "0", " ", "use", " ", "'", "cite", "key", "'", " ", "inst", "ead", " ", "of", " ", "'", "key", "'", " ", "sinc", "e", " ", "Bi", "b", "Te", "X", " ", "allow", "s", " ", "a", " ", "'", "key", "'", " ", "field", "\\", "10", ";", "\t", ":", "note", ":", " ", "2008", "-0", "3", "-", "2", "9", " ", "'", "entry", "\\u", "type", "'", " ", "inst", "ead", " ", "of", " ", "'", "type", "'", " ", "sinc", "e", " ", "Bi", "b", "Te", "X", " ", "allow", "s", " ", "a", " ", "'", "type", "'", " ", "field", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry", "\\u", "type_", "=_", "property_", "(_", "get", "\\u", "entry", "\\u", "type_", ",_", "set\\u", "entry", "\\u", "type_", ",_", "None_", ",_", "\"", "property", ":", " ", "'", "entry", "\\u", "type", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cite", "key_", "=_", "property_", "(_", "get", "\\u", "cite", "key_", ",_", "set\\u", "cite", "key_", ",_", "None_", ",_", "\"", "property", ":", " ", "'", "cite", "key", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields_", "=_", "property_", "(_", "get", "\\u", "fields_", ",_", "set\\u", "fields_", ",_", "None_", ",_", "\"", "property", ":", " ", "'", "fields", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "dict_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "return", " ", "string", " ", "represent", "ation", " ", "of", " ", "entry", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "2006", "-0", "8", "-1", "1", ":", "eliminat", "e", " ", "final", " ", "comma", ",", " ", "handle", " ", "month", "s", "->", " ", "macro", " ", "and", " ", "journal", " ", "macro", "s", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "rep_", "=_", "'@", "%", "s", "{%", "s", ",\\\\", "n", "'_", "%_", "(_", "self_", "._", "entry", "\\u", "type_", "._", "upper_", "(_", ")_", ",_", "self_", "._", "cite", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mle", "n_", "=_", "max_", "(_", "len_", "(_", "key", "\\u", "str_", ")_", "for_", "key", "\\u", "str_", "in_", "self_", "._", "\\u", "fields_", ")_", "#", " ", "for", " ", "pretty", " ", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "#", "no", " ", "fields", " ", "(", "not", " ", "a", " ", "true", " ", "entry", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mle", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bib", "file", "\\u", "logger_", "._", "warn_", "(_", "\"", "Entr", "y", " ", "appare", "ntl", "y", " ", "has", " ", "no", " ", "fields", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "add", "braces", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "quotes_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spacer", "_", "=_", "'", " ", "'_", "*_", "(_", "mle", "n_", "-_", "len_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "self_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "handle", " ", "crossr", "ef_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "==_", "'", "crossr", "ef", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "val_", "=_", "val_", "[_", "'", "cite", "key", "'_", "]_", "#", "mig", "ht", " ", "be", " ", "an", " ", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "#-", ">", "must", " ", "be", " ", "a", " ", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "journal", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "val_", "._", "isalpha_", "(_", ")_", "and_", "val_", "._", "isl", "ower", "_", "(_", ")_", ":_", "#", ":", "TOD", "O", ":", " ", "allow", " ", "punct", "uation", "!!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "add", "braces", "_", "=_", "False_", "#", "i", ".", "e", ".,", " ", "assume", " ", "it", " ", "is", " ", "a", " ", "macro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "month", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "use", " ", "month", " ", "macro", "s", " ", "if", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "val_", "._", "lower_", "(_", ")_", "in_", "month", "slowe", "r", "\\u", "en_", "+_", "month", "macro", "s", "\\u", "en_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "val_", "=_", "val_", "[_", ":_", "3_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "braces", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "in_", "(_", "\"", "year", "\"_", ",_", "\"", "number", "\"_", ",_", "\"", "volume", "\"_", ",_", "\"", "chap", "ter", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "add", "braces", "_", "=_", "not_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'@'_", "in_", "val_", ":_", "#", " ", "need", " ", "to", " ", "protect", " ", "'@'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "quotes_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "add", "quotes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "=_", "'\"'_", "+_", "val_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "add", "braces", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "val_", "=_", "\"{\"_", "+_", "val_", "+_", "\"}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "list_", "._", "append_", "(_", "\"", " ", " ", "%", "-*", "s", " ", "=", " ", "%", "s", "\"_", "%_", "(_", "mle", "n_", ",_", "key_", ",_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "string", "rep_", "+=_", "\",", "\\\\", "n", "\"_", "._", "join_", "(_", "field", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "rep_", "+=_", "'\\\\", "n", "}\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "string", "rep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "key_", "=_", "key_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "==_", "\"", "key", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sett", "ing", " ", "'", "key", "'", " ", "as", " ", "an", " ", "entry", " ", "*", "field", "*.", " ", "(", "Recal", "l", " ", "'", "cite", "key", "'", " ", "hold", "s", " ", "the", " ", "entry", " ", "id", ".)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "not_", "in_", "self_", "._", "\\u", "fields_", "and_", "key_", "not_", "in_", "[_", "\"", "cite", "key", "\"_", ",_", "\"", "entry", "\\u", "type", "\"_", "]_", "and_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "fields_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "field_", ")_", ":_", "#", "field", " ", "is", " ", "usual", "ly", " ", "a", " ", "Bi", "b", "Te", "X", " ", "field", " ", "but", " ", "can", " ", "be", " ", "a", " ", "cite", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "field_", "=_", "field_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field_", "==_", "\"", "key", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Seek", "ing", " ", "'", "key", "'", " ", "as", " ", "an", " ", "entry", " ", "*", "field", "*.", " ", "(", "Recal", "l", " ", "'", "cite", "key", "'", " ", "hold", "s", " ", "the", " ", "entry", " ", "id", ".)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "dict_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", "TOD", "O", ":", " ", "ret", "hin", "k", " ", "this", " ", "decision", " ", "(", "but", " ", "it", " ", "is", " ", "used", " ", "for", " ", "format", "ting", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", "note", ":", " ", "20080", "331", " ", "change", "d", " ", "Key", "Error", " ", "to", " ", "return", " ", "''", " ", "inst", "ead", " ", "of", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "crossr", "ef_", "=_", "self_", "._", "get_", "(_", "'", "crossr", "ef", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "crossr", "ef_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "result_", "=_", "crossr", "ef_", "[_", "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\t", "\t\t\t_", "result_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", "note", ":", " ", "20080", "331", " ", "add", " ", "handling", " ", "of", " ", "month", " ", "macros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field_", "==_", "'", "month", "'_", "and_", "result_", "in_", "month", "macro", "s", "\\u", "en_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "MONTH", "\\u", "DICT_", "[_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "key_", "=_", "key_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "dict_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "fields_", "._", "remove_", "(_", "key_", ")_", "\\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\t", "\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "entry", "\\u", "type_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "[_", "\"", "entry", "\\u", "type", "\"_", "]_", "=_", "val_", "._", "lower_", "(_", ")_", "#", ":", "note", ":", " ", "entry", "\\u", "type", " ", "store", "d", " ", "as", " ", "lowercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "entry", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "[_", "\"", "entry", "\\u", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "cite", "key_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "[_", "\"", "cite", "key", "\"_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cite", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "[_", "\"", "cite", "key", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "._", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "fields_", "(_", "self_", ",_", "lst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "fields_", "=_", "lst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "search", "\\u", "fields_", "(_", "self_", ",_", "string", "\\u", "or", "\\u", "compiled_", ",_", "field_", "=_", "''_", ",_", "ignore", "\\u", "case_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "Match", "Object", " ", "if", " ", "string", "\\u", "or", "\\u", "compile", "d", " ", "found", " ", "in", " ", "entry", " ", "else", " ", "Non", "e", ".", "\\", "10", ";", "\t", "\t", "Fin", "d", " ", "regular", " ", "express", "ion", " ", "in", " ", "entry", ".", "\\", "10", ";", "\t", "\t", "If", " ", "field", " ", "is", " ", "omit", "ted", ",", " ", "search", " ", "is", " ", "through", " ", "all", " ", "fields", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "used", " ", "by", " ", "Bi", "b", "File", "'", "s", " ", "find", "\\u", "re", " ", "method", ",", " ", "whi", "ch", " ", "is", " ", "used", " ", "in", " ", "turn", " ", "by", " ", "bib", "search", ".", "py", "\\", "10", ";", "\t", "\t", ":", "Parameter", "s", ":", "\\", "10", ";", "\t", "\t", " ", " ", "`", "string", "\\u", "or", "\\u", "compile", "d", "`", " ", ":", " ", "string", " ", "to", " ", "compile", " ", "or", " ", "compile", "d", " ", "regex", "\\", "10", ";", "\t", "\t ", " ", "pattern", " ", "for", " ", "search", "ing", "\\", "10", ";", "\t", "\t", " ", " ", "`", "field", "`", " ", ":", " ", "string", "\\", "10", ";", "\t", "\t ", " ", "field", " ", "to", " ", "search", " ", "in", " ", "self", " ", "(", "default", ":", " ", "search", " ", "all", " ", "fields", ")", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "ignore", "\\u", "case_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "reo", "_", "=_", "re_", "._", "compile_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "re_", "._", "MULTILINE_", "|_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "reo", "_", "=_", "re_", "._", "compile_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "re_", "._", "MULTILINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "must", " ", "have", " ", "a", " ", "compile", "d", " ", "regular", " ", "expression_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "reo", "_", "=_", "string", "\\u", "or", "\\u", "compiled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "field_", ":_", "#-", ">", "try", " ", "all", " ", "fields", " ", "(", "but", " ", "not", " ", "cite", "key", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "f_", "in_", "self_", "._", "get", "\\u", "fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "found_", "=_", "reo", "_", "._", "search_", "(_", "self_", "[_", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "found_", ":_", "break_", "#", " ", "no", " ", "need", " ", "to", " ", "check", " ", "more", " ", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", "note", ":", " ", "CAN", " ", "test", " ", "'", "field", " ", "in", " ", "self", "'", " ", "(", "even", " ", "tho", "ugh", " ", "an", " ", "entry", " ", "will", " ", "not", " ", "raise", " ", "Key", "Error", "!", " ", "see", " ", "TOD", "O", " ", "above", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "BUT", " ", "do", " ", "not", " ", "test", " ", "'", "field", " ", "in", " ", "self", "'", " ", "bc", " ", "want", " ", "test", " ", "for", " ", "empty", " ", "fields", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "[_", "field_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "found_", "=_", "reo", "_", "._", "search_", "(_", "self_", "[_", "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\t", "\t\t_", "if_", "field_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "bib", "file", "\\u", "logger_", "._", "info_", "(_", "\"", "Emp", "ty", " ", "field", " ", "%", "s", " ", "in", " ", "entry", "\\\\", "n", "%", "s", ".\\\\", "n", ".\"_", "%_", "(_", "self_", ",_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format\\u", "names_", "(_", "self_", ",_", "names", "\\u", "formatter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "return", " ", "format", "ted", " ", "Bi", "b", "Name", "-", "object", " ", "if", " ", "possib", "le", " ", "else", " ", "raw", " ", "name", "\\", "10", ";", "\\", "10", ";", "\t", "\t", ":", "type", " ", "`", "names", "\\u", "formatter", "`", ":", " ", "Names", "Formatt", "er", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "call", "ed", " ", "by", " ", "Citation", "Manager", " ", "in", " ", "format\\u", "cit", "ation", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "2006", "-0", "8", "-0", "8", " ", "no", " ", "long", "er", " ", "sets", " ", "a", " ", "`\\u", "names", "`", " ", "attribute", "\\", "10", ";", "\t", "\t", ":", "TOD", "O", ":", " ", "add", " ", "default", " ", "name", "\\u", "template", " ", "usef", "ul", " ", "for", " ", ".", "bib", " ", "files", "?", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bib", "file", "\\u", "logger_", "._", "debug_", "(_", "\"", "Bi", "b", "Entr", "y", ".", "format\\u", "names", ":", " ", "arg", " ", "is", ":\"_", "+_", "str_", "(_", "names", "\\u", "formatter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "self_", "._", "get", "\\u", "names_", "(_", ")_", "#", "get", " ", "a", " ", "Bi", "b", "Name", " ", "instance", " ", "(", "or", " ", "possib", "ly", ",", " ", "a", " ", "string", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "keep", " ", "string", " ", "if", " ", "stu", "ck", " ", "with", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "names_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "assume", " ", "a", " ", "Bi", "b", "Name", " ", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ask", " ", "Bi", "b", "Name", " ", "instance", " ", "to", " ", "format", " ", "its", "elf", " ", "(", "and", " ", "it", " ", "asks", " ", "a", " ", "Names", "Formatt", "er", " ", "to", " ", "do", " ", "it", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "names_", "._", "format_", "(_", "names", "\\u", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bib", "file", "\\u", "logger_", "._", "debug_", "(_", "\"", "Bi", "b", "Entr", "y", ".", "format\\u", "names", " ", "result", " ", "=", " ", "\"_", "+_", "str_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "names_", "(_", "self_", ",_", "entry", "\\u", "formatter_", "=_", "None_", ",_", "try", "\\u", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "return", " ", "(", "Bi", "b", "Name", "-", "object", " ", "if", " ", "possib", "le", " ", "else", " ", "string", ")", "\\", "10", ";", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "2006", "-0", "8", "-0", "9", " ", "matchi", "ng", " ", "change", " ", "to", " ", "`", "make", "\\u", "names", "`", ",", " ", "no", " ", "long", "er", " ", "sets", " ", "`", "self", ".\\u", "names", "`", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entry", "\\u", "formatter_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "not_", "try", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try", "\\u", "fields_", "=_", "[_", "'", "author", "'_", ",_", "'", "editor", "'_", ",_", "'", "organization", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "names_", "(_", "entry", "\\u", "formatter_", ",_", "try", "\\u", "fields_", "=_", "try", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "names_", "(_", "self_", ",_", "entry", "\\u", "formatter_", "=_", "None_", ",_", "try", "\\u", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "return", " ", "(", "Bi", "b", "Name", "-", "object", " ", "if", " ", "possib", "le", " ", "else", " ", "string", ")", "\\", "10", ";", "\t", "\t", "(", "from", " ", "\"", "raw", "\"", " ", "names", ").", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "change", ":", " ", "2006", "-0", "8", "-0", "2", " ", "alter", "ed", " ", "to", " ", "return", " ", "Bi", "b", "Name", " ", "instance", " ", "and", " ", "not", " ", "set", " ", "\\u", "names", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "self", " ", "return", "s", " ", "Non", "e", " ", "if", " ", "field", " ", "missi", "ng", " ", "(-", ">", " ", "no", " ", "Key", "Error", ")", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "this", " ", "method", " ", "introduce", "s", " ", "the", " ", "only", " ", "dependen", "ce", " ", "on", " ", "simple", "parse", " ", "(", "via", " ", "bib", "name", ")", "\\", "10", ";", "\t", "\t", ":", "TOD", "O", ":", " ", "return", " ", "Bi", "b", "Name", " ", "instance", " ", "for", " ", "each", " ", "avail", "able", " ", "name", " ", "field", "??", "\\", "10", ";", "\t", "\t", ":", "Parameter", "s", ":", "\\", "10", ";", "\t", "\t", " ", " ", "-", " ", "`", "entry", "\\u", "formatter", "`", ":", " ", "Entr", "y", "Formatt", "er", " ", "instance", " ", "to", " ", "provide", " ", "style", " ", "informati", "on", "\\", "10", ";", "\t", "\t", " ", " ", "-", " ", "`", "try", "\\u", "fields", "`", ":", " ", "list", " ", "of", " ", "field", " ", "names", " ", "to", " ", "try", " ", "sequential", "ly", ";", " ", "none", " ", "empty", " ", "filed", " ", "->", " ", "name", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "import", "ing", " ", "bib", "name", " ", "here", " ", "to", " ", "avoid", " ", "recurs", "ive", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bib", "stuff_", "import_", "bib", "name_", "#", "ai", ":", " ", "sh", "d", " ", "move", " ", "all", " ", "bib", "name", " ", "int", "o", " ", "here", "?", " ", "possib", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entry", "\\u", "formatter_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "field_", "in_", "try", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raw", "\\u", "names_", "=_", "self_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raw", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raw", "\\u", "names_", ",_", "field_", "=_", "entry", "\\u", "formatter_", "._", "pick", "\\u", "raw", "\\u", "names_", "(_", "self_", ",_", "try", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bib", "name_", "._", "Bi", "b", "Name_", "(_", "raw", "\\u", "names_", ",_", "from", "\\u", "field_", "=_", "field_", ")_", "#", "names", " ", "are", " ", "in", " ", "a", " ", "Bi", "b", "Name", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "Entry_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format\\u", "with_", "(_", "self_", ",_", "entry", "\\u", "formatter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "bib", "file", "\\u", "logger_", "._", "debug_", "(_", "\"", "Bi", "b", "Entr", "y", ".", "format\\u", "with", ":", " ", "arg", " ", "is", ":\"_", "+_", "str_", "(_", "entry", "\\u", "formatter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ask", " ", "the", " ", "Entr", "y", "Formatt", "er", " ", "to", " ", "do", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "entry", "\\u", "formatter_", "._", "format\\u", "entry_", "(_", "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_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Stor", "es", " ", "parsed", " ", "bibtex", " ", "file", ".", " ", " ", "Access", " ", "entri", "es", " ", "by", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", "\t", ":", "note", ":", " ", "a", " ", "Bi", "b", "File", " ", "object", " ", "shou", "ld", " ", "simp", "ly", " ", "*", "store", "*", " ", ".", "bib", " ", "file", " ", "part", "s", "\\", "10", ";", "\t ", " ", " ", " ", " ", "(", "a", " ", "list", " ", "of", " ", "entri", "es", " ", "and", " ", "a", " ", "macro", " ", "map", ")", " ", "and", " ", "provide", " ", "access", "\\", "10", ";", "\t ", " ", " ", " ", " ", "to", " ", "these", " ", "part", "s", "\\", "10", ";", "\t", "\"\"\"_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "PRODUCT", "ION", " ", "FUNCTIONS", ":", "\\", "10", ";", "\t", "for", " ", "pars", "ing", ",", " ", "must", " ", "provide", " ", "a", " ", "function", " ", "for", " ", "each", " ", "producti", "on", " ", "name", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "macro", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "entries_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "macro", "Map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "entry", "list_", "(_", "self_", ",_", "cite", "keys_", ",_", "discard_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "list", ",", " ", "the", " ", "Bi", "b", "Entr", "y", " ", "instance", "s", " ", "tha", "t", " ", "wer", "e", " ", "found", "\\", "10", ";", "\t", "\t", "(", "and", " ", "Non", "e", " ", "for", " ", "entri", "es", " ", "not", " ", "found", ",", " ", "unl", "ess", " ", "discard", "ed", ").", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cite", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "warning_", "(_", "\"", "get", "\\u", "entry", "list", ":", " ", "No", " ", "keys", " ", "provided", ";", " ", "return", "ing", " ", "empty", " ", "cite", "d", "-", "entry", " ", "list", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp_", "=_", "[_", "(_", "key_", ",_", "self_", "._", "get", "\\u", "entry", "\\u", "by", "\\u", "cite", "key_", "(_", "key_", ")_", ")_", "for_", "key_", "in_", "cite", "keys_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "keys_", "=_", "[_", "pair_", "[_", "0_", "]_", "for_", "pair_", "in_", "temp_", "if_", "not_", "pair_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bad", "\\u", "keys_", "and_", "discard_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "warning_", "(_", "\"", "Databa", "se", " ", "entri", "es", " ", "not", " ", "found", " ", "for", " ", "the", " ", "follow", "ing", " ", "keys", ":\\\\", "n", "\"_", "+_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "bad", "\\u", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "discard_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "[_", "pair_", "[_", "1_", "]_", "for_", "pair_", "in_", "temp_", "if_", "pair_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "keep", " ", "Non", "e", " ", "whe", "n", " ", "occur", "s", " ", "in", " ", "entry", " ", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "[_", "pair_", "[_", "1_", "]_", "for_", "pair_", "in_", "temp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "attach", " ", "cross", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "entry_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "crossr", "ef_", "=_", "entry_", "._", "get_", "(_", "'", "crossr", "ef", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "crossr", "ef_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "crossr", "ef_", "=_", "self_", "._", "get", "\\u", "entry", "\\u", "by", "\\u", "cite", "key_", "(_", "crossr", "ef_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "crossr", "ef_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "entry_", "[_", "'", "crossr", "ef", "'_", "]_", "=_", "crossr", "ef_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "entry", "\\u", "by", "\\u", "cite", "key_", "(_", "self_", ",_", "cite", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "entry", " ", "or", " ", "Non", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entry_", "in_", "self_", "._", "entries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "entry_", "._", "cite", "key_", "==_", "cite", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "return_", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "string_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "a", " ", "string", ",", " ", "strip", "ping", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "marker", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buffer_", "[_", "start_", "+_", "1_", ":_", "stop_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "number_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "return", " ", "a", " ", "number", " ", "as", " ", "a", " ", "string", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buffer_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "entry", "\\u", "type_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "the", " ", "entry", " ", "type", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "String_", "(_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cite", "key_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "the", " ", "entry", "'", "s", " ", "cite", "key", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "String_", "(_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "name_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "look", "up", " ", "on", " ", "name", " ", "or", " ", "name", " ", "if", " ", "not", " ", "in", " ", "map", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "macro", "Map_", "._", "get_", "(_", "buffer_", "[_", "start_", ":_", "stop_", "]_", ",_", "buffer_", "[_", "start_", ":_", "stop_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "field_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Process", " ", "a", " ", "bib", "entry", " ", "field", " ", "and", " ", "return", " ", "tuple", " ", "of", " ", "name", ",", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "subta", "gs_", "[_", "1_", "]_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "str_", "+=_", "dispatch_", "(_", "self_", ",_", "t_", ",_", "buffer_", ")_", "#", " ", "concatenate", " ", "hashed", " ", "tog", "ether", " ", "strings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "dispatch_", "(_", "self_", ",_", "subta", "gs_", "[_", "0_", "]_", ",_", "buffer_", ")_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "entry_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Process", " ", "the", " ", "bib", "entry", " ", "and", " ", "its", " ", "child", "ren", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "=_", "Bi", "b", "Entry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "._", "entry", "\\u", "type_", "=_", "dispatch_", "(_", "self_", ",_", "subta", "gs_", "[_", "0_", "]_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "._", "cite", "key_", "=_", "dispatch_", "(_", "self_", ",_", "subta", "gs_", "[_", "1_", "]_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "subta", "gs_", "[_", "2_", "]_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "bib", "file", "\\u", "logg", "er", ".", "debug", "(\"", "entry", ":", " ", "read", "y", " ", "to", " ", "add", " ", "field", ":", " ", "\"+", "str", "(", "dispatch", "(", "self", ",", " ", "field", ",", " ", "buffer", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "k_", ",_", "v_", "=_", "dispatch_", "(_", "self_", ",_", "field_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", "note", ":", " ", "entry", " ", "will", " ", "force", " ", "k", " ", "to", " ", "lowercase_", "\\u\\u\\uNL\\u\\u\\u_", "entry_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "entries_", "._", "append_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "macro_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Process", " ", "a", " ", "macro", " ", "entry", " ", "and", " ", "add", " ", "macro", "s", " ", "to", " ", "macro", " ", "map", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "str_", "=_", "dispatch_", "(_", "self_", ",_", "subta", "gs_", "[_", "0_", "]_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "\t", "the", "\\u", "type", " ", "=", " ", "get", "String", "(", "subta", "gs", "[", "0", "],", " ", "buffer", ")", "\\", "10", ";", "\t", "\t", "if", " ", " ", "the", "\\u", "type", ".", "upper", "()", " ", "!=", " ", "'", "STRING", "'", " ", ":", "\\", "10", ";", "\t\t\t", "#", " ", "it", " ", "look", "s", " ", "like", " ", " ", "a", " ", "macro", ",", " ", "but", " ", "is", " ", "not", ":", " ", "coul", "d", " ", "be", " ", "a", " ", "regular", " ", "entry", " ", "with", " ", "no", " ", "key", "\\", "10", ";", "\t\t\t", "linen", "o", " ", "=", " ", "lines", "(", "0", ",", " ", "start", ",", " ", "buffer", ")+", "1", "\\", "10", ";", "\t\t\t", "bib", "file", "\\u", "logg", "er", ".", "warn", "ing", "(\"", "Entr", "y", " ", "at", " ", "line", " ", "%", "d", " ", "has", " ", "macro", " ", "synta", "x", ",", " ", "but", " ", "entry", "\\u", "type", " ", "is", " ", "%", "s", "\"", " ", "%", " ", "(", "linen", "o", " ", ",", " ", " ", "the", "\\u", "type", "))\\", "10", ";", "\t\t\t", "if", " ", "not", " ", "\\u\\u", "strict", "\\u\\u:", " ", "#", " ", "we", " ", "can", " ", "add", " ", "a", " ", "dummy", " ", "key", " ", "and", " ", "treat", " ", "this", " ", "entry", " ", "as", " ", "a", " ", "regular", " ", "entry", "\\", "10", ";", "\t\t\t", "\t", "entry", " ", "=", " ", "Bi", "b", "Entr", "y", "()", "\\", "10", ";", "\t\t\t", "\t", "entry", ".", "entry", "\\u", "type", " ", "=", " ", "dispatch", "(", "self", ",", " ", "subta", "gs", "[", "0", "],", " ", "buffer", ")", "\\", "10", ";", "\t\t\t", "\t", "entry", ".", "cite", "key", " ", " ", "=", " ", "'", "KEY", "'", " ", " ", "#", " ", "dummy", " ", "key", " ", "--", " ", "or", " ", "shou", "ld", " ", "we", " ", "be", " ", "strict", "?", "\\", "10", ";", "\t\t\t", "\t", "for", " ", "field", " ", "in", " ", "subta", "gs", "[", "1", "][", "3", "]", " ", ":", "\\", "10", ";", "\t\t\t", "\t", "\t", "k", ",", "v", " ", "=", " ", "dispatch", "(", "self", ",", " ", "field", ",", " ", "buffer", ")", "\\", "10", ";", "\t\t\t", "\t", "\t", "#", ":", "note", ":", " ", "entry", " ", "will", " ", "force", " ", "k", " ", "to", " ", "lower", "case", "\\", "10", ";", "\t\t\t", "\t", "\t", "entry", "[", "k", "]", " ", "=", " ", "v", "\\", "10", ";", "\t\t\t", "\t", "self", ".", "entri", "es", ".", "append", "(", "entry", ")", "\\", "10", ";", "\t\t\t", "\t", "bib", "file", "\\u", "logg", "er", ".", "warn", "ing", "(\"", "Du", "mm", "y", " ", "key", " ", "adde", "d", " ", "to", " ", "entry", " ", "at", " ", "line", " ", "%", "d", "\"", " ", "%", " ", "linen", "o", ")", "\\", "10", ";", "\t", "\t", "else", " ", ":", " ", " ", "#", " ", "other", "wis", "e", " ", "it", " ", "is", " ", "reall", "y", " ", "a", " ", "macro", " ", "entry", "\\", "10", ";", "\t\t\t", "for", " ", "field", " ", "in", " ", "subta", "gs", "[", "1", "][", "3", "]:", "\\", "10", ";", "\t\t\t", "\t", "name", ",", " ", "str", " ", "=", " ", "dispatch", "(", "self", ",", " ", "field", ",", " ", "buffer", ")", "\\", "10", ";", "\t\t\t", "\t", "self", ".\\u", "macro", "Map", "[", "name", "]", " ", "=", " ", "str", " ", " ", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "macro", "Map_", "[_", "name_", "]_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "preamble_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Process", " ", "the", " ", "give", "n", " ", "producti", "on", " ", "and", " ", "it", "'", "s", " ", "child", "ren", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "type_", "=_", "get", "String_", "(_", "subta", "gs_", "[_", "0_", "]_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "lines_", "(_", "0_", ",_", "start_", ",_", "buffer_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "the", "\\u", "type_", "._", "upper_", "(_", ")_", "!=_", "'", "PRE", "AMB", "LE", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "warning_", "(_", "\"", "Entr", "y", " ", "at", " ", "line", " ", "%", "d", " ", "has", " ", "preamble", " ", "synta", "x", " ", "but", " ", "entry", "\\u", "type", " ", "is", " ", "%", "s", "\"_", "%_", "(_", "lineno_", ",_", "the", "\\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\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "warning_", "(_", "\"", "Pre", "amb", "le", " ", "entry", " ", "on", " ", "line", " ", "%", "d", ":\"_", "%_", "lineno_", "+_", "\"\\\\", "n", "\"_", "+_", "buffer_", "[_", "start_", ":_", "stop_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\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_", "comment", "\\u", "entry_", "(_", "self_", ",_", "(_", "tag_", ",_", "start_", ",_", "stop_", ",_", "subta", "gs_", ")_", ",_", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Process", " ", "the", " ", "give", "n", " ", "producti", "on", " ", "and", " ", "it", "'", "s", " ", "child", "ren", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "type_", "=_", "get", "String_", "(_", "subta", "gs_", "[_", "0_", "]_", ",_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "lines_", "(_", "0_", ",_", "start_", ",_", "buffer_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "the", "\\u", "type_", "._", "upper_", "(_", ")_", "!=_", "'", "COMMENT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "warning_", "(_", "\"", "Entr", "y", " ", "at", " ", "line", " ", "%", "d", " ", "has", " ", "comment", " ", "synta", "x", " ", "but", " ", "entry", "\\u", "type", " ", "is", " ", "%", "s", "\"_", "%_", "(_", "lineno_", ",_", "the", "\\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\t", "\t\t_", "bib", "file", "\\u", "logger_", "._", "info_", "(_", "\"", "Comme", "nt", " ", "entry", " ", "on", " ", "line", " ", "%", "d", ":\"_", "%_", "lineno_", "+_", "\"", " ", "\"_", "+_", "get", "String_", "(_", "subta", "gs_", "[_", "1_", "]_", ",_", "buffer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "b", "File_", "(_", "Dispa", "tch", "Processor_", ")_", ":_", "\\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_", "search", "\\u", "entries_", "(_", "self_", ",_", "string", "\\u", "or", "\\u", "compiled_", ",_", "field_", "=_", "''_", ",_", "ignore", "\\u", "case_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "list", " ", "of", " ", "matchi", "ng", " ", "entri", "es", ".", "\\", "10", ";", "\t", "\t", "Sear", "ch", " ", "for", " ", "regular", " ", "express", "ion", " ", "in", " ", "the", " ", "fields", " ", "of", " ", "each", " ", "entry", ".", "\\", "10", ";", "\t", "\t", "If", " ", "field", " ", "is", " ", "omit", "ted", ",", " ", "search", " ", "is", " ", "through", " ", "all", " ", "fields", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "used", " ", "by", " ", "bib", "search", ".", "py", "\\", "10", ";", "\t", "\t", ":", "Parameter", "s", ":", "\\", "10", ";", "\t", "\t", " ", " ", "`", "string", "\\u", "or", "\\u", "compile", "d", "`", " ", ":", " ", "string", " ", "to", " ", "compile", " ", "or", " ", "compile", "d", " ", "regex", "\\", "10", ";", "\t", "\t ", " ", "pattern", " ", "for", " ", "search", "ing", "\\", "10", ";", "\t", "\t", " ", " ", "`", "field", "`", " ", ":", " ", "string", "\\", "10", ";", "\t", "\t ", " ", "field", " ", "to", " ", "search", " ", "in", " ", "self", " ", "(", "default", ":", " ", "search", " ", "all", " ", "fields", ")", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "ignore", "\\u", "case_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "reo", "_", "=_", "re_", "._", "compile_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "re_", "._", "MULTILINE_", "|_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "reo", "_", "=_", "re_", "._", "compile_", "(_", "string", "\\u", "or", "\\u", "compiled_", ",_", "re_", "._", "MULTILINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#-", ">", "must", " ", "have", " ", "a", " ", "compile", "d", " ", "regular", " ", "expression_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "reo", "_", "=_", "string", "\\u", "or", "\\u", "compiled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\t", "\t", "Fin", "d", " ", "regex", " ", "in", " ", "bib", "\\u", "entry", ".", "\\", "10", ";", "\t", "\t", "If", " ", "field", " ", "is", " ", "omit", "ted", ",", " ", "search", " ", "is", " ", "through", " ", "all", " ", "fields", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "note", ":", " ", "used", " ", "by", " ", "bib", "search", ".", "py", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "=_", "[_", "entry_", "for_", "entry_", "in_", "self_", "._", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "entry_", "._", "search", "\\u", "fields_", "(_", "string", "\\u", "or", "\\u", "compiled_", "=_", "reo", "_", ",_", "field_", "=_", "field_", ",_", "ignore", "\\u", "case_", "=_", "ignore", "\\u", "case_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ls_", "\\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, 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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 ]
Import of deprecated module
bloomreach/zinc/zinc.py
[ { "content": "#!/usr/bin/env python\n\n#\n# Copyright 2011-2012 BloomReach, 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'''\nZinc: Simple and scalable versioned data storage\n\nRequirements: Python 2.5, Boto 1.3 (or 2.0+ for large file multipart upload support), lzop (for LZO compression)\n\nAuthors: Joshua Levy, Srinath Sridhar, Kazuyuki Tanimura, Nishant Deshpande\n'''\n\n#\n# Revision history:\n#\n# 0.3.29 Add zinc diff command.\n# 0.3.28 Fix: wildcard matching bug\n# 0.3.27 Zinc locate multiple files with --recursive\n# 0.3.26 Add exponential retry wait time\n# 0.3.25 Wildcard support for track and untrack commands, ignore trailing slash of scope\n# 0.3.24 Second robustness fix. Fix for bug introduced in 0.3.22 (only manifests on retry).\n# 0.3.23 Second Fix: mtime float comparison\n# 0.3.22 Be robust to IncompleteRead errors from current version of boto.\n# 0.3.21 Fix: mtime float comparison and stringify bug\n# 0.3.20 Add verbosity=0 (minimal) option and print stack trace on verbosity=1 (default)\n# 0.3.19 Retry downloading for S3 exceptions\n# 0.3.18 Add track/untrack commands, checkout --mode option, and status --full option\n# 0.3.17 Zinc log command now shows the log from the checked out revision instead of tip.\n# 0.3.16 Open source with Apache License.\n# 0.3.15 Error for nested working directories. Fix error with copy to local file in local dir.\n# 0.3.14 Very minor fixes.\n# 0.3.13 Change signal handling; ignore SIGPIPE for better handling of socket errors.\n# 0.3.12 Fix: Ignore .tmp-copy directories.\n# 0.3.11 Turn on LZO compression by default.\n# 0.3.10 Add --no-cache option.\n# 0.3.9 Add --mod-all option.\n# 0.3.8 Minor cleanup and docs.\n# 0.3.7 Fix: Issue where unexpected item in cache aborts an update.\n# 0.3.6 Adjust output of \"locate\" and \"status\".\n# 0.3.5 Read S3 access keys from .s3cfg and environment.\n# 0.3.4 Support LZO compression. Repo version 0.3.\n#\n\nfrom __future__ import with_statement\nimport sys, re, os, subprocess, shutil, hashlib, binascii, random, time, logging, optparse, functools, ConfigParser, calendar, cStringIO, errno, httplib, rfc822\nfrom datetime import datetime\nfrom contextlib import contextmanager\n\nimport boto\nfrom boto.s3.connection import S3Connection # XXX seems to be needed to initialize boto module correctly\n\n# Version of this code.\nZINC_VERSION = \"0.3.29\"\n# Version of this repository implementation.\nREPO_VERSION = \"0.3\"\nREPO_VERSIONS_SUPPORTED = [\"0.2\", \"0.3\"]\nBOTO_VERSION = boto.Version\n\n##\n## Setup\n##\n\n# Directory for temporary files. This should only be used for small files\n# (repository file copies are always made to working directory).\nTMP_DIR = \"/tmp\"\n\n# Bits of randomness used in revision ids.\nREV_BITS = 64\n\n# Format for displayed dates.\nDATETIME_FORMAT = '%Y-%m-%d %H:%M:%S UTC'\n\nUNKNOWN_USER = \"unknown\"\nEMPTY_MESSAGE = \"\"\nEMPTY_FILEPATH = \"/dev/null\"\n\n# Used when keeping a copy of a previous file (as with revert).\nBACKUP_SUFFIX = \".orig\"\n# Name prefix used when creating a temporary directory.\nTMP_DIR_PREFIX = \".tmp-copy\"\n\n# Used in output to indicate that path preceding is the scope.\nSCOPE_SEP = \"//\"\n\n# Max file size to upload without S3 multipart upload\nS3_SINGLEPART_MAX_SIZE = 4000000000\n# Chunk size when using S3 multipart upload\nS3_MULTIPART_CHUNK_SIZE = 50 << 20\n\n# Environment variable names for S3 credentials.\nS3_ACCESS_KEY_NAME = \"S3_ACCESS_KEY\"\nS3_SECRET_KEY_NAME = \"S3_SECRET_KEY\"\n\n# Metadata header name we use for our own MD5 content hash. We use our own header since S3's etag is not really a reliable MD5 hash.\nZINC_S3_MD5_NAME = \"zinc-md5\"\nINVALID_MD5 = \"---\"\nINVALID_SIZE = -1\nINVALID_MTIME = -1.0\n\n# Default scheme for file storage.\nSCHEME_DEFAULT = \"lzo\"\n\n# Compression level for LZO.\nLZO_LEVEL = 7\n\n# Diff command\nDIFF_COMMAND='diff -u --label %(from_label)s %(from_path)s --label %(to_label)s %(to_path)s'\n\n\n# Always run initially to facilitate use as a library.\nlog_setup()\n\n\n##\n## Exceptions\n##\n\n\n\n\n\n\n\n\n\n##\n## Basic utilities\n##\n\n\n\n\n\n# Convenience decorators for logging.\nlog_calls_info = log_calls_with(logging.INFO)\nlog_calls = log_calls_with(logging.DEBUG)\n\n\n_WHITESPACE_RE = re.compile(\"\\s+\")\n\n\n\n\n\n_RANDOM = random.Random()\n_RANDOM.seed()\n\n\n\n\n\n##\n## File utilities\n##\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Color texts to display in Terminal\n\n# Show diff in Terminal\n\n\n##\n## Date and time utilities\n##\n\n\n\nDATETIME_FORMATS = [\n '%Y-%m-%d %H:%M:%S',\n '%Y-%m-%d %I:%M:%S%p',\n '%Y-%m-%d %H:%M',\n '%Y-%m-%d %I:%M%p',\n '%Y-%m-%d',\n '%a %b %d %H:%M:%S %Y',\n '%a %b %d %I:%M:%S%p %Y',\n '%a, %d %b %Y %H:%M:%S', # GNU coreutils \"/bin/date --rfc-2822\"\n '%b %d %H:%M:%S %Y',\n '%b %d %I:%M:%S%p %Y',\n '%b %d %H:%M:%S',\n '%b %d %I:%M:%S%p',\n '%b %d %H:%M',\n '%b %d %I:%M%p',\n '%b %d %Y',\n '%b %d',\n '%H:%M:%S',\n '%I:%M:%S%p',\n '%H:%M',\n '%I:%M%p',\n]\n\n# Raw date format is seconds since epoch\n_DATETIME_SECONDS_RE = re.compile(\"([0-9]{9,10})\")\n\n\n\n_DATESPEC_RE1 = re.compile(\"([<>])\\s*{(.*)}\")\n_DATESPEC_RE1A = re.compile(\"([<>])\\s*(.*)\")\n_DATESPEC_RE2 = re.compile(\"{(.*)}\\s*to\\s*{(.*)}\")\n_DATESPEC_RE2A = re.compile(\"(.*)\\s+to\\s+(.*)\")\n\n\n\n##\n## Common tools\n##\n\n# Simple serialization for short key/value pairs. We use our own for clarity, and so key order is deterministic.\n\n\n\n\n\n\n\n\n\n\n\n\n##\n## Repository\n##\n\n# Type of an item. Currently we only support files, but in the future there could by symlinks etc.\nItemType = enum(\"ItemType\", FILE=\"file\")\n\n# Storage schemes for items.\nScheme = enum(\"Scheme\", RAW=\"raw\", LZO=\"lzo\")\n\n\n\n\n# Checkout mode for scopes.\n# ToBeTracked is a state that a file locally exists and is tracked but not registered in manifest yet\nFileState = enum(\"FileState\", Tracked=\"tracked\", Untracked=\"untracked\", ToBeTracked=\"to_be_tracked\")\nFileStateTrackedList = [FileState.Tracked, FileState.ToBeTracked] # for convenience\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n##\n## Working directory\n##\n\n# Checkout mode for scopes.\nMode = enum(\"Mode\", AUTO=\"auto\", PARTIAL=\"partial\")\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n##\n## Commands\n##\n\n# Commands that work directly on the repository \n_COMMAND_LIST_REPO = [\"init\", \"newscope\", \"scopes\", \"log\", \"tags\", \"tag\", \"list\", \"copy\", \"locate\", \"_manifest\"]\n# Commands that require a working directory\n_COMMAND_LIST_WORK = [\"checkout\", \"update\", \"revert\", \"id\", \"ids\", \"status\", \"commit\", \"track\", \"untrack\", \"diff\"]\n\n# Allowed command abbreviations\n_COMMAND_ABBREVS = { \"cp\": \"copy\", \"ls\": \"list\" }\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n\n\n# TODO:\n# major missing features:\n# support nested scopes: manage creation, regenerations of manifests, etc.; also automatic recursive scope updates/commits\n# locking during commit and tag operations (NoLockingService is used by default, need to acquire locks for whole operation).\n# use sqlight3 instead of writing checkout-state in order to make zinc multi-process safe\n# support wildcards * besides track and untrack\n# other important features:\n# annotations (like tags, but key-value pairs; for example \"deploy_date=20120801\")\n# extend the Changelist class to include Unmodified and Invalid states so that we can show a list of tracked files for example.\n# error message when lzop not installed could be more helpful\n# run on all applicable scopes for --work (and --all), and fail or succeed for each\n# tolerate (with warning) a \"update --work\" when scope has been deleted; also a delscope command\n# post-upload hook, so that with LZO compression can compute .index files, for use with Hadoop\n# option to sanity check configuration (e.g. boto version, lzop command is present)\n# make sure we have custom output format with just revisions e.g. for \"zinc log\"\n# make log output cleaner/briefer (don't log about copying from cache, etc.)\n# \"commit -u\" that does update and commit if there are no conflicts\n# revert to other revisions\n# make arguments substitutable by options; handle multiple scopes as arguments in commands\n# ignore trailing / on scope names (if provided with -s)\n# how to handle update after a client deletes a file and it's also deleted in repo (currently this is a conflict and aborts)\n# in an update, should remove a directory when all files in the directory are deleted (but what if .orig files are present?)\n# switch to using argparse instead of optparse and make options command-specific\n# accept file arguments to commit and perhaps other commands\n# fix copy command to take multiple args, use only last for target\n# handle argument path names that are relative to cwd\n# file cache: add to cache on upload as well as download\n# don't error with \"checkout -s scope\" followed by \"checkout --all\"\n# support deleting tags; catch invalid or duplicate tags to tags command\n# support \"fat\" tags that have multiple keys and values (e.g. deploy dates)\n# list scope and tags in log command output\n# log of individual/sets of files\n# allow update|checkout --work|--all to work with a shared tag name (--force to override if only some scopes have tag)\n# fast checkout feature for with dummy checkout files (say over a given size) to ease checkout process\n# additional integrity checks: we already do mtime/size/md5 checks, but there are some corner cases to cover:\n# with S3, post upload, get MD5 and validate it matches the working copy MD5\n# with S3, compute MD5s on download and validate they match S3 MD5\n# implement S3-based locking\n# add locking for working dir to prevent two commands from running at once\n# management of working state (zinc add, zinc remove, etc.) (must also rethink logic of revert command)\n# consider different signal handlers and finally clauses to minimize corrupt working dir state on interruption (especially checkout-state)\n# --long variation on id and ids commands, to list last commit msg etc.\n# heuristic to not compress files of certain size or that are already compressed\n# store and restore file modification times reliably\n# add a transaction log, with timestamps, for all repo transactions (such as adding/removing tags)\n# mail-out hook -- implement through transaction log\n# when deleting, keep backups as .orig (and add to ignore list), or leave in cache\n# add config settings in ~/.zincrc\n# finish basic branch support: add -b option, newbranch command, and \"branch\" argument across all function calls that take a scope\n# multi-scope support: for commits, automatically identify all enclosing scopes for a commit, and commit each one\n# list and copy for paths that span more than one scope\n# file sizes (and optionally hashes, dates, etc.) in manifest; will make detailed listings fast\n# nicer error messages for invalid revisions\n# support symlinks\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "rfc822", "start_line": 58, "start_column": 154, "end_line": 58, "end_column": 160 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[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_", "#", " ", "Copy", "right", " ", "2011", "-", "2012", " ", "Bloo", "m", "Reach", ",", " ", "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_", "'''", "\\", "10", ";", "Zi", "nc", ":", " ", "Simple", " ", "and", " ", "scala", "ble", " ", "versioned", " ", "data", " ", "storage", "\\", "10", ";", "\\", "10", ";", "Requirements", ":", " ", "Pyth", "on", " ", "2.5", ",", " ", "Bot", "o", " ", "1.3", " ", "(", "or", " ", "2.0", "+", " ", "for", " ", "large", " ", "file", " ", "multip", "art", " ", "upload", " ", "support", "),", " ", "lz", "op", " ", "(", "for", " ", "LZ", "O", " ", "compress", "ion", ")", "\\", "10", ";", "\\", "10", ";", "Author", "s", ":", " ", "Jos", "hua", " ", "Lev", "y", ",", " ", "Sr", "inat", "h", " ", "Sr", "id", "har", ",", " ", "Ka", "zu", "yu", "ki", " ", "Tan", "imu", "ra", ",", " ", "Ni", "shan", "t", " ", "Des", "hpa", "nde", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Revi", "sion", " ", "histo", "ry", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "9", " ", " ", "Add", " ", "zin", "c", " ", "diff", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "8", " ", " ", "Fix", ":", " ", "wild", "card", " ", "matchi", "ng", " ", "bug_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "7", " ", " ", "Zi", "nc", " ", "locat", "e", " ", "multiple", " ", "files", " ", "with", " ", "--", "recursive_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "6", " ", " ", "Add", " ", "exponential", " ", "retr", "y", " ", "wait", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "5", " ", " ", "Wildcard", " ", "support", " ", "for", " ", "track", " ", "and", " ", "untr", "ack", " ", "command", "s", ",", " ", "ignore", " ", "trail", "ing", " ", "slash", " ", "of", " ", "scope_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "4", " ", " ", "Second", " ", "robust", "ness", " ", "fix", ".", " ", "Fix", " ", "for", " ", "bug", " ", "introduce", "d", " ", "in", " ", "0.", "3.2", "2", " ", "(", "only", " ", "manifests", " ", "on", " ", "retr", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "3", " ", " ", "Second", " ", "Fix", ":", " ", "mti", "me", " ", "float", " ", "comparison_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "2", " ", " ", "Be", " ", "robust", " ", "to", " ", "Incomp", "lete", "Read", " ", "error", "s", " ", "from", " ", "current", " ", "version", " ", "of", " ", "boto", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "1", " ", " ", "Fix", ":", " ", "mti", "me", " ", "float", " ", "compa", "ris", "on", " ", "and", " ", "stringify", " ", "bug_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.2", "0", " ", " ", "Add", " ", "verbo", "sity", "=", "0", " ", "(", "minima", "l", ")", " ", "option", " ", "and", " ", "print", " ", "stack", " ", "trace", " ", "on", " ", "verbo", "sity", "=", "1", " ", "(", "default", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "9", " ", " ", "Retr", "y", " ", "download", "ing", " ", "for", " ", "S", "3", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "8", " ", " ", "Add", " ", "track", "/", "untr", "ack", " ", "command", "s", ",", " ", "check", "out", " ", "--", "mode", " ", "option", ",", " ", "and", " ", "status", " ", "--", "full", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "7", " ", " ", "Zi", "nc", " ", "log", " ", "command", " ", "now", " ", "show", "s", " ", "the", " ", "log", " ", "from", " ", "the", " ", "checke", "d", " ", "out", " ", "revis", "ion", " ", "inst", "ead", " ", "of", " ", "tip", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "6", " ", " ", "Open", " ", "source", " ", "with", " ", "Ap", "ache", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "5", " ", " ", "Error", " ", "for", " ", "nest", "ed", " ", "working", " ", "director", "ies", ".", " ", "Fix", " ", "error", " ", "with", " ", "copy", " ", "to", " ", "local", " ", "file", " ", "in", " ", "local", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.14", " ", " ", "Ver", "y", " ", "mino", "r", " ", "fixes", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "3", " ", " ", "Change", " ", "signal", " ", "handling", ";", " ", "ignore", " ", "SIG", "PIPE", " ", "for", " ", "bett", "er", " ", "handling", " ", "of", " ", "socket", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "2", " ", " ", "Fix", ":", " ", "Ignor", "e", " ", ".", "tmp", "-", "copy", " ", "director", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "1", " ", " ", "Turn", " ", "on", " ", "LZ", "O", " ", "compress", "ion", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.1", "0", " ", " ", "Add", " ", "--", "no", "-", "cache", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.9", " ", " ", " ", "Add", " ", "--", "mod", "-", "all", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.8", " ", " ", " ", "Min", "or", " ", "clean", "up", " ", "and", " ", "docs", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.7", " ", " ", " ", "Fix", ":", " ", "Issue", " ", "where", " ", "unexpected", " ", "item", " ", "in", " ", "cache", " ", "abort", "s", " ", "an", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.6", " ", " ", " ", "Adjust", " ", "output", " ", "of", " ", "\"", "locat", "e", "\"", " ", "and", " ", "\"", "status", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.5", " ", " ", " ", "Read", " ", "S", "3", " ", "access", " ", "keys", " ", "from", " ", ".", "s3", "cfg", " ", "and", " ", "environ", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.", "3.4", " ", " ", " ", "Supp", "ort", " ", "LZ", "O", " ", "compress", "ion", ".", " ", "Rep", "o", " ", "version", " ", "0.", "3._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", ",_", "re_", ",_", "os_", ",_", "subprocess_", ",_", "shutil_", ",_", "hashlib_", ",_", "binascii_", ",_", "random_", ",_", "time_", ",_", "logging_", ",_", "optparse_", ",_", "functools_", ",_", "Config", "Parser_", ",_", "calendar_", ",_", "c", "String", "IO_", ",_", "errno_", ",_", "httplib_", ",_", "rfc", "822", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "boto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "s3_", "._", "connection_", "import_", "S", "3", "Connection_", "#", " ", "XX", "X", " ", "see", "ms", " ", "to", " ", "be", " ", "need", "ed", " ", "to", " ", "initialize", " ", "boto", " ", "module", " ", "correct", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "of", " ", "this", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "ZI", "NC", "\\u", "VERSION_", "=_", "\"", "0.", "3.2", "9", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Version", " ", "of", " ", "this", " ", "repos", "itor", "y", " ", "implementation", "._", "\\u\\u\\uNL\\u\\u\\u_", "REPO", "\\u", "VERSION_", "=_", "\"", "0.", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REPO", "\\u", "VERSIONS", "\\u", "SUPPORTED", "_", "=_", "[_", "\"", "0.", "2", "\"_", ",_", "\"", "0.", "3", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BOT", "O", "\\u", "VERSION_", "=_", "boto_", "._", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Setup_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Director", "y", " ", "for", " ", "temporar", "y", " ", "files", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "be", " ", "used", " ", "for", " ", "small", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "repos", "itor", "y", " ", "file", " ", "copie", "s", " ", "are", " ", "alw", "ay", "s", " ", "made", " ", "to", " ", "working", " ", "director", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "TMP", "\\u", "DIR_", "=_", "\"/", "tmp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bit", "s", " ", "of", " ", "random", "ness", " ", "used", " ", "in", " ", "revis", "ion", " ", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "REV", "\\u", "BITS_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Format", " ", "for", " ", "displaye", "d", " ", "dates", "._", "\\u\\u\\uNL\\u\\u\\u_", "DATETIME", "\\u", "FORMAT_", "=_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "UT", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "USER_", "=_", "\"", "unknown", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "MESSAGE_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "FILE", "PATH_", "=_", "\"/", "dev", "/", "null", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "whe", "n", " ", "keep", "ing", " ", "a", " ", "copy", " ", "of", " ", "a", " ", "previ", "ous", " ", "file", " ", "(", "as", " ", "with", " ", "revert", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "BACKUP", "\\u", "SUFFIX_", "=_", "\".", "orig", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "prefix", " ", "used", " ", "whe", "n", " ", "creati", "ng", " ", "a", " ", "temporar", "y", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "TMP", "\\u", "DIR", "\\u", "PREFIX_", "=_", "\".", "tmp", "-", "copy", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "in", " ", "output", " ", "to", " ", "indicat", "e", " ", "tha", "t", " ", "path", " ", "preceding", " ", "is", " ", "the", " ", "scope", "._", "\\u\\u\\uNL\\u\\u\\u_", "SCOPE", "\\u", "SEP", "_", "=_", "\"//", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Max", " ", "file", " ", "size", " ", "to", " ", "upload", " ", "with", "out", " ", "S", "3", " ", "multip", "art", " ", "upload_", "\\u\\u\\uNL\\u\\u\\u_", "S", "3", "\\u", "SINGLE", "PART", "\\u", "MAX", "\\u", "SIZE_", "=_", "4000000", "000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Chunk", " ", "size", " ", "whe", "n", " ", "usi", "ng", " ", "S", "3", " ", "multip", "art", " ", "upload_", "\\u\\u\\uNL\\u\\u\\u_", "S", "3", "\\u", "MULTIP", "ART", "\\u", "CHUNK", "\\u", "SIZE_", "=_", "50_", "<<_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Environ", "ment", " ", "variab", "le", " ", "names", " ", "for", " ", "S", "3", " ", "cred", "ential", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "S", "3", "\\u", "ACCESS", "\\u", "KEY", "\\u", "NAME_", "=_", "\"", "S", "3", "\\u", "ACCESS", "\\u", "KEY", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "\\u", "SEC", "RET", "\\u", "KEY", "\\u", "NAME_", "=_", "\"", "S", "3", "\\u", "SEC", "RET", "\\u", "KEY", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meta", "data", " ", "header", " ", "name", " ", "we", " ", "use", " ", "for", " ", "our", " ", "own", " ", "MD", "5", " ", "content", " ", "hash", ".", " ", "We", " ", "use", " ", "our", " ", "own", " ", "header", " ", "sinc", "e", " ", "S", "3", "'", "s", " ", "eta", "g", " ", "is", " ", "not", " ", "reall", "y", " ", "a", " ", "reliab", "le", " ", "MD", "5", " ", "hash", "._", "\\u\\u\\uNL\\u\\u\\u_", "ZI", "NC", "\\u", "S", "3", "\\u", "MD", "5", "\\u", "NAME_", "=_", "\"", "zin", "c", "-", "md5", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "MD", "5_", "=_", "\"--", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "SIZE_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "MT", "IME", "_", "=_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "sche", "me", " ", "for", " ", "file", " ", "storage", "._", "\\u\\u\\uNL\\u\\u\\u_", "SCHEME", "\\u", "DEFAULT_", "=_", "\"", "lz", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compress", "ion", " ", "level", " ", "for", " ", "LZ", "O", "._", "\\u\\u\\uNL\\u\\u\\u_", "LZ", "O", "\\u", "LEVEL_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Diff", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "DIFF", "\\u", "COMMAND_", "=_", "'", "diff", " ", "-", "u", " ", "--", "label", " ", "%", "(", "from", "\\u", "label", ")", "s", " ", "%", "(", "from", "\\u", "path", ")", "s", " ", "--", "label", " ", "%", "(", "to", "\\u", "label", ")", "s", " ", "%", "(", "to", "\\u", "path", ")", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "run", " ", "initially", " ", "to", " ", "facilit", "ate", " ", "use", " ", "as", " ", "a", " ", "librar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "\\u", "setup_", "(_", ")_", "\\u\\u\\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_", "##", " ", "Exceptions_", "\\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\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Basic", " ", "utilities_", "\\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_", "#", " ", "Conve", "nie", "nce", " ", "decorat", "ors", " ", "for", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "\\u", "calls", "\\u", "info_", "=_", "log", "\\u", "calls", "\\u", "with_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "calls_", "=_", "log", "\\u", "calls", "\\u", "with_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\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", "WHITESPACE", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "\"\\\\", "s", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "RANDOM", "_", "=_", "random_", "._", "Random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "RANDOM", "_", "._", "seed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "File", " ", "utilities_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Color", " ", "texts", " ", "to", " ", "display", " ", "in", " ", "Terminal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "diff", " ", "in", " ", "Terminal_", "\\u\\u\\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_", "##", " ", "Date", " ", "and", " ", "time", " ", "utilities_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DATETIME", "\\u", "FORMATS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "I", ":", "%", "M", ":", "%", "S", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "I", ":", "%", "M", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "Y", "-%", "m", "-%", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "a", " ", "%", "b", " ", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "%", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "a", " ", "%", "b", " ", "%", "d", " ", "%", "I", ":", "%", "M", ":", "%", "S", "%", "p", " ", "%", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "a", ",", " ", "%", "d", " ", "%", "b", " ", "%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ",_", "#", " ", "GN", "U", " ", "core", "util", "s", " ", "\"/", "bin", "/", "date", " ", "--", "rfc", "-", "282", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "%", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "I", ":", "%", "M", ":", "%", "S", "%", "p", " ", "%", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "I", ":", "%", "M", ":", "%", "S", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "H", ":", "%", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "I", ":", "%", "M", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", " ", "%", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "b", " ", "%", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "H", ":", "%", "M", ":", "%", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "I", ":", "%", "M", ":", "%", "S", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "H", ":", "%", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "I", ":", "%", "M", "%", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ra", "w", " ", "date", " ", "format", " ", "is", " ", "second", "s", " ", "sinc", "e", " ", "epoch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DATETIME", "\\u", "SECOND", "S", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "\"([", "0", "-", "9", "]{", "9", ",", "10", "})\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "DAT", "ESP", "EC", "\\u", "RE", "1_", "=_", "re_", "._", "compile_", "(_", "\"([", "<>", "])\\\\", "s", "*{", "(.*)", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "DAT", "ESP", "EC", "\\u", "RE", "1", "A_", "=_", "re_", "._", "compile_", "(_", "\"([", "<>", "])\\\\", "s", "*(.", "*)\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "DAT", "ESP", "EC", "\\u", "RE", "2_", "=_", "re_", "._", "compile_", "(_", "\"{", "(.*)", "}\\\\", "s", "*", "to", "\\\\", "s", "*{", "(.*)", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "DAT", "ESP", "EC", "\\u", "RE", "2", "A_", "=_", "re_", "._", "compile_", "(_", "\"(.", "*)\\\\", "s", "+", "to", "\\\\", "s", "+(", ".*)", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Common", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "serializ", "ation", " ", "for", " ", "short", " ", "key", "/", "value", " ", "pair", "s", ".", " ", "We", " ", "use", " ", "our", " ", "own", " ", "for", " ", "clari", "ty", ",", " ", "and", " ", "so", " ", "key", " ", "order", " ", "is", " ", "deterministic", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "Repository_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", " ", "of", " ", "an", " ", "item", ".", " ", "Curr", "ent", "ly", " ", "we", " ", "only", " ", "support", " ", "files", ",", " ", "but", " ", "in", " ", "the", " ", "future", " ", "there", " ", "coul", "d", " ", "by", " ", "symlinks", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Item", "Type_", "=_", "enum_", "(_", "\"", "Item", "Type", "\"_", ",_", "FILE_", "=_", "\"", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "age", " ", "schemes", " ", "for", " ", "items", "._", "\\u\\u\\uNL\\u\\u\\u_", "Scheme_", "=_", "enum_", "(_", "\"", "Sche", "me", "\"_", ",_", "RAW_", "=_", "\"", "raw", "\"_", ",_", "LZ", "O_", "=_", "\"", "lz", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", "out", " ", "mode", " ", "for", " ", "scope", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", "Be", "Track", "ed", " ", "is", " ", "a", " ", "state", " ", "tha", "t", " ", "a", " ", "file", " ", "local", "ly", " ", "exist", "s", " ", "and", " ", "is", " ", "tracked", " ", "but", " ", "not", " ", "register", "ed", " ", "in", " ", "manifest", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "File", "State_", "=_", "enum_", "(_", "\"", "File", "State", "\"_", ",_", "Track", "ed_", "=_", "\"", "tracked", "\"_", ",_", "Unt", "rack", "ed_", "=_", "\"", "untracked", "\"_", ",_", "To", "Be", "Track", "ed_", "=_", "\"", "to", "\\u", "be", "\\u", "tracked", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "File", "State", "Track", "ed", "List_", "=_", "[_", "File", "State_", "._", "Track", "ed_", ",_", "File", "State_", "._", "To", "Be", "Track", "ed_", "]_", "#", " ", "for", " ", "convenien", "ce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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_", "##", " ", "Work", "ing", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", "out", " ", "mode", " ", "for", " ", "scope", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Mode_", "=_", "enum_", "(_", "\"", "Mode", "\"_", ",_", "AUTO", "_", "=_", "\"", "auto", "\"_", ",_", "PARTI", "AL_", "=_", "\"", "partial", "\"_", ")_", "\\u\\u\\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_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Command", "s", " ", "tha", "t", " ", "work", " ", "direct", "ly", " ", "on", " ", "the", " ", "repos", "itor", "y", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "COMMA", "ND", "\\u", "LIST", "\\u", "REPO_", "=_", "[_", "\"", "init", "\"_", ",_", "\"", "news", "cope", "\"_", ",_", "\"", "scope", "s", "\"_", ",_", "\"", "log", "\"_", ",_", "\"", "tags", "\"_", ",_", "\"", "tag", "\"_", ",_", "\"", "list", "\"_", ",_", "\"", "copy", "\"_", ",_", "\"", "locat", "e", "\"_", ",_", "\"\\u", "manifest", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Command", "s", " ", "tha", "t", " ", "require", " ", "a", " ", "working", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "COMMA", "ND", "\\u", "LIST", "\\u", "WORK", "_", "=_", "[_", "\"", "check", "out", "\"_", ",_", "\"", "update", "\"_", ",_", "\"", "revert", "\"_", ",_", "\"", "id", "\"_", ",_", "\"", "ids", "\"_", ",_", "\"", "status", "\"_", ",_", "\"", "commit", "\"_", ",_", "\"", "track", "\"_", ",_", "\"", "untr", "ack", "\"_", ",_", "\"", "diff", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "owe", "d", " ", "command", " ", "abbreviation", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "COMMA", "ND", "\\u", "ABB", "REV", "S_", "=_", "{_", "\"", "cp", "\"_", ":_", "\"", "copy", "\"_", ",_", "\"", "ls", "\"_", ":_", "\"", "list", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "major", " ", "missi", "ng", " ", "features", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "support", " ", "nest", "ed", " ", "scope", "s", ":", " ", "manage", " ", "creati", "on", ",", " ", "regen", "eratio", "ns", " ", "of", " ", "manifests", ",", " ", "etc", ".", ";", " ", "als", "o", " ", "automati", "c", " ", "recurs", "ive", " ", "scope", " ", "update", "s", "/", "commits_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "locking", " ", "dur", "ing", " ", "commit", " ", "and", " ", "tag", " ", "operati", "ons", " ", "(", "No", "Lock", "ing", "Service", " ", "is", " ", "used", " ", "by", " ", "default", ",", " ", "need", " ", "to", " ", "acquir", "e", " ", "lock", "s", " ", "for", " ", "whole", " ", "operati", "on", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "use", " ", "sql", "ight", "3", " ", "inst", "ead", " ", "of", " ", "writ", "ing", " ", "check", "out", "-", "state", " ", "in", " ", "order", " ", "to", " ", "make", " ", "zin", "c", " ", "multi", "-", "process", " ", "safe_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "support", " ", "wildcards", " ", "*", " ", "bes", "ides", " ", "track", " ", "and", " ", "untr", "ack_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "importa", "nt", " ", "features", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "annot", "ation", "s", " ", "(", "like", " ", "tags", ",", " ", "but", " ", "key", "-", "value", " ", "pair", "s", ";", " ", "for", " ", "example", " ", "\"", "deploy", "\\u", "date", "=", "20120", "801", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "extend", " ", "the", " ", "Change", "list", " ", "class", " ", "to", " ", "include", " ", "Un", "modifi", "ed", " ", "and", " ", "Inva", "lid", " ", "state", "s", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "show", " ", "a", " ", "list", " ", "of", " ", "tracked", " ", "files", " ", "for", " ", "example", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "message", " ", "whe", "n", " ", "lz", "op", " ", "not", " ", "install", "ed", " ", "coul", "d", " ", "be", " ", "more", " ", "help", "ful_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "on", " ", "all", " ", "applica", "ble", " ", "scope", "s", " ", "for", " ", "--", "work", " ", "(", "and", " ", "--", "all", "),", " ", "and", " ", "fail", " ", "or", " ", "succe", "ed", " ", "for", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tolera", "te", " ", "(", "with", " ", "warn", "ing", ")", " ", "a", " ", "\"", "update", " ", "--", "work", "\"", " ", "whe", "n", " ", "scope", " ", "has", " ", "bee", "n", " ", "delete", "d", ";", " ", "als", "o", " ", "a", " ", "dels", "cope", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "post", "-", "upload", " ", "hook", ",", " ", "so", " ", "tha", "t", " ", "with", " ", "LZ", "O", " ", "compress", "ion", " ", "can", " ", "compute", " ", ".", "index", " ", "files", ",", " ", "for", " ", "use", " ", "with", " ", "Had", "oop", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "option", " ", "to", " ", "sanity", " ", "check", " ", "configura", "tion", " ", "(", "e", ".", "g", ".", " ", "boto", " ", "version", ",", " ", "lz", "op", " ", "command", " ", "is", " ", "presen", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "have", " ", "custom", " ", "output", " ", "format", " ", "with", " ", "just", " ", "revis", "ion", "s", " ", "e", ".", "g", ".", " ", "for", " ", "\"", "zin", "c", " ", "log", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "log", " ", "output", " ", "cleaner", "/", "brief", "er", " ", "(", "don", "'", "t", " ", "log", " ", "abo", "ut", " ", "copy", "ing", " ", "from", " ", "cache", ",", " ", "etc", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "commit", " ", "-", "u", "\"", " ", "tha", "t", " ", "doe", "s", " ", "update", " ", "and", " ", "commit", " ", "if", " ", "there", " ", "are", " ", "no", " ", "conflicts_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revert", " ", "to", " ", "other", " ", "revisions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "argu", "ment", "s", " ", "subst", "itut", "able", " ", "by", " ", "options", ";", " ", "handle", " ", "multiple", " ", "scope", "s", " ", "as", " ", "argu", "ment", "s", " ", "in", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", " ", "trail", "ing", " ", "/", " ", "on", " ", "scope", " ", "names", " ", "(", "if", " ", "provided", " ", "with", " ", "-", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "how", " ", "to", " ", "handle", " ", "update", " ", "after", " ", "a", " ", "client", " ", "delete", "s", " ", "a", " ", "file", " ", "and", " ", "it", "'", "s", " ", "als", "o", " ", "delete", "d", " ", "in", " ", "repo", " ", "(", "currentl", "y", " ", "this", " ", "is", " ", "a", " ", "confl", "ict", " ", "and", " ", "abort", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "an", " ", "update", ",", " ", "shou", "ld", " ", "remove", " ", "a", " ", "director", "y", " ", "whe", "n", " ", "all", " ", "files", " ", "in", " ", "the", " ", "director", "y", " ", "are", " ", "delete", "d", " ", "(", "but", " ", "what", " ", "if", " ", ".", "orig", " ", "files", " ", "are", " ", "presen", "t", "?)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "switch", " ", "to", " ", "usi", "ng", " ", "argp", "arse", " ", "inst", "ead", " ", "of", " ", "optparse", " ", "and", " ", "make", " ", "options", " ", "command", "-", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "accept", " ", "file", " ", "argu", "ment", "s", " ", "to", " ", "commit", " ", "and", " ", "per", "hap", "s", " ", "other", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fix", " ", "copy", " ", "command", " ", "to", " ", "take", " ", "multiple", " ", "args", ",", " ", "use", " ", "only", " ", "last", " ", "for", " ", "target_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", " ", "argu", "ment", " ", "path", " ", "names", " ", "tha", "t", " ", "are", " ", "relative", " ", "to", " ", "cwd_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "file", " ", "cache", ":", " ", "add", " ", "to", " ", "cache", " ", "on", " ", "upload", " ", "as", " ", "well", " ", "as", " ", "download_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "error", " ", "with", " ", "\"", "check", "out", " ", "-", "s", " ", "scope", "\"", " ", "followe", "d", " ", "by", " ", "\"", "check", "out", " ", "--", "all", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "delet", "ing", " ", "tags", ";", " ", "catch", " ", "invalid", " ", "or", " ", "duplicat", "e", " ", "tags", " ", "to", " ", "tags", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "\"", "fat", "\"", " ", "tags", " ", "tha", "t", " ", "have", " ", "multiple", " ", "keys", " ", "and", " ", "values", " ", "(", "e", ".", "g", ".", " ", "deploy", " ", "dates", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "scope", " ", "and", " ", "tags", " ", "in", " ", "log", " ", "command", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", " ", "of", " ", "individual", "/", "sets", " ", "of", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", " ", "update", "|", "check", "out", " ", "--", "work", "|--", "all", " ", "to", " ", "work", " ", "with", " ", "a", " ", "shared", " ", "tag", " ", "name", " ", "(-", "-", "force", " ", "to", " ", "override", " ", "if", " ", "only", " ", "some", " ", "scope", "s", " ", "have", " ", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fast", " ", "check", "out", " ", "feature", " ", "for", " ", "with", " ", "dummy", " ", "check", "out", " ", "files", " ", "(", "say", " ", "over", " ", "a", " ", "give", "n", " ", "size", ")", " ", "to", " ", "eas", "e", " ", "check", "out", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "integrity", " ", "checks", ":", " ", "we", " ", "alr", "ead", "y", " ", "do", " ", "mti", "me", "/", "size", "/", "md5", " ", "checks", ",", " ", "but", " ", "there", " ", "are", " ", "some", " ", "corn", "er", " ", "case", "s", " ", "to", " ", "cover", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "S", "3", ",", " ", "post", " ", "upload", ",", " ", "get", " ", "MD", "5", " ", "and", " ", "validat", "e", " ", "it", " ", "matche", "s", " ", "the", " ", "working", " ", "copy", " ", "MD", "5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "S", "3", ",", " ", "compute", " ", "MD", "5", "s", " ", "on", " ", "download", " ", "and", " ", "validat", "e", " ", "the", "y", " ", "match", " ", "S", "3", " ", "MD", "5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", " ", "S", "3", "-", "based", " ", "locking_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "locking", " ", "for", " ", "working", " ", "dir", " ", "to", " ", "prevent", " ", "two", " ", "command", "s", " ", "from", " ", "runn", "ing", " ", "at", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "manage", "ment", " ", "of", " ", "working", " ", "state", " ", "(", "zin", "c", " ", "add", ",", " ", "zin", "c", " ", "remove", ",", " ", "etc", ".)", " ", "(", "must", " ", "als", "o", " ", "ret", "hin", "k", " ", "logic", " ", "of", " ", "revert", " ", "command", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", " ", "different", " ", "signal", " ", "handler", "s", " ", "and", " ", "final", "ly", " ", "clause", "s", " ", "to", " ", "minimize", " ", "corrupt", " ", "working", " ", "dir", " ", "state", " ", "on", " ", "interrupt", "ion", " ", "(", "especial", "ly", " ", "check", "out", "-", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", "long", " ", "variatio", "n", " ", "on", " ", "id", " ", "and", " ", "ids", " ", "command", "s", ",", " ", "to", " ", "list", " ", "last", " ", "commit", " ", "msg", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "heuristic", " ", "to", " ", "not", " ", "compress", " ", "files", " ", "of", " ", "cert", "ain", " ", "size", " ", "or", " ", "tha", "t", " ", "are", " ", "alr", "ead", "y", " ", "compressed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", " ", "and", " ", "restore", " ", "file", " ", "modification", " ", "times", " ", "reliab", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "transaction", " ", "log", ",", " ", "with", " ", "timestamp", "s", ",", " ", "for", " ", "all", " ", "repo", " ", "transaction", "s", " ", "(", "suc", "h", " ", "as", " ", "addin", "g", "/", "remo", "ving", " ", "tags", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mail", "-", "out", " ", "hook", " ", "--", " ", "implement", " ", "through", " ", "transaction", " ", "log_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "delet", "ing", ",", " ", "keep", " ", "backup", "s", " ", "as", " ", ".", "orig", " ", "(", "and", " ", "add", " ", "to", " ", "ignore", " ", "list", "),", " ", "or", " ", "lea", "ve", " ", "in", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "config", " ", "settings", " ", "in", " ", "~", "/.", "zin", "crc_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "finish", " ", "basic", " ", "branch", " ", "support", ":", " ", "add", " ", "-", "b", " ", "option", ",", " ", "newb", "ranch", " ", "command", ",", " ", "and", " ", "\"", "branch", "\"", " ", "argu", "ment", " ", "acro", "ss", " ", "all", " ", "function", " ", "calls", " ", "tha", "t", " ", "take", " ", "a", " ", "scope_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multi", "-", "scope", " ", "support", ":", " ", "for", " ", "commit", "s", ",", " ", "automati", "call", "y", " ", "identify", " ", "all", " ", "encl", "osin", "g", " ", "scope", "s", " ", "for", " ", "a", " ", "commit", ",", " ", "and", " ", "commit", " ", "each", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "and", " ", "copy", " ", "for", " ", "path", "s", " ", "tha", "t", " ", "span", " ", "more", " ", "than", " ", "one", " ", "scope_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "file", " ", "size", "s", " ", "(", "and", " ", "option", "ally", " ", "hashe", "s", ",", " ", "dates", ",", " ", "etc", ".)", " ", "in", " ", "manifest", ";", " ", "will", " ", "make", " ", "detailed", " ", "listings", " ", "fast_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nice", "r", " ", "error", " ", "message", "s", " ", "for", " ", "invalid", " ", "revisions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "symlinks", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Redundant assignment
ARTbio/tools-artbio/tools/msp_sr_bowtie_parser/sRbowtieParser.py
[ { "content": "#!/usr/bin/python\n# python parser module to analyse sRbowtie alignments\n# version 1.0.2 - argparse implementation\n# Usage sRbowtieParser.py <1:index source> <2:extraction directive> <3:outputL> <4:polarity> <5:6:7 filePath:FileExt:FileLabel> <.. ad lib>\n\nimport sys, argparse\nfrom smRtools import *\n\n\n\nargs = Parser()\n\nIndexSource = args.IndexSource\ngenomeRefFormat = args.ExtractDirective\nOutput = args.output\nPolarity = args.polarity\nheader = [\"gene\"]\n\n\nFileLabelList=[label for label in args.alignmentLabel]\nheader.extend(FileLabelList)\nassert (len(FileLabelList)==len(set(FileLabelList))),\"You have supplied a non-unique label. Please make sure that your input files have unique names\"\n\ndata_source=zip (args.alignmentSource, args.alignmentFormat, args.alignmentLabel)\nmaster_generator=masterListGenerator(data_source)\n\nfor i,window in enumerate(master_generator):\n window=window\n if i==0:\n gene_count_dict={gene:[str(item.readcount(polarity=Polarity))] for gene,item in window.instanceDict.items()}\n else:\n [gene_count_dict[gene].append(str(item.readcount(polarity=Polarity))) for gene,item in window.instanceDict.items()]\n\n\nF = open (args.output, \"w\")\n# print >>F, args\nprint >> F, \"\\t\".join(header)\n\nfor item in sorted(gene_count_dict.keys()):\n line=[item]\n line.extend(gene_count_dict[item])\n print >> F, \"\\t\".join(line )\nF.close()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "window=window", "start_line": 41, "start_column": 2, "end_line": 41, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "parser", " ", "module", " ", "to", " ", "analyse", " ", "s", "Rb", "ow", "tie", " ", "alignments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", "1.0", ".2", " ", "-", " ", "argp", "arse", " ", "implementation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "age", " ", "s", "Rb", "ow", "tie", "Parser", ".", "py", " ", " ", "<", "1", ":", "index", " ", "source", ">", " ", "<", "2", ":", "extracti", "on", " ", "directive", ">", " ", "<", "3", ":", "output", "L", ">", " ", "<", "4", ":", "polarity", ">", " ", "<", "5", ":", "6", ":", "7", " ", "file", "Path", ":", "File", "Ext", ":", "File", "Label", ">", " ", "<", "..", " ", "ad", " ", " ", "lib", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sm", "Rt", "ools_", "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\\uDEDENT\\u\\u\\u_", "args_", "=_", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Index", "Source_", "=_", "args_", "._", "Index", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geno", "me", "Ref", "Format_", "=_", "args_", "._", "Extract", "Directive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Output_", "=_", "args_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Polari", "ty_", "=_", "args_", "._", "polarity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "[_", "\"", "gene", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "File", "Label", "List_", "=_", "[_", "label_", "for_", "label_", "in_", "args_", "._", "alignme", "nt", "Label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "._", "extend_", "(_", "File", "Label", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "File", "Label", "List_", ")_", "==_", "len_", "(_", "set_", "(_", "File", "Label", "List_", ")_", ")_", ")_", ",_", "\"", "You", " ", "have", " ", "supplie", "d", " ", "a", " ", "non", "-", "unique", " ", "label", ".", " ", "Ple", "ase", " ", "make", " ", "sure", " ", "tha", "t", " ", "your", " ", "input", " ", "files", " ", "have", " ", "unique", " ", "names", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "source_", "=_", "zip_", "(_", "args_", "._", "alignme", "nt", "Source_", ",_", "args_", "._", "alignme", "nt", "Format_", ",_", "args_", "._", "alignme", "nt", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "generator_", "=_", "master", "List", "Generator_", "(_", "data\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "window_", "in_", "enumerate_", "(_", "master", "\\u", "generator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gene", "\\u", "count", "\\u", "dict_", "=_", "{_", "gene_", ":_", "[_", "str_", "(_", "item_", "._", "read", "count_", "(_", "polarity", "_", "=_", "Polari", "ty_", ")_", ")_", "]_", "for_", "gene_", ",_", "item_", "in_", "window_", "._", "instance", "Dict_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "gene", "\\u", "count", "\\u", "dict_", "[_", "gene_", "]_", "._", "append_", "(_", "str_", "(_", "item_", "._", "read", "count_", "(_", "polarity", "_", "=_", "Polari", "ty_", ")_", ")_", ")_", "for_", "gene_", ",_", "item_", "in_", "window_", "._", "instance", "Dict_", "._", "items_", "(_", ")_", "]_", "\\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_", "F_", "=_", "open_", "(_", "args_", "._", "output_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", ">>", "F", ",", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "print_", ">>_", "F_", ",_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "sorted_", "(_", "gene", "\\u", "count", "\\u", "dict_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "[_", "item_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "._", "extend_", "(_", "gene", "\\u", "count", "\\u", "dict_", "[_", "item_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "F_", ",_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "F_", "._", "close_", "(_", ")_" ]
[ 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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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'
varepsilon/clickmodels/bin/run_inference.py
[ { "content": "#!/usr/bin/env python\n#coding: utf-8\n\n# Read from sys.stdin\n# Input format (see README.md for more details):\n# hash \\t query \\t region \\t intent_probability \\t url_list (json) \\t layout (json) \\t clicks (json)\n\n\nfrom clickmodels.inference import *\nfrom clickmodels.input_reader import InputReader\n\ntry:\n from config import *\nexcept:\n from clickmodels.config_sample import *\n\n\nif __name__ == '__main__':\n if DEBUG:\n DbnModel.testBackwardForward()\n allCombinations = []\n interestingValues = [0.9, 1.0]\n for g1 in interestingValues:\n for g2 in interestingValues:\n for g3 in interestingValues:\n for g4 in interestingValues:\n allCombinations.append((g1, g2, g3, g4))\n\n readInput = InputReader(MIN_DOCS_PER_QUERY, MAX_DOCS_PER_QUERY,\n EXTENDED_LOG_FORMAT, SERP_SIZE,\n TRAIN_FOR_METRIC,\n discard_no_clicks=True)\n sessions = readInput(sys.stdin)\n\n if TRAIN_FOR_METRIC and PRINT_EBU_STATS:\n # ---------------------------------------------------------------\n # For EBU\n # ---------------------------------------------------------------\n # Relevance -> P(Click | Relevance)\n p_C_R_frac = defaultdict(lambda: [0, 0.0001])\n # Relevance -> P(Leave | Click, Relevance)\n p_L_C_R_frac = defaultdict(lambda: [0, 0.0001])\n for s in sessions:\n lastClickPos = max((i for i, c in enumerate(s.clicks) if c != 0))\n for i in xrange(lastClickPos + 1):\n u = s.results[i]\n if s.clicks[i] != 0:\n p_C_R_frac[u][0] += 1\n if i == lastClickPos:\n p_L_C_R_frac[u][0] += 1\n p_L_C_R_frac[u][1] += 1\n p_C_R_frac[u][1] += 1\n\n for u in ['IRRELEVANT', 'RELEVANT', 'USEFUL', 'VITAL']:\n print 'P(C|%s)\\t%f\\tP(L|C,%s)\\t%f' % (u, float(p_C_R_frac[u][0]) / p_C_R_frac[u][1], u, float(p_L_C_R_frac[u][0]) / p_L_C_R_frac[u][1])\n # ---------------------------------------------------------------\n\n if len(sys.argv) > 1:\n with open(sys.argv[1]) as test_clicks_file:\n testSessions = readInput(test_clicks_file)\n else:\n testSessions = sessions\n\n if TRANSFORM_LOG:\n assert EXTENDED_LOG_FORMAT\n sessions, testSessions = (\n [x for x in (InputReader.mergeExtraToSessionItem(s, SERP_SIZE) for s in ss) if x] \\\n for ss in [sessions, testSessions]\n )\n else:\n sessions, testSessions = (\n [s for s in ss if InputReader.mergeExtraToSessionItem(s, SERP_SIZE)] \\\n for ss in [sessions, testSessions]\n )\n\n print 'Train sessions: %d, test sessions: %d' % (len(sessions), len(testSessions))\n print 'Number of train sessions with 10+ urls shown:', len([s for s in sessions if len(s.results) > SERP_SIZE + 1])\n #clickProbs = [0.0] * MAX_DOCS_PER_QUERY\n #counts = [0] * MAX_DOCS_PER_QUERY\n #for s in sessions:\n #for i, c in enumerate(s.clicks):\n #clickProbs[i] += 1 if c else 0\n #counts[i] += 1\n #print '\\t'.join((str(x / cnt if cnt else x) for (x, cnt) in zip(clickProbs, counts)))\n #sys.exit(0)\n\n config = {\n 'MAX_QUERY_ID': readInput.current_query_id + 1,\n 'MAX_ITERATIONS': MAX_ITERATIONS,\n 'DEBUG': DEBUG,\n 'PRETTY_LOG': PRETTY_LOG,\n 'MAX_DOCS_PER_QUERY': MAX_DOCS_PER_QUERY,\n 'SERP_SIZE': SERP_SIZE,\n 'TRANSFORM_LOG': TRANSFORM_LOG,\n 'QUERY_INDEPENDENT_PAGER': QUERY_INDEPENDENT_PAGER,\n 'DEFAULT_REL': DEFAULT_REL\n }\n del readInput # needed to minimize memory consumption (see gc.collect() below)\n\n if 'Baseline' in USED_MODELS:\n baselineModel = ClickModel(config=config)\n baselineModel.train(sessions)\n print 'Baseline:', baselineModel.test(testSessions)\n\n if 'SDBN' in USED_MODELS:\n sdbnModel = SimplifiedDbnModel(config=config)\n sdbnModel.train(sessions)\n if TRANSFORM_LOG:\n print '(a_p, s_p) = ', sdbnModel.urlRelevances[False][0]['PAGER']\n print 'SDBN:', sdbnModel.test(testSessions)\n del sdbnModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'UBM' in USED_MODELS:\n ubmModel = UbmModel(config=config)\n ubmModel.train(sessions)\n if TRAIN_FOR_METRIC:\n print '\\n'.join(['%s\\t%f' % r for r in \\\n [(x, ubmModel.alpha[False][0][x]) for x in \\\n ['IRRELEVANT', 'RELEVANT', 'USEFUL', 'VITAL']]])\n for d in xrange(MAX_DOCS_PER_QUERY):\n for r in xrange(MAX_DOCS_PER_QUERY):\n print ('%.4f ' % (ubmModel.gamma[0][r][MAX_DOCS_PER_QUERY - 1 - d] if r + d >= MAX_DOCS_PER_QUERY - 1 else 0)),\n print\n print 'UBM', ubmModel.test(testSessions)\n del ubmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'UBM-IA' in USED_MODELS:\n ubmModel = UbmModel(ignoreIntents=False, ignoreLayout=False, config=config)\n ubmModel.train(sessions)\n print 'UBM-IA', ubmModel.test(testSessions)\n del ubmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'EB_UBM' in USED_MODELS:\n ebUbmModel = EbUbmModel(config=config)\n ebUbmModel.train(sessions)\n # print 'Exploration bias:', ebUbmModel.e\n print 'EB_UBM', ebUbmModel.test(testSessions)\n del ebUbmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'EB_UBM-IA' in USED_MODELS:\n ebUbmModel = EbUbmModel(ignoreIntents=False, ignoreLayout=False, config=config)\n ebUbmModel.train(sessions)\n # print 'Exploration bias:', ebUbmModel.e\n print 'EB_UBM-IA', ebUbmModel.test(testSessions)\n del ebUbmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'DCM' in USED_MODELS:\n dcmModel = DcmModel(config=config)\n dcmModel.train(sessions)\n if TRAIN_FOR_METRIC:\n print '\\n'.join(['%s\\t%f' % r for r in \\\n [(x, dcmModel.urlRelevances[False][0][x]) for x in \\\n ['IRRELEVANT', 'RELEVANT', 'USEFUL', 'VITAL']]])\n print 'DCM gammas:', dcmModel.gammas\n print 'DCM', dcmModel.test(testSessions)\n del dcmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'DCM-IA' in USED_MODELS:\n dcmModel = DcmModel(ignoreIntents=False, ignoreLayout=False, config=config)\n dcmModel.train(sessions)\n # print 'DCM gammas:', dcmModel.gammas\n print 'DCM-IA', dcmModel.test(testSessions)\n del dcmModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'DBN' in USED_MODELS:\n dbnModel = DbnModel((0.9, 0.9, 0.9, 0.9), config=config)\n dbnModel.train(sessions)\n print 'DBN:', dbnModel.test(testSessions)\n for session in testSessions:\n print \"relevances\", dbnModel.get_model_relevances(session)\n print \"clicks\", dbnModel.generate_clicks(session)\n del dbnModel # needed to minimize memory consumption (see gc.collect() below)\n\n if 'DBN-IA' in USED_MODELS:\n for gammas in allCombinations:\n gc.collect()\n dbnModel = DbnModel(gammas, ignoreIntents=False, ignoreLayout=False, config=config)\n dbnModel.train(sessions)\n print 'DBN-IA: %.2f %.2f %.2f %.2f' % gammas, dbnModel.test(testSessions)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "from", " ", "sys", ".", "stdin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inp", "ut", " ", "format", " ", "(", "see", " ", "READ", "ME", ".", "md", " ", "for", " ", "more", " ", "deta", "il", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hash", " ", "\\\\", "t", " ", "query", " ", "\\\\", "t", " ", "region", " ", "\\\\", "t", " ", "intent", "\\u", "probabilit", "y", " ", "\\\\", "t", " ", "url", "\\u", "list", " ", "(", "json", ")", " ", "\\\\", "t", " ", "layout", " ", "(", "json", ")", " ", "\\\\", "t", " ", "clicks", " ", "(", "json", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "click", "models_", "._", "inference_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "click", "models_", "._", "input", "\\u", "reader_", "import_", "Inp", "ut", "Reader_", "\\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_", "config_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "click", "models_", "._", "config", "\\u", "sample_", "import_", "*_", "\\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 ", " _", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Db", "n", "Model_", "._", "test", "Backward", "Forward_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "Combinat", "ions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interesting", "Values_", "=_", "[_", "0.9_", ",_", "1.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g1_", "in_", "interesting", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "g2_", "in_", "interesting", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "g3", "_", "in_", "interesting", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "g", "4_", "in_", "interesting", "Values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "Combinat", "ions_", "._", "append_", "(_", "(_", "g1_", ",_", "g2_", ",_", "g3", "_", ",_", "g", "4_", ")_", ")_", "\\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_", "read", "Input_", "=_", "Inp", "ut", "Reader_", "(_", "MIN", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", ",_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EXTEND", "ED", "\\u", "LOG", "\\u", "FORMAT_", ",_", "SER", "P", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TRAIN", "\\u", "FOR", "\\u", "METRIC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "discard", "\\u", "no", "\\u", "clicks", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sessions_", "=_", "read", "Input_", "(_", "sys_", "._", "stdin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "TRAIN", "\\u", "FOR", "\\u", "METRIC", "_", "and_", "PRINT", "\\u", "EB", "U", "\\u", "STATS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "For", " ", "EB", "U_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rel", "eva", "nce", " ", "->", " ", "P", "(", "Click", " ", "|", " ", "Rel", "eva", "nce", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "C", "\\u", "R", "\\u", "frac_", "=_", "defaultdict_", "(_", "lambda_", ":_", "[_", "0_", ",_", "0.0001_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rel", "eva", "nce", " ", "->", " ", "P", "(", "Leav", "e", " ", "|", " ", "Click", ",", " ", "Rel", "eva", "nce", ")_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "L", "\\u", "C", "\\u", "R", "\\u", "frac_", "=_", "defaultdict_", "(_", "lambda_", ":_", "[_", "0_", ",_", "0.0001_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "sessions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "Click", "Pos_", "=_", "max_", "(_", "(_", "i_", "for_", "i_", ",_", "c_", "in_", "enumerate_", "(_", "s_", "._", "clicks", "_", ")_", "if_", "c_", "!=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "last", "Click", "Pos_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "=_", "s_", "._", "results_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "clicks", "_", "[_", "i_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "p", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "last", "Click", "Pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "p", "\\u", "L", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "L", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "u_", "in_", "[_", "'", "IR", "REL", "EV", "ANT", "'_", ",_", "'", "REL", "EV", "ANT", "'_", ",_", "'", "USE", "FU", "L", "'_", ",_", "'", "VIT", "AL", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "P", "(", "C", "|", "%", "s", ")\\\\", "t", "%", "f", "\\\\", "t", "P", "(", "L", "|", "C", ",%", "s", ")\\\\", "t", "%", "f", "'_", "%_", "(_", "u_", ",_", "float_", "(_", "p", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "0_", "]_", ")_", "/_", "p", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "1_", "]_", ",_", "u_", ",_", "float_", "(_", "p", "\\u", "L", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "0_", "]_", ")_", "/_", "p", "\\u", "L", "\\u", "C", "\\u", "R", "\\u", "frac_", "[_", "u_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "as_", "test\\u", "clicks", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Sess", "ions_", "=_", "read", "Input_", "(_", "test\\u", "clicks", "\\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 ", " _", "test", "Sess", "ions_", "=_", "sessions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "TRANSFORM", "\\u", "LOG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "EXTEND", "ED", "\\u", "LOG", "\\u", "FORMAT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sessions_", ",_", "test", "Sess", "ions_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "x_", "for_", "x_", "in_", "(_", "Inp", "ut", "Reader_", "._", "merge", "Extra", "To", "Sess", "ion", "Item_", "(_", "s_", ",_", "SER", "P", "\\u", "SIZE_", ")_", "for_", "s_", "in_", "ss_", ")_", "if_", "x_", "]_", "for_", "ss_", "in_", "[_", "sessions_", ",_", "test", "Sess", "ions_", "]_", "\\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 ", " _", "sessions_", ",_", "test", "Sess", "ions_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "s_", "for_", "s_", "in_", "ss_", "if_", "Inp", "ut", "Reader_", "._", "merge", "Extra", "To", "Sess", "ion", "Item_", "(_", "s_", ",_", "SER", "P", "\\u", "SIZE_", ")_", "]_", "for_", "ss_", "in_", "[_", "sessions_", ",_", "test", "Sess", "ions_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Train", " ", "session", "s", ":", " ", "%", "d", ",", " ", "test", " ", "session", "s", ":", " ", "%", "d", "'_", "%_", "(_", "len_", "(_", "sessions_", ")_", ",_", "len_", "(_", "test", "Sess", "ions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Number", " ", "of", " ", "train", " ", "session", "s", " ", "with", " ", "10", "+", " ", "urls", " ", "shown", ":'_", ",_", "len_", "(_", "[_", "s_", "for_", "s_", "in_", "sessions_", "if_", "len_", "(_", "s_", "._", "results_", ")_", ">_", "SER", "P", "\\u", "SIZE_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "click", "Prob", "s", " ", "=", " ", "[", "0.", "0", "]", " ", "*", " ", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", "\\u\\u\\uNL\\u\\u\\u_", "#", "count", "s", " ", "=", " ", "[", "0", "]", " ", "*", " ", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "s", " ", "in", " ", "session", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "i", ",", " ", "c", " ", "in", " ", "enumerate", "(", "s", ".", "clicks", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "click", "Prob", "s", "[", "i", "]", " ", "+=", " ", "1", " ", "if", " ", "c", " ", "else", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "count", "s", "[", "i", "]", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'\\\\", "t", "'.", "join", "((", "str", "(", "x", " ", "/", " ", "cnt", " ", "if", " ", "cnt", " ", "else", " ", "x", ")", " ", "for", " ", "(", "x", ",", " ", "cnt", ")", " ", "in", " ", "zip", "(", "click", "Prob", "s", ",", " ", "count", "s", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAX", "\\u", "QUE", "RY", "\\u", "ID", "'_", ":_", "read", "Input_", "._", "current", "\\u", "query", "\\u", "id_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAX", "\\u", "ITERA", "TIONS", "'_", ":_", "MAX", "\\u", "ITERA", "TIONS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEBU", "G", "'_", ":_", "DEBUG_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PRE", "TTY", "\\u", "LOG", "'_", ":_", "PRE", "TTY", "\\u", "LOG_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUE", "RY", "'_", ":_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SER", "P", "\\u", "SIZE", "'_", ":_", "SER", "P", "\\u", "SIZE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRANSFORM", "\\u", "LOG", "'_", ":_", "TRANSFORM", "\\u", "LOG_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "QUE", "RY", "\\u", "INDE", "PEND", "ENT", "\\u", "PAGE", "R", "'_", ":_", "QUE", "RY", "\\u", "INDE", "PEND", "ENT", "\\u", "PAGE", "R_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEF", "AUL", "T", "\\u", "REL", "'_", ":_", "DEF", "AUL", "T", "\\u", "REL", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "read", "Input_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "Base", "line", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "baseline", "Model_", "=_", "Click", "Model_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Base", "line", ":'_", ",_", "baseline", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "SD", "BN", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sdb", "n", "Model_", "=_", "Simplif", "ied", "Db", "n", "Model_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdb", "n", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "TRANSFORM", "\\u", "LOG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'(", "a", "\\u", "p", ",", " ", "s", "\\u", "p", ")", " ", "=", " ", "'_", ",_", "sdb", "n", "Model_", "._", "url", "Rel", "eva", "nces_", "[_", "False_", "]_", "[_", "0_", "]_", "[_", "'", "PAGE", "R", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "SD", "BN", ":'_", ",_", "sdb", "n", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sdb", "n", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "UB", "M", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ubm", "Model_", "=_", "Ub", "m", "Model_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ubm", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "TRAIN", "\\u", "FOR", "\\u", "METRIC", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "'%", "s", "\\\\", "t", "%", "f", "'_", "%_", "r_", "for_", "r_", "in_", "[_", "(_", "x_", ",_", "ubm", "Model_", "._", "alpha_", "[_", "False_", "]_", "[_", "0_", "]_", "[_", "x_", "]_", ")_", "for_", "x_", "in_", "[_", "'", "IR", "REL", "EV", "ANT", "'_", ",_", "'", "REL", "EV", "ANT", "'_", ",_", "'", "USE", "FU", "L", "'_", ",_", "'", "VIT", "AL", "'_", "]_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "xrange_", "(_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "r_", "in_", "xrange_", "(_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'%", ".4", "f", " ", "'_", "%_", "(_", "ubm", "Model_", "._", "gamma_", "[_", "0_", "]_", "[_", "r_", "]_", "[_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", "-_", "1_", "-_", "d_", "]_", "if_", "r_", "+_", "d_", ">=_", "MAX", "\\u", "DOCS", "\\u", "PER", "\\u", "QUERY_", "-_", "1_", "else_", "0_", ")_", ")_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "UB", "M", "'_", ",_", "ubm", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ubm", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "UB", "M", "-", "IA", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ubm", "Model_", "=_", "Ub", "m", "Model_", "(_", "ignore", "Inten", "ts_", "=_", "False_", ",_", "ignore", "Layout_", "=_", "False_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ubm", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "UB", "M", "-", "IA", "'_", ",_", "ubm", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ubm", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "EB", "\\u", "UB", "M", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eb", "Ub", "m", "Model_", "=_", "Eb", "Ub", "m", "Model_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eb", "Ub", "m", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "Explo", "ration", " ", "bias", ":'", ",", " ", "eb", "Ub", "m", "Model", ".", "e_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "EB", "\\u", "UB", "M", "'_", ",_", "eb", "Ub", "m", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "eb", "Ub", "m", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "EB", "\\u", "UB", "M", "-", "IA", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eb", "Ub", "m", "Model_", "=_", "Eb", "Ub", "m", "Model_", "(_", "ignore", "Inten", "ts_", "=_", "False_", ",_", "ignore", "Layout_", "=_", "False_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eb", "Ub", "m", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "Explo", "ration", " ", "bias", ":'", ",", " ", "eb", "Ub", "m", "Model", ".", "e_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "EB", "\\u", "UB", "M", "-", "IA", "'_", ",_", "eb", "Ub", "m", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "eb", "Ub", "m", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "DCM", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dcm", "Model_", "=_", "Dc", "m", "Model_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dcm", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "TRAIN", "\\u", "FOR", "\\u", "METRIC", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "'%", "s", "\\\\", "t", "%", "f", "'_", "%_", "r_", "for_", "r_", "in_", "[_", "(_", "x_", ",_", "dcm", "Model_", "._", "url", "Rel", "eva", "nces_", "[_", "False_", "]_", "[_", "0_", "]_", "[_", "x_", "]_", ")_", "for_", "x_", "in_", "[_", "'", "IR", "REL", "EV", "ANT", "'_", ",_", "'", "REL", "EV", "ANT", "'_", ",_", "'", "USE", "FU", "L", "'_", ",_", "'", "VIT", "AL", "'_", "]_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "DCM", " ", "gamma", "s", ":'_", ",_", "dcm", "Model_", "._", "gamma", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "DCM", "'_", ",_", "dcm", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dcm", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "DCM", "-", "IA", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dcm", "Model_", "=_", "Dc", "m", "Model_", "(_", "ignore", "Inten", "ts_", "=_", "False_", ",_", "ignore", "Layout_", "=_", "False_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dcm", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "DCM", " ", "gamma", "s", ":'", ",", " ", "dcm", "Model", ".", "gamma", "s_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "DCM", "-", "IA", "'_", ",_", "dcm", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dcm", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "DB", "N", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "n", "Model_", "=_", "Db", "n", "Model_", "(_", "(_", "0.9_", ",_", "0.9_", ",_", "0.9_", ",_", "0.9_", ")_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "n", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "DB", "N", ":'_", ",_", "db", "n", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "session_", "in_", "test", "Sess", "ions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "relevance", "s", "\"_", ",_", "db", "n", "Model_", "._", "get", "\\u", "model", "\\u", "relevance", "s_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "clicks", "\"_", ",_", "db", "n", "Model_", "._", "generat", "e\\u", "clicks", "_", "(_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "db", "n", "Model_", "#", " ", "need", "ed", " ", "to", " ", "minimize", " ", "memory", " ", "consum", "ption", " ", "(", "see", " ", "gc", ".", "collect", "()", " ", "belo", "w", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "DB", "N", "-", "IA", "'_", "in_", "USED", "\\u", "MODEL", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "gamma", "s_", "in_", "all", "Combinat", "ions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "n", "Model_", "=_", "Db", "n", "Model_", "(_", "gamma", "s_", ",_", "ignore", "Inten", "ts_", "=_", "False_", ",_", "ignore", "Layout_", "=_", "False_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "n", "Model_", "._", "train_", "(_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "DB", "N", "-", "IA", ":", " ", "%", ".2", "f", " ", "%", ".2", "f", " ", "%", ".2", "f", " ", "%", ".2", "f", "'_", "%_", "gamma", "s_", ",_", "db", "n", "Model_", "._", "test_", "(_", "test", "Sess", "ions_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Imprecise assert
STIXProject/python-stix/stix/test/common/structured_text_tests.py
[ { "content": " def test_add(self):\n slist = common.StructuredTextList()\n st1 = common.StructuredText(\"foo\", ordinality=1)\n st2 = common.StructuredText(\"bar\", ordinality=2)\n\n slist.add(st1)\n slist.add(st2)\n\n self.assertTrue(st1 in slist)\n self.assertTrue(st2 in slist)", "metadata": "root.StructuredTextListTests.test_add", "header": "['class', 'StructuredTextListTests', '(', 'unittest', '.', 'TestCase', ',', 'TypedListTestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_delitem(self):\n slist = common.StructuredTextList()\n st1 = common.StructuredText(\"foo\", ordinality=1)\n st2 = common.StructuredText(\"bar\", ordinality=2)\n\n slist.add(st1)\n slist.add(st2)\n\n del slist[1]\n\n self.assertTrue(st1 not in slist)\n self.assertTrue(st2 in slist)\n self.assertRaises(\n KeyError,\n slist.__getitem__,\n 1\n )", "metadata": "root.StructuredTextListTests.test_delitem", "header": "['class', 'StructuredTextListTests', '(', 'unittest', '.', 'TestCase', ',', 'TypedListTestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_remove(self):\n slist = common.StructuredTextList()\n st1 = common.StructuredText(\"foo\", ordinality=1)\n st2 = common.StructuredText(\"bar\", ordinality=2)\n\n slist.add(st1)\n slist.add(st2)\n slist.remove(st1)\n\n self.assertTrue(st1 not in slist)\n self.assertTrue(st2 in slist)\n self.assertRaises(\n KeyError,\n slist.__getitem__,\n 1\n )", "metadata": "root.StructuredTextListTests.test_remove", "header": "['class', 'StructuredTextListTests', '(', 'unittest', '.', 'TestCase', ',', 'TypedListTestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_update(self):\n slist = common.StructuredTextList()\n st1 = common.StructuredText(\"foo\", ordinality=1)\n st2 = common.StructuredText(\"bar\", ordinality=2)\n\n slist.add(st1)\n slist.add(st2)\n\n new_st1 = common.StructuredText(\"FOO\", ordinality=1)\n new_st2 = common.StructuredText(\"BAR\", ordinality=2)\n\n newlist = [new_st1, new_st2]\n slist.update(newlist)\n\n self.assertEqual(slist[1], new_st1)\n self.assertEqual(slist[2], new_st2)\n self.assertTrue(st1 not in slist)\n self.assertTrue(st2 not in slist)", "metadata": "root.StructuredTextListTests.test_update", "header": "['class', 'StructuredTextListTests', '(', 'unittest', '.', 'TestCase', ',', 'TypedListTestCase', ')', ':', '___EOS___']", "index": 141 } ]
[ { "span": "self.assertTrue(st1 in slist)", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 37 }, { "span": "self.assertTrue(st2 in slist)", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 37 }, { "span": "self.assertTrue(st1 not in slist)", "start_line": 116, "start_column": 8, "end_line": 116, "end_column": 41 }, { "span": "self.assertTrue(st2 in slist)", "start_line": 117, "start_column": 8, "end_line": 117, "end_column": 37 }, { "span": "self.assertTrue(st1 not in slist)", "start_line": 133, "start_column": 8, "end_line": 133, "end_column": 41 }, { "span": "self.assertTrue(st2 in slist)", "start_line": 134, "start_column": 8, "end_line": 134, "end_column": 37 }, { "span": "self.assertTrue(st1 not in slist)", "start_line": 157, "start_column": 8, "end_line": 157, "end_column": 41 }, { "span": "self.assertTrue(st2 not in slist)", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Structur", "ed", "Text", "List", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Type", "d", "List", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slist_", "=_", "common_", "._", "Structur", "ed", "Text", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "foo", "\"_", ",_", "ordinal", "ity_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st2", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "bar", "\"_", ",_", "ordinal", "ity_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "add_", "(_", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "add_", "(_", "st2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st1", "_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st2", "_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Structur", "ed", "Text", "List", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Type", "d", "List", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "deli", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slist_", "=_", "common_", "._", "Structur", "ed", "Text", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "foo", "\"_", ",_", "ordinal", "ity_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st2", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "bar", "\"_", ",_", "ordinal", "ity_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "add_", "(_", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "add_", "(_", "st2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "slist_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st1", "_", "not_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st2", "_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Key", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Structur", "ed", "Text", "List", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Type", "d", "List", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "remove_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slist_", "=_", "common_", "._", "Structur", "ed", "Text", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "foo", "\"_", ",_", "ordinal", "ity_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st2", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "bar", "\"_", ",_", "ordinal", "ity_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "add_", "(_", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "add_", "(_", "st2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "remove_", "(_", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st1", "_", "not_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "st2", "_", "in_", "slist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Key", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Structur", "ed", "Text", "List", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Type", "d", "List", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slist_", "=_", "common_", "._", "Structur", "ed", "Text", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "foo", "\"_", ",_", "ordinal", "ity_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st2", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "bar", "\"_", ",_", "ordinal", "ity_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "slist_", "._", "add_", "(_", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "add_", "(_", "st2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "st1", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "FOO", "\"_", ",_", "ordinal", "ity_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "st2", "_", "=_", "common_", "._", "Structur", "ed", "Text_", "(_", "\"", "BAR", "\"_", ",_", "ordinal", "ity_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newli", "st_", "=_", "[_", "new", "\\u", "st1", "_", ",_", "new", "\\u", "st2", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slist_", "._", "update_", "(_", "newli", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "slist_", "[_", "1_", "]_", ",_", "new", "\\u", "st1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "slist_", "[_", "2_", "]_", ",_", "new", "\\u", "st2", "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2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/setuptools/command/install_egg_info.py
[ { "content": "from setuptools import Command\nfrom setuptools.archive_util import unpack_archive\nfrom distutils import log, dir_util\nimport os, shutil, pkg_resources\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class install_egg_info(Command):\n \"\"\"Install an .egg-info directory for the package\"\"\"\n\n description = \"Install an .egg-info directory for the package\"\n\n user_options = [\n ('install-dir=', 'd', \"directory to install 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.install_egg_info", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def initialize_options(self):\n self.install_dir = None", "metadata": "root.install_egg_info.initialize_options", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 14 }, { "content": " def finalize_options(self):\n self.set_undefined_options('install_lib',('install_dir','install_dir'))\n ei_cmd = self.get_finalized_command(\"egg_info\")\n basename = pkg_resources.Distribution(\n None, None, ei_cmd.egg_name, ei_cmd.egg_version\n ).egg_name()+'.egg-info'\n self.source = ei_cmd.egg_info\n self.target = os.path.join(self.install_dir, basename)\n self.outputs = [self.target]", "metadata": "root.install_egg_info.finalize_options", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 17 }, { "content": " def run(self):\n self.run_command('egg_info')\n target = self.target\n if os.path.isdir(self.target) and not os.path.islink(self.target):\n dir_util.remove_tree(self.target, dry_run=self.dry_run)\n elif os.path.exists(self.target):\n self.execute(os.unlink,(self.target,),\"Removing \"+self.target)\n if not self.dry_run:\n pkg_resources.ensure_directory(self.target)\n self.execute(self.copytree, (),\n \"Copying %s to %s\" % (self.source, self.target)\n )\n self.install_namespaces()", "metadata": "root.install_egg_info.run", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 27 }, { "content": " def get_outputs(self):\n return self.outputs", "metadata": "root.install_egg_info.get_outputs", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 41 }, { "content": " def copytree(self):\n # Copy the .egg-info tree to site-packages\n def skimmer(src,dst):\n # filter out source-control directories; note that 'src' is always\n # a '/'-separated path, regardless of platform. 'dst' is a\n # platform-specific path.\n for skip in '.svn/','CVS/':\n if src.startswith(skip) or '/'+skip in src:\n return None\n self.outputs.append(dst)\n log.debug(\"Copying %s to %s\", src, dst)\n return dst\n unpack_archive(self.source, self.target, skimmer)", "metadata": "root.install_egg_info.copytree", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 44 }, { "content": " def install_namespaces(self):\n nsp = self._get_all_ns_packages()\n if not nsp: return\n filename,ext = os.path.splitext(self.target)\n filename += '-nspkg.pth'; self.outputs.append(filename)\n log.info(\"Installing %s\",filename)\n if not self.dry_run:\n f = open(filename,'wt')\n for pkg in nsp:\n # ensure pkg is not a unicode string under Python 2.7\n pkg = str(pkg)\n pth = tuple(pkg.split('.'))\n trailer = '\\n'\n if '.' in pkg:\n trailer = (\n \"; m and setattr(sys.modules[%r], %r, m)\\n\"\n % ('.'.join(pth[:-1]), pth[-1])\n )\n f.write(\n \"import sys,types,os; \"\n \"p = os.path.join(sys._getframe(1).f_locals['sitedir'], \"\n \"*%(pth)r); \"\n \"ie = os.path.exists(os.path.join(p,'__init__.py')); \"\n \"m = not ie and \"\n \"sys.modules.setdefault(%(pkg)r,types.ModuleType(%(pkg)r)); \"\n \"mp = (m or []) and m.__dict__.setdefault('__path__',[]); \"\n \"(p not in mp) and mp.append(p)%(trailer)s\"\n % locals()\n )\n f.close()", "metadata": "root.install_egg_info.install_namespaces", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 82 }, { "content": " def _get_all_ns_packages(self):\n nsp = {}\n for pkg in self.distribution.namespace_packages or []:\n pkg = pkg.split('.')\n while pkg:\n nsp['.'.join(pkg)] = 1\n pkg.pop()\n nsp=list(nsp)\n nsp.sort() # set up shorter names first\n return nsp", "metadata": "root.install_egg_info._get_all_ns_packages", "header": "['class', 'install_egg_info', '(', 'Command', ')', ':', '___EOS___']", "index": 113 } ]
[ { "span": "import os, shutil, pkg_resources", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "setuptools_", "import_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "._", "archive", "\\u", "util_", "import_", "unpack", "\\u", "archive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "import_", "log_", ",_", "dir\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "shutil_", ",_", "pkg", "\\u", "resources_", "\\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_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Install", " ", "an", " ", ".", "egg", "-", "info", " ", "director", "y", " ", "for", " ", "the", " ", "package", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Install", " ", "an", " ", ".", "egg", "-", "info", " ", "director", "y", " ", "for", " ", "the", " ", "package", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "options_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "install", "-", "dir", "='_", ",_", "'", "d", "'_", ",_", "\"", "director", "y", " ", "to", " ", "install", " ", "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\\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_", "\\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_", "\\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_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "\\u", "dir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "undefined", "\\u", "options_", "(_", "'", "install", "\\u", "lib", "'_", ",_", "(_", "'", "install", "\\u", "dir", "'_", ",_", "'", "install", "\\u", "dir", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ei", "\\u", "cmd_", "=_", "self_", "._", "get", "\\u", "finalize", "d\\u", "command_", "(_", "\"", "egg", "\\u", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basename_", "=_", "pkg", "\\u", "resources_", "._", "Distribution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "None_", ",_", "ei", "\\u", "cmd_", "._", "egg", "\\u", "name_", ",_", "ei", "\\u", "cmd_", "._", "egg", "\\u", "version_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "egg", "\\u", "name_", "(_", ")_", "+_", "'.", "egg", "-", "info", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "ei", "\\u", "cmd_", "._", "egg", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "install", "\\u", "dir_", ",_", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "outputs_", "=_", "[_", "self_", "._", "target_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "command_", "(_", "'", "egg", "\\u", "info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "self_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "target_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dir\\u", "util_", "._", "remove", "\\u", "tree_", "(_", "self_", "._", "target_", ",_", "dry", "\\u", "run_", "=_", "self_", "._", "dry", "\\u", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "execute_", "(_", "os_", "._", "unlink_", ",_", "(_", "self_", "._", "target_", ",_", ")_", ",_", "\"", "Remo", "ving", " ", "\"_", "+_", "self_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "resources_", "._", "ensure", "\\u", "directory_", "(_", "self_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "execute_", "(_", "self_", "._", "copytree_", ",_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Copy", "ing", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "source_", ",_", "self_", "._", "target_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "install", "\\u", "namespaces_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "outputs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copytree_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", ".", "egg", "-", "info", " ", "tree", " ", "to", " ", "site", "-", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "ski", "mme", "r_", "(_", "src_", ",_", "dst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "filter", " ", "out", " ", "source", "-", "control", " ", "director", "ies", ";", " ", "note", " ", "tha", "t", " ", "'", "src", "'", " ", "is", " ", "alw", "ays_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "'/'", "-", "separate", "d", " ", "path", ",", " ", "rega", "rd", "less", " ", "of", " ", "platform", ".", " ", " ", "'", "dst", "'", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "platform", "-", "specific", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "skip_", "in_", "'.", "svn", "/'_", ",_", "'", "CV", "S", "/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "src_", "._", "startswith_", "(_", "skip_", ")_", "or_", "'/'_", "+_", "skip_", "in_", "src_", ":_", "\\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_", "self_", "._", "outputs_", "._", "append_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Copy", "ing", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", ",_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unpack", "\\u", "archive_", "(_", "self_", "._", "source_", ",_", "self_", "._", "target_", ",_", "ski", "mme", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install", "\\u", "namespaces_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsp", "_", "=_", "self_", "._", "\\u", "get", "\\u", "all", "\\u", "ns", "\\u", "packages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "nsp", "_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", ",_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "self_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "+=_", "'-", "nsp", "kg", ".", "pth", "'_", ";_", "self_", "._", "outputs_", "._", "append_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "Install", "ing", " ", "%", "s", "\"_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "wt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pkg_", "in_", "nsp", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "pkg", " ", "is", " ", "not", " ", "a", " ", "unicode", " ", "string", " ", "under", " ", "Pyth", "on", " ", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg_", "=_", "str_", "(_", "pkg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pth_", "=_", "tuple_", "(_", "pkg_", "._", "split_", "(_", "'.'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trailer", "_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'.'_", "in_", "pkg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "trailer", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\";", " ", "m", " ", "and", " ", "setattr", "(", "sys", ".", "module", "s", "[", "%", "r", "],", " ", "%", "r", ",", " ", "m", ")\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "'.'_", "._", "join_", "(_", "pth_", "[_", ":_", "-_", "1_", "]_", ")_", ",_", "pth_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "import", " ", "sys", ",", "types", ",", "os", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "p", " ", "=", " ", "os", ".", "path", ".", "join", "(", "sys", ".\\u", "getf", "rame", "(", "1", ").", "f", "\\u", "locals", "['", "site", "dir", "']", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"*", "%", "(", "pth", ")", "r", ");", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ie", " ", "=", " ", "os", ".", "path", ".", "exist", "s", "(", "os", ".", "path", ".", "join", "(", "p", ",'", "\\u\\u", "init", "\\u\\u", ".", "py", "'))", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m", " ", "=", " ", "not", " ", "ie", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sys", ".", "module", "s", ".", "setdefault", "(%", "(", "pkg", ")", "r", ",", "types", ".", "Modul", "e", "Type", "(%", "(", "pkg", ")", "r", "))", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp", " ", "=", " ", "(", "m", " ", "or", " ", "[]", ")", " ", "and", " ", "m", ".\\u", "\\u", "dict", "\\u\\u", ".", "setdefault", "('\\", "u\\u", "path", "\\u\\u'", ",", "[]", ");", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "p", " ", "not", " ", "in", " ", "mp", ")", " ", "and", " ", "mp", ".", "append", "(", "p", ")%", "(", "trailer", ")", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "install", "\\u", "egg", "\\u", "info_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "all", "\\u", "ns", "\\u", "packages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsp", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pkg_", "in_", "self_", "._", "distribution_", "._", "namespace", "\\u", "packages_", "or_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg_", "=_", "pkg_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "pkg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsp", "_", "[_", "'.'_", "._", "join_", "(_", "pkg_", ")_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nsp", "_", "=_", "list_", "(_", "nsp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nsp", "_", "._", "sort_", "(_", ")_", "#", " ", "set", " ", "up", " ", "shorter", " ", "names", " ", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "nsp", "_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Variable defined multiple times
impactlab/eemeter/eemeter/uploader/api.py
[ { "content": "def upload_dataframes2(project_df, consumption_df, url, access_token, project_owner, verbose=True):\n \"\"\"Uploads a set of formatted project and consumption data formatted as\n CSVs to a datastore instance.\n\n Parameters\n ----------\n project_df : pandas.DataFrame\n File pointer to a CSV with the following columns::\n\n project_id,zipcode,weather_station,latitude,longitude,baseline_period_end,reporting_period_start\n\n Extra columns will be treated as project attributes.\n\n consumption_dict : pandas.DataFrame\n File pointer to a CSV with the following columns::\n\n project_id,start,end,fuel_type,unit_name,value,estimated\n\n access_token : str\n Access token for the target datastore.\n project_owner : int\n Primary key of project_owner for datastore.\n verbose : bool, default: True\n Whether or not to output a log of progress.\n \"\"\"\n requester = Requester(url, access_token)\n project_attribute_key_uploader = uploaders.ProjectAttributeKeyUploader(requester, verbose)\n project_uploader = uploaders.ProjectUploader(requester, verbose)\n project_attribute_uploader = uploaders.ProjectAttributeUploader(requester, verbose)\n consumption_metadata_uploader = uploaders.ConsumptionMetadataUploader(requester, verbose)\n consumption_record_uploader = uploaders.ConsumptionRecordUploader(requester, verbose)\n\n # project attribute keys\n project_attribute_keys_data = _get_project_attribute_keys_data(project_df)\n for data in project_attribute_keys_data:\n\n # sync the project attribute keys\n response_data = project_attribute_key_uploader.sync(data)\n\n data.update(response_data) # adds the \"id\" field\n\n project_ids = {}\n for project_data, project_attributes_data in \\\n _get_project_data(project_df, project_attribute_keys_data):\n\n # upload project\n project_data[\"project_owner\"] = project_owner\n project_response_data = project_uploader.sync(project_data)\n\n # store project_id to speed things up a bit in the consumption data uploading\n project_id = project_response_data[\"project_id\"]\n project_pk = project_response_data[\"id\"]\n project_ids[project_pk] = project_id\n\n for project_attribute_data in project_attributes_data:\n\n # add the project pk to the project attribute data\n project_attribute_data[\"project\"] = project_pk\n\n # sync the project attribute\n project_attribute_data = project_attribute_uploader.sync(project_attribute_data)\n\n for consumption_metadata_data, consumption_records_data in \\\n _get_consumption_data(consumption_df):\n\n project_id = consumption_metadata_data.pop(\"project_id\")\n\n # find the project pk\n if project_id in project_ids:\n consumption_metadata_data[\"id\"] = project_ids[project_id]\n else:\n project_data = {\n \"project_id\": project_id,\n \"project_owner\": project_owner,\n }\n project_response_data = project_uploader.sync(project_data)\n consumption_metadata_data[\"project\"] = project_response_data[\"id\"]\n\n\n consumption_metadata_response_data = consumption_metadata_uploader.sync(consumption_metadata_data)\n consumption_metadata_id = consumption_metadata_response_data[\"id\"]\n\n for consumption_record_data in consumption_records_data:\n consumption_record_data[\"metadata\"] = consumption_metadata_id\n\n consumption_records_response_data = consumption_record_uploader.bulk_sync(consumption_records_data)", "metadata": "root.upload_dataframes2", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def upload_dataframes(project_df, consumption_df, url, access_token, project_owner, verbose=True):\n \"\"\"Uploads a set of formatted project and consumption data formatted as\n CSVs to a datastore instance.\n\n Parameters\n ----------\n project_df : pandas.DataFrame\n File pointer to a CSV with the following columns::\n\n project_id,zipcode,weather_station,latitude,longitude,baseline_period_end,reporting_period_start\n\n Extra columns will be treated as project attributes.\n\n consumption_dict : pandas.DataFrame\n File pointer to a CSV with the following columns::\n\n project_id,start,end,fuel_type,unit_name,value,estimated\n\n access_token : str\n Access token for the target datastore.\n project_owner : int\n Primary key of project_owner for datastore.\n verbose : bool, default: True\n Whether or not to output a log of progress.\n \"\"\"\n requester = Requester(url, access_token)\n project_attribute_key_uploader = uploaders.ProjectAttributeKeyUploader(requester, verbose)\n project_uploader = uploaders.ProjectUploader(requester, verbose)\n project_attribute_uploader = uploaders.ProjectAttributeUploader(requester, verbose)\n consumption_metadata_uploader = uploaders.ConsumptionMetadataUploader(requester, verbose)\n consumption_record_uploader = uploaders.ConsumptionRecordUploader(requester, verbose)\n\n # project attribute keys\n project_attribute_keys_data = _get_project_attribute_keys_data(project_df)\n for data in project_attribute_keys_data:\n\n # sync the project attribute keys\n response_data = project_attribute_key_uploader.sync(data)\n\n data.update(response_data) # adds the \"id\" field\n\n project_ids = {}\n for project_data, project_attributes_data in \\\n _get_project_data(project_df, project_attribute_keys_data):\n\n # upload project\n project_data[\"project_owner\"] = project_owner\n project_response_data = project_uploader.sync(project_data)\n\n # store project_id to speed things up a bit in the consumption data uploading\n project_id = project_response_data[\"project_id\"]\n project_pk = project_response_data[\"id\"]\n project_ids[project_pk] = project_id\n\n for project_attribute_data in project_attributes_data:\n\n # add the project pk to the project attribute data\n project_attribute_data[\"project\"] = project_pk\n\n # sync the project attribute\n project_attribute_data = project_attribute_uploader.sync(project_attribute_data)\n\n for consumption_metadata_data, consumption_records_data in \\\n _get_consumption_data(consumption_df):\n\n project_id = consumption_metadata_data.pop(\"project_id\")\n\n # find the project pk\n if project_id in project_ids:\n consumption_metadata_data[\"id\"] = project_ids[project_id]\n else:\n project_data = {\n \"project_id\": project_id,\n \"project_owner\": project_owner,\n }\n project_response_data = project_uploader.sync(project_data)\n consumption_metadata_data[\"project\"] = project_response_data[\"id\"]\n\n\n consumption_metadata_response_data = consumption_metadata_uploader.sync(consumption_metadata_data)\n consumption_metadata_id = consumption_metadata_response_data[\"id\"]\n\n for consumption_record_data in consumption_records_data:\n consumption_record_data[\"metadata\"] = consumption_metadata_id\n\n consumption_records_response_data = consumption_record_uploader.sync(consumption_records_data)", "metadata": "root.upload_dataframes", "header": "['module', '___EOS___']", "index": 193 } ]
[ { "span": "project_attribute_data ", "start_line": 165, "start_column": 12, "end_line": 165, "end_column": 34 }, { "span": "project_attribute_data ", "start_line": 253, "start_column": 12, "end_line": 253, "end_column": 34 } ]
[ { "span": "project_attribute_data ", "start_line": 159, "start_column": 12, "end_line": 159, "end_column": 34 }, { "span": "project_attribute_data ", "start_line": 247, "start_column": 12, "end_line": 247, "end_column": 34 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "upload", "\\u", "dataframe", "s2_", "(_", "project", "\\u", "df_", ",_", "consum", "ption", "\\u", "df_", ",_", "url_", ",_", "access", "\\u", "token_", ",_", "project", "\\u", "owner_", ",_", "verbose_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", "s", " ", "a", " ", "set", " ", "of", " ", "format", "ted", " ", "project", " ", "and", " ", "consum", "ption", " ", "data", " ", "format", "ted", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "CSV", "s", " ", "to", " ", "a", " ", "datast", "ore", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "df", " ", ":", " ", "panda", "s", ".", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "point", "er", " ", "to", " ", "a", " ", "CSV", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "id", ",", "zipcode", ",", "wea", "ther", "\\u", "station", ",", "latitude", ",", "longitude", ",", "baseline", "\\u", "period", "\\u", "end", ",", "reporting", "\\u", "period", "\\u", "start", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Extra", " ", "column", "s", " ", "will", " ", "be", " ", "treat", "ed", " ", "as", " ", "project", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "consum", "ption", "\\u", "dict", " ", ":", " ", "panda", "s", ".", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "point", "er", " ", "to", " ", "a", " ", "CSV", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "id", ",", "start", ",", "end", ",", "fuel", "\\u", "type", ",", "unit", "\\u", "name", ",", "value", ",", "estimate", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "access", "\\u", "token", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Access", " ", "token", " ", "for", " ", "the", " ", "target", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "owner", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Prim", "ary", " ", "key", " ", "of", " ", "project", "\\u", "owner", " ", "for", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "verbo", "se", " ", ":", " ", "bool", ",", " ", "default", ":", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "output", " ", "a", " ", "log", " ", "of", " ", "progress", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requester_", "=_", "Requeste", "r_", "(_", "url_", ",_", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "key", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Attribute", "Key", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Attribute", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Consu", "mption", "Meta", "data", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "record", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Consu", "mption", "Record", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "project", " ", "attribute", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", "=_", "\\u", "get", "\\u", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", "(_", "project", "\\u", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "data_", "in_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "the", " ", "project", " ", "attribute", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "project", "\\u", "attribute", "\\u", "key", "\\u", "uploader_", "._", "sync_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "update_", "(_", "response", "\\u", "data_", ")_", "#", " ", "adds", " ", "the", " ", "\"", "id", "\"", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "project", "\\u", "ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "project", "\\u", "data_", ",_", "project", "\\u", "attribute", "s", "\\u", "data_", "in_", "\\u", "get", "\\u", "project", "\\u", "data_", "(_", "project", "\\u", "df_", ",_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "data_", "[_", "\"", "project", "\\u", "owner", "\"_", "]_", "=_", "project", "\\u", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "response", "\\u", "data_", "=_", "project", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", " ", "project", "\\u", "id", " ", "to", " ", "speed", " ", "thing", "s", " ", "up", " ", "a", " ", "bit", " ", "in", " ", "the", " ", "consum", "ption", " ", "data", " ", "upload", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "id_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "project", "\\u", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "pk_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "ids_", "[_", "project", "\\u", "pk_", "]_", "=_", "project", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project", "\\u", "attribute", "\\u", "data_", "in_", "project", "\\u", "attribute", "s", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "project", " ", "pk", " ", "to", " ", "the", " ", "project", " ", "attribute", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "attribute", "\\u", "data_", "[_", "\"", "project", "\"_", "]_", "=_", "project", "\\u", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "the", " ", "project", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "data_", "=_", "project", "\\u", "attribute", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "attribute", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "consum", "ption", "\\u", "metadata", "\\u", "data_", ",_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", "in_", "\\u", "get", "\\u", "consum", "ption", "\\u", "data_", "(_", "consum", "ption", "\\u", "df_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "id_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "data_", "._", "pop_", "(_", "\"", "project", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "project", " ", "pk_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "project", "\\u", "id_", "in_", "project", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consum", "ption", "\\u", "metadata", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "=_", "project", "\\u", "ids_", "[_", "project", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\\u", "id", "\"_", ":_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\\u", "owner", "\"_", ":_", "project", "\\u", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "response", "\\u", "data_", "=_", "project", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "data_", "[_", "\"", "project", "\"_", "]_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "response", "\\u", "data_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "uploader_", "._", "sync_", "(_", "consum", "ption", "\\u", "metadata", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "id_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "consum", "ption", "\\u", "record", "\\u", "data_", "in_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consum", "ption", "\\u", "record", "\\u", "data_", "[_", "\"", "metadata", "\"_", "]_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consum", "ption", "\\u", "record", "s", "\\u", "response", "\\u", "data_", "=_", "consum", "ption", "\\u", "record", "\\u", "uploader_", "._", "bul", "k", "\\u", "sync_", "(_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "upload", "\\u", "dataframe", "s_", "(_", "project", "\\u", "df_", ",_", "consum", "ption", "\\u", "df_", ",_", "url_", ",_", "access", "\\u", "token_", ",_", "project", "\\u", "owner_", ",_", "verbose_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", "s", " ", "a", " ", "set", " ", "of", " ", "format", "ted", " ", "project", " ", "and", " ", "consum", "ption", " ", "data", " ", "format", "ted", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "CSV", "s", " ", "to", " ", "a", " ", "datast", "ore", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "df", " ", ":", " ", "panda", "s", ".", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "point", "er", " ", "to", " ", "a", " ", "CSV", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "id", ",", "zipcode", ",", "wea", "ther", "\\u", "station", ",", "latitude", ",", "longitude", ",", "baseline", "\\u", "period", "\\u", "end", ",", "reporting", "\\u", "period", "\\u", "start", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Extra", " ", "column", "s", " ", "will", " ", "be", " ", "treat", "ed", " ", "as", " ", "project", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "consum", "ption", "\\u", "dict", " ", ":", " ", "panda", "s", ".", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "File", " ", "point", "er", " ", "to", " ", "a", " ", "CSV", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "id", ",", "start", ",", "end", ",", "fuel", "\\u", "type", ",", "unit", "\\u", "name", ",", "value", ",", "estimate", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "access", "\\u", "token", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "Access", " ", "token", " ", "for", " ", "the", " ", "target", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "project", "\\u", "owner", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Prim", "ary", " ", "key", " ", "of", " ", "project", "\\u", "owner", " ", "for", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "verbo", "se", " ", ":", " ", "bool", ",", " ", "default", ":", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "output", " ", "a", " ", "log", " ", "of", " ", "progress", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requester_", "=_", "Requeste", "r_", "(_", "url_", ",_", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "key", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Attribute", "Key", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Project", "Attribute", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Consu", "mption", "Meta", "data", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "record", "\\u", "uploader_", "=_", "uploade", "rs_", "._", "Consu", "mption", "Record", "Upload", "er_", "(_", "requester_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "project", " ", "attribute", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", "=_", "\\u", "get", "\\u", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", "(_", "project", "\\u", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "data_", "in_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "the", " ", "project", " ", "attribute", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "project", "\\u", "attribute", "\\u", "key", "\\u", "uploader_", "._", "sync_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "update_", "(_", "response", "\\u", "data_", ")_", "#", " ", "adds", " ", "the", " ", "\"", "id", "\"", " ", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "project", "\\u", "ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "project", "\\u", "data_", ",_", "project", "\\u", "attribute", "s", "\\u", "data_", "in_", "\\u", "get", "\\u", "project", "\\u", "data_", "(_", "project", "\\u", "df_", ",_", "project", "\\u", "attribute", "\\u", "keys", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "data_", "[_", "\"", "project", "\\u", "owner", "\"_", "]_", "=_", "project", "\\u", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "response", "\\u", "data_", "=_", "project", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", " ", "project", "\\u", "id", " ", "to", " ", "speed", " ", "thing", "s", " ", "up", " ", "a", " ", "bit", " ", "in", " ", "the", " ", "consum", "ption", " ", "data", " ", "upload", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "id_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "project", "\\u", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "pk_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "ids_", "[_", "project", "\\u", "pk_", "]_", "=_", "project", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project", "\\u", "attribute", "\\u", "data_", "in_", "project", "\\u", "attribute", "s", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "project", " ", "pk", " ", "to", " ", "the", " ", "project", " ", "attribute", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "attribute", "\\u", "data_", "[_", "\"", "project", "\"_", "]_", "=_", "project", "\\u", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sync", " ", "the", " ", "project", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "attribute", "\\u", "data_", "=_", "project", "\\u", "attribute", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "attribute", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "consum", "ption", "\\u", "metadata", "\\u", "data_", ",_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", "in_", "\\u", "get", "\\u", "consum", "ption", "\\u", "data_", "(_", "consum", "ption", "\\u", "df_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "id_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "data_", "._", "pop_", "(_", "\"", "project", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "project", " ", "pk_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "project", "\\u", "id_", "in_", "project", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consum", "ption", "\\u", "metadata", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "=_", "project", "\\u", "ids_", "[_", "project", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\\u", "id", "\"_", ":_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\\u", "owner", "\"_", ":_", "project", "\\u", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "response", "\\u", "data_", "=_", "project", "\\u", "uploader_", "._", "sync_", "(_", "project", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "data_", "[_", "\"", "project", "\"_", "]_", "=_", "project", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "response", "\\u", "data_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "uploader_", "._", "sync_", "(_", "consum", "ption", "\\u", "metadata", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consum", "ption", "\\u", "metadata", "\\u", "id_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "response", "\\u", "data_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "consum", "ption", "\\u", "record", "\\u", "data_", "in_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consum", "ption", "\\u", "record", "\\u", "data_", "[_", "\"", "metadata", "\"_", "]_", "=_", "consum", "ption", "\\u", "metadata", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consum", "ption", "\\u", "record", "s", "\\u", "response", "\\u", "data_", "=_", "consum", "ption", "\\u", "record", "\\u", "uploader_", "._", "sync_", "(_", "consum", "ption", "\\u", "record", "s", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/etc/OutputHandling.py
[ { "content": " def lines_from(self, idx=0):\n\tline_iter = self.line_iter\n\tif line_iter is None:\n\t line_iter = self.line_iter = self.get_line_iter()\n\twhile 1:\n\t try:\n\t\tyield self.line_at(idx)\n\t except IndexError:\n\t\treturn\n\t idx += 1", "metadata": "root.Printer.lines_from", "header": "['class', 'Printer', ':', '___EOS___']", "index": 118 }, { "content": " def get_str(self, printer, max_lines):\n\tdef f():\n\t _hiding_tag_ = printer._hiding_tag_\n\t start_lineno = printer._oh_get_start_lineno()\n\t ob = self.mod.output_buffer()\n\t it = self.lines_from(start_lineno)\n\t numlines = 0\n\t lineno = start_lineno\n\t for line in it:\n\t\tif (numlines >= max_lines and\n\t\t ((not self.stop_only_when_told) or self.stop_linenos.get(lineno-1))) :\n\t\t try:\n\t\t\tself.line_at(lineno+1)\n\t\t except IndexError:\n\t\t\tprint >>ob, line\n\t\t\tlineno += 1\n\t\t\tbreak\n\t\t else:\n\t\t\tprint >>ob, self.get_more_msg(start_lineno, lineno-1)\n\t\t\tbreak\n\t\tnumlines += 1\n\t\tprint >>ob, line\n\t\tlineno += 1\n\t printer._oh_next_lineno = lineno\n\t return ob.getvalue().rstrip()\n\n\treturn printer.mod._parent.View.enter(lambda: f())", "metadata": "root.Printer.get_str", "header": "['class', 'Printer', ':', '___EOS___']", "index": 172 } ]
[ { "span": "line_iter ", "start_line": 121, "start_column": 5, "end_line": 121, "end_column": 14 }, { "span": "_hiding_tag_ ", "start_line": 174, "start_column": 5, "end_line": 174, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Printer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lines", "\\u", "from_", "(_", "self_", ",_", "idx_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "line", "\\u", "iter_", "=_", "self_", "._", "line", "\\u", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line", "\\u", "iter_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "line", "\\u", "iter_", "=_", "self_", "._", "line", "\\u", "iter_", "=_", "self_", "._", "get", "\\u", "line", "\\u", "iter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "yield_", "self_", "._", "line", "\\u", "at_", "(_", "idx_", ")_", "\\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\t", "\t_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Printer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "str_", "(_", "self_", ",_", "printer_", ",_", "max", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "f_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "=_", "printer_", "._", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "lineno_", "=_", "printer_", "._", "\\u", "oh", "\\u", "get", "\\u", "start", "\\u", "lineno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ob_", "=_", "self_", "._", "mod_", "._", "output", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "it_", "=_", "self_", "._", "lines", "\\u", "from_", "(_", "start", "\\u", "lineno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "lines_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "start", "\\u", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "(_", "num", "lines_", ">=_", "max", "\\u", "lines_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "not_", "self_", "._", "stop", "\\u", "only", "\\u", "whe", "n", "\\u", "tol", "d_", ")_", "or_", "self_", "._", "stop", "\\u", "linen", "os_", "._", "get_", "(_", "lineno_", "-_", "1_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "line", "\\u", "at_", "(_", "lineno_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", ">>_", "ob_", ",_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "+=_", "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\t", "\t\t_", "print_", ">>_", "ob_", ",_", "self_", "._", "get", "\\u", "more", "\\u", "msg_", "(_", "start", "\\u", "lineno_", ",_", "lineno_", "-_", "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_", "num", "lines_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "ob_", ",_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "printer_", "._", "\\u", "oh", "\\u", "next", "\\u", "lineno_", "=_", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ob_", "._", "getvalue_", "(_", ")_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "printer_", "._", "mod_", "._", "\\u", "parent_", "._", "View_", "._", "enter_", "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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 ]
Unused import
neurodata/ndstore/ocpca/mysqlkvio.py
[ { "content": "# Copyright 2014 Open Connectome Project (http://openconnecto.me)\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport numpy as np\nimport cStringIO\nimport zlib\nimport MySQLdb\nimport re\nfrom collections import defaultdict\nimport itertools\n\nfrom ocptype import OLDCHANNEL\n\nimport logging\nlogger=logging.getLogger(\"ocp\")\n\n\n\"\"\"Helpers function to do cube I/O in across multiple DBs.\n This uses the state and methods of ocpcadb\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MySQLKVIO:\n\n\n\n\n\n\n\n\n \n \n \n\n \n \n \n\n\n \n \n #def putCubes ( self, zidx, resolution, cubestr, update=False ):\n #\"\"\" Store a batch of cubes from the annotation database \"\"\"\n\n ## if in a TxN us the transaction cursor. Otherwise create one.\n #if self.txncursor == None:\n #cursor = self.conn.cursor()\n #else:\n #cursor = self.txncursor\n\n ## we created a cube from zeros\n #if not update:\n\n #sql = \"INSERT INTO {} (zindex, cube) VALUES (%s, %s)\".format( self.db.annoproj.getTable(resolution) )\n\n ## this uses a cursor defined in the caller (locking context): not beautiful, but needed for locking\n #try:\n #cursor.executemany ( sql, zip(zidx,cubestr) )\n #except MySQLdb.Error, e:\n #logger.error ( \"Error inserting cube: %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n #raise\n #finally:\n ## close the local cursor if not in a transaction and commit right away\n #if self.txncursor == None:\n #cursor.close()\n\n #else:\n\n #sql = \"UPDATE {} SET cube=(%s) WHERE zindex=%s\".format( self.db.annoproj.getTable(resolution) )\n #try:\n #cursor.executemany ( sql, zip(zidx,cubestr) )\n #except MySQLdb.Error, e:\n #logger.error ( \"Error updating data cube: %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n #raise\n #finally:\n ## close the local cursor if not in a transaction and commit right away\n #if self.txncursor == None:\n #cursor.close()\n\n ## commit if not in a txn\n #if self.txncursor == None:\n #self.conn.commit()\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MySQLKVIO", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__ ( self, db ):\n \"\"\"Connect to the database\"\"\"\n\n self.db = db\n self.conn = None\n \n # Connection info \n try:\n self.conn = MySQLdb.connect (host = self.db.proj.getDBHost(), user = self.db.proj.getDBUser(), passwd = self.db.proj.getDBPasswd(), db = self.db.proj.getDBName())\n\n except MySQLdb.Error, e:\n self.conn = None\n logger.error(\"Failed to connect to database: {}, {}\".format(self.db.proj.getDBHost(), self.db.proj.getDBName()))\n raise\n\n # start with no cursor\n self.txncursor = None", "metadata": "root.MySQLKVIO.__init__", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 33 }, { "content": " def close ( self ):\n \"\"\"Close the connection\"\"\"\n if self.conn:\n self.conn.close()", "metadata": "root.MySQLKVIO.close", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 51 }, { "content": " def startTxn ( self ):\n \"\"\"Start a transaction. Ensure database is in multi-statement mode.\"\"\"\n\n self.txncursor = self.conn.cursor()\n sql = \"START TRANSACTION\"\n self.txncursor.execute ( sql )", "metadata": "root.MySQLKVIO.startTxn", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 56 }, { "content": " def commit ( self ):\n \"\"\"Commit the transaction. Moved out of del to make explicit.\"\"\" \n if self.txncursor:\n self.conn.commit()\n self.txncursor.close()\n self.txncursor = None", "metadata": "root.MySQLKVIO.commit", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 63 }, { "content": " def rollback ( self ):\n \"\"\"Rollback the transaction. To be called on exceptions.\"\"\"\n\n if self.txncursor:\n self.conn.rollback()\n self.txncursor.close()\n self.txncursor = None", "metadata": "root.MySQLKVIO.rollback", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 70 }, { "content": " def getChannelId(self, ch):\n \"\"\"Retrieve the channel id for the oldchannel database\"\"\"\n \n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n \n sql = \"SELECT chanid from channels where chanstr=%s\"\n\n try:\n cursor.execute ( sql, [ch.getChannelName()] )\n row = cursor.fetchone()\n except MySQLdb.Error, e:\n logger.error ( \"Failed to retrieve data cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n \n if row is None:\n return None\n else: \n return row[0]", "metadata": "root.MySQLKVIO.getChannelId", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 78 }, { "content": " def getCube(self, ch, zidx, resolution, update=False):\n \"\"\"Retrieve a cube from the database by token, resolution, and zidx\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n if ch.getChannelType() == OLDCHANNEL:\n channel_id = self.getChannelId(ch)\n sql = \"SELECT cube FROM {} WHERE (channel,zindex) = ({},{})\".format(ch.getTable(resolution), channel_id, zidx)\n else:\n sql = \"SELECT cube FROM {} WHERE zindex={}\".format(ch.getTable(resolution), zidx) \n if update:\n sql += \" FOR UPDATE\"\n\n try:\n cursor.execute ( sql )\n row = cursor.fetchone()\n except MySQLdb.Error, e:\n logger.error ( \"Failed to retrieve data cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n # If we can't find a cube, assume it hasn't been written yet\n if row is None:\n return None\n else: \n return row[0]", "metadata": "root.MySQLKVIO.getCube", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 105 }, { "content": " def getTimeCube(self, ch, zidx, timestamp, resolution, update=False):\n \"\"\"Retrieve a cube from the TimeSeries database by token, resolution, timestamp and zidx\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n sql = \"SELECT cube FROM {} WHERE (zindex,timestamp) = ({},{})\".format(ch.getTable(resolution), zidx, timestamp)\n if update:\n sql += \" FOR UPDATE\"\n\n try:\n cursor.execute(sql)\n row = cursor.fetchone()\n except MySQLdb.Error, e:\n logger.error(\"Failed to retrieve data cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n # If we can't find a cube, assume it hasn't been written yet\n if row is None:\n return None\n else: \n return row[0]", "metadata": "root.MySQLKVIO.getTimeCube", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 140 }, { "content": " def getCubes(self, ch, listofidxs, resolution, neariso=False):\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n if ch.getChannelType() == OLDCHANNEL:\n channel_id = self.getChannelId(ch)\n sql = \"SELECT zindex,cube FROM {} where channel={} and zindex in (%s)\".format( ch.getTable(resolution), channel_id)\n else:\n if neariso:\n sql = \"SELECT zindex, cube FROM {} WHERE zindex in (%s)\".format( ch.getNearIsoTable(resolution) ) \n else:\n sql = \"SELECT zindex, cube FROM {} WHERE zindex in (%s)\".format( ch.getTable(resolution) ) \n\n # creats a %s for each list element\n in_p=', '.join(map(lambda x: '%s', listofidxs))\n # replace the single %s with the in_p string\n sql = sql % in_p\n\n try:\n rc = cursor.execute(sql, listofidxs)\n \n # Get the objects and add to the cube\n while ( True ):\n try: \n retval = cursor.fetchone() \n except:\n break\n if retval is not None:\n yield ( retval )\n else:\n return\n \n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()", "metadata": "root.MySQLKVIO.getCubes", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 171 }, { "content": " def getTimeCubes(self, ch, idx, listoftimestamps, resolution):\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n sql = \"SELECT zindex,timestamp,cube FROM {} WHERE zindex={} and timestamp in (%s)\".format(ch.getTable(resolution), idx)\n\n # creats a %s for each list element\n in_p=', '.join(map(lambda x: '%s', listoftimestamps))\n # replace the single %s with the in_p string\n sql = sql % in_p\n\n try:\n rc = cursor.execute(sql, listoftimestamps)\n \n # Get the objects and add to the cube\n while ( True ):\n try: \n retval = cursor.fetchone() \n except:\n break\n if retval is not None:\n yield ( retval )\n else:\n return\n \n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()", "metadata": "root.MySQLKVIO.getTimeCubes", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 213 }, { "content": " def putCubes ( self, ch, listofidxs, resolution, listofcubes, update=False):\n \"\"\"Store multiple cubes into the database\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n \n sql = \"REPLACE INTO {} (zindex,cube) VALUES (%s,%s)\".format(ch.getTable(resolution))\n #sql = \"INSERT INTO {} (zindex,cube) VALUES (%s,%s)\".format(ch.getTable(resolution))\n\n try:\n cursor.executemany(sql, zip(listofidxs, listofcubes))\n except MySQLdb.Error, e:\n logger.error ( \"Error inserting cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction and commit right away\n if self.txncursor is None:\n cursor.close()", "metadata": "root.MySQLKVIO.putCubes", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 247 }, { "content": " def putCube ( self, ch, zidx, resolution, cubestr, update=False ):\n \"\"\"Store a cube from the annotation database\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n # we created a cube from zeros\n if not update:\n sql = \"INSERT INTO {} (zindex, cube) VALUES (%s, %s)\".format( ch.getTable(resolution) )\n\n # this uses a cursor defined in the caller (locking context): not beautiful, but needed for locking\n try:\n cursor.execute ( sql, (zidx,cubestr) )\n except MySQLdb.Error, e:\n logger.error ( \"Error inserting cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction and commit right away\n if self.txncursor is None:\n cursor.close()\n\n else:\n\n sql = \"UPDATE {} SET cube=(%s) WHERE zindex={}\".format( ch.getTable(resolution), zidx)\n try:\n cursor.execute ( sql, (cubestr,) )\n except MySQLdb.Error, e:\n logger.error ( \"Error updating data cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction and commit right away\n if self.txncursor is None:\n cursor.close()\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()", "metadata": "root.MySQLKVIO.putCube", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 269 }, { "content": " def putTimeCube(self, ch, zidx, timestamp, resolution, cubestr, update=False):\n \"\"\"Store a cube from the timeseries database\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n # we created a cube from zeros\n if not update:\n\n sql = \"INSERT INTO {} (zindex, timestamp, cube) VALUES (%s, %s, %s)\".format(ch.getTable(resolution))\n\n # this uses a cursor defined in the caller (locking context): not beautiful, but needed for locking\n try:\n cursor.execute ( sql, (zidx,timestamp,cubestr))\n except MySQLdb.Error, e:\n logger.error ( \"Error inserting cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n # and commit right away\n if self.txncursor is None:\n cursor.close()\n\n else:\n\n sql = \"UPDATE {} SET cube=(%s) WHERE (zindex,timestamp)=({},{})\".format(ch.getTable(resolution), zidx, timestamp)\n try:\n cursor.execute (sql, [cubestr])\n except MySQLdb.Error, e:\n logger.error ( \"Error updating data cube: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n # and commit right away\n if self.txncursor is None:\n cursor.close()\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()", "metadata": "root.MySQLKVIO.putTimeCube", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 311 }, { "content": " def getAnnotationType ( self, ch, annid ):\n \"\"\"MySQL fetch index routine\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n #get the block from the database \n sql = \"SELECT type FROM {} where annoid = {}\".format(ch.getAnnoTable('annotation'), annid) \n try:\n cursor.execute ( sql )\n row = cursor.fetchone ()\n except MySQLdb.Error, e:\n logger.warning (\"Error reading Id: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n #raise OCPCAError (\"Error reading Id: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except BaseException, e:\n logger.exception(\"Unknown exception\")\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n \n # If we can't find a index, they don't exist \n if row is None:\n return None\n else:\n return row[0]", "metadata": "root.MySQLKVIO.getAnnotationType", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 398 }, { "content": " def getAnnotation ( self, ch, annid, anno_type='annotation' ):\n \"\"\"MySQL fetch index routine\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n #get the block from the database \n sql = \"SELECT * FROM {} where annoid = {}\".format(ch.getAnnoTable(anno_type), annid) \n try:\n cursor.execute ( sql )\n row = cursor.fetchone ()\n except MySQLdb.Error, e:\n logger.warning (\"Error reading Id: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n #raise OCPCAError (\"Error reading Id: {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except BaseException, e:\n logger.exception(\"Unknown exception\")\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n \n # If we can't find a index, they don't exist \n if row is None:\n return None\n else:\n return row[0]", "metadata": "root.MySQLKVIO.getAnnotation", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 430 }, { "content": " def getIndex ( self, ch, annid, resolution, update ):\n \"\"\"MySQL fetch index routine\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n # get the block from the database \n sql = \"SELECT cube FROM {} WHERE annid = {}\".format( ch.getIdxTable(resolution), annid )\n if update:\n sql += \" FOR UPDATE\"\n try:\n cursor.execute ( sql )\n row = cursor.fetchone ()\n except MySQLdb.Error, e:\n logger.warning (\"Failed to retrieve cube {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except BaseException, e:\n logger.exception(\"Unknown exception\")\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n \n # If we can't find a index, they don't exist \n if row is None:\n return []\n else:\n return row[0]", "metadata": "root.MySQLKVIO.getIndex", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 462 }, { "content": " def putIndex ( self, ch, zidx, resolution, indexstr, update ):\n \"\"\"MySQL put index routine\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n if not update:\n sql = \"INSERT INTO {} ( annid, cube) VALUES ( %s, %s )\".format( ch.getIdxTable(resolution) )\n try:\n cursor.execute ( sql, (zidx,indexstr) )\n except MySQLdb.Error, e:\n logger.warning(\"Error updating index {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except BaseException, e:\n logger.exception(\"Unknown error when updating index\")\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n else:\n # update index in the database\n sql = \"UPDATE {} SET cube=(%s) WHERE annid={}\".format( ch.getIdxTable(resolution), zidx )\n try:\n cursor.execute ( sql, (indexstr,) )\n except MySQLdb.Error, e:\n logger.warning(\"Error updating exceptions {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except:\n logger.exception(\"Unknown exception\")\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()", "metadata": "root.MySQLKVIO.putIndex", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 496 }, { "content": " def deleteIndex ( self, ch, annid, resolution ):\n \"\"\"MySQL update index routine\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n sql = \"DELETE FROM {} WHERE annid={}\".format( ch.getIdxTable(resolution), annid )\n \n try:\n cursor.execute(sql)\n except MySQLdb.Error, e:\n logger.error(\"Error deleting the index {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n except:\n logger.exception(\"Unknown exception\")\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()", "metadata": "root.MySQLKVIO.deleteIndex", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 541 }, { "content": " def getExceptions ( self, ch, zidx, resolution, annid ):\n \"\"\"Load a the list of excpetions for this cube.\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n # get the block from the database\n sql = \"SELECT exlist FROM {} where zindex={} AND id={}\".format( ch.getExceptionsTable(resolution), zidx, annid )\n try:\n cursor.execute(sql)\n row = cursor.fetchone()\n except MySQLdb.Error, e:\n logger.error ( \"Error reading exceptions {}: {}. sql={}\".format(e.args[0], e.args[1], sql))\n raise\n finally:\n # close the local cursor if not in a transaction\n if self.txncursor is None:\n cursor.close()\n\n # If we can't find a list of exceptions, they don't exist\n if row is None:\n return []\n else: \n return row[0] ", "metadata": "root.MySQLKVIO.getExceptions", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 569 }, { "content": " def deleteExceptions ( self, ch, zidx, resolution, annid ):\n \"\"\"Delete a list of exceptions for this cuboid\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n sql = \"DELETE FROM {} WHERE zindex ={} AND id ={}\".format( ch.getExceptionsTable(resolution), zidx, annid ) \n try:\n cursor.execute ( sql )\n except MySQLdb.Error, e:\n logger.error ( \"Error deleting exceptions %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n if self.txncursor is None:\n cursor.close()\n raise\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()\n cursor.close()", "metadata": "root.MySQLKVIO.deleteExceptions", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 598 }, { "content": " def putExceptions ( self, ch, zidx, resolution, annid, excstr, update=False ):\n \"\"\"Store a list of exceptions\"\"\"\n \"\"\"This should be done in a transaction\"\"\"\n\n # if in a TxN us the transaction cursor. Otherwise create one.\n if self.txncursor is None:\n cursor = self.conn.cursor()\n else:\n cursor = self.txncursor\n\n\n if not update:\n\n sql = \"INSERT INTO {} (zindex, id, exlist) VALUES (%s, %s, %s)\".format( ch.getExceptionsTable(resolution) )\n try:\n cursor.execute ( sql, (zidx, annid, excstr))\n except MySQLdb.Error, e:\n logger.error ( \"Error inserting exceptions %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n if self.txncursor is None:\n cursor.close()\n raise\n\n # In this case we have an update query\n else:\n\n sql = \"UPDATE {} SET exlist=(%s) WHERE zindex=%s AND id=%s\".format( ch.getExceptionsTable(resolution) )\n try:\n cursor.execute ( sql, (zlib.compress(excstr),zidx,annid))\n except MySQLdb.Error, e:\n logger.error ( \"Error updating exceptions %d: %s. sql=%s\" % (e.args[0], e.args[1], sql))\n if self.txncursor is None:\n cursor.close()\n raise\n\n # commit if not in a txn\n if self.txncursor is None:\n self.conn.commit()\n cursor.close()", "metadata": "root.MySQLKVIO.putExceptions", "header": "['class', 'MySQLKVIO', ':', '___EOS___']", "index": 622 } ]
[ { "span": "import numpy as np", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 18 }, { "span": "import cStringIO", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 16 }, { "span": "import re", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 9 }, { "span": "from collections import defaultdict", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 35 }, { "span": "import itertools", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "My", "SQL", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oc", "ptype_", "import_", "OLD", "CHANNEL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "oc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Help", "ers", " ", "function", " ", "to", " ", "do", " ", "cube", " ", "I", "/", "O", " ", "in", " ", "acro", "ss", " ", "multiple", " ", "DB", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "use", "s", " ", "the", " ", "state", " ", "and", " ", "method", "s", " ", "of", " ", "oc", "pca", "db", "\"\"\"_", "\\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_", "My", "SQL", "KV", "IO_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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_", "#", "def", " ", "put", "Cub", "es", " ", "(", " ", "self", ",", " ", "zi", "dx", ",", " ", "resolu", "tion", ",", " ", "cubes", "tr", ",", " ", "update", "=", "Fal", "se", " ", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "\"\"", " ", "Stor", "e", " ", "a", " ", "batch", " ", "of", " ", "cubes", " ", "from", " ", "the", " ", "annot", "ation", " ", "databa", "se", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "tx", "ncu", "rs", "or", " ", "==", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", " ", "=", " ", "self", ".", "conn", ".", "cursor", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", " ", "=", " ", "self", ".", "tx", "ncu", "rs", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "we", " ", "created", " ", "a", " ", "cube", " ", "from", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "update", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sql", " ", "=", " ", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ")\"", ".", "format", "(", " ", "self", ".", "db", ".", "anno", "proj", ".", "get", "Table", "(", "resolu", "tion", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "this", " ", "use", "s", " ", "a", " ", "cursor", " ", "defin", "ed", " ", "in", " ", "the", " ", "caller", " ", "(", "locking", " ", "context", "):", " ", "not", " ", "beautif", "ul", ",", " ", "but", " ", "need", "ed", " ", "for", " ", "locking_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", ".", "executemany", " ", "(", " ", "sql", ",", " ", "zip", "(", "zi", "dx", ",", "cubes", "tr", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "My", "SQL", "db", ".", "Error", ",", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "error", " ", "(", " ", "\"", "Error", " ", "insert", "ing", " ", "cube", ":", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"", " ", "%", " ", "(", "e", ".", "args", "[", "0", "],", " ", "e", ".", "args", "[", "1", "],", " ", "sql", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", "final", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "tx", "ncu", "rs", "or", " ", "==", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sql", " ", "=", " ", "\"", "UPDATE", " ", "{}", " ", "SET", " ", "cube", "=(", "%", "s", ")", " ", "WHE", "RE", " ", "zin", "dex", "=", "%", "s", "\".", "format", "(", " ", "self", ".", "db", ".", "anno", "proj", ".", "get", "Table", "(", "resolu", "tion", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", ".", "executemany", " ", "(", " ", "sql", ",", " ", "zip", "(", "zi", "dx", ",", "cubes", "tr", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "My", "SQL", "db", ".", "Error", ",", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "error", " ", "(", " ", "\"", "Error", " ", "updat", "ing", " ", "data", " ", "cube", ":", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"", " ", "%", " ", "(", "e", ".", "args", "[", "0", "],", " ", "e", ".", "args", "[", "1", "],", " ", "sql", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", "final", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "tx", "ncu", "rs", "or", " ", "==", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cursor", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "tx", "ncu", "rs", "or", " ", "==", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "conn", ".", "commit", "()", "_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "SQL", "KV", "IO_", ":_", "\\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_", ",_", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", " ", "to", " ", "the", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", "ion", " ", "info", " _", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "=_", "My", "SQL", "db_", "._", "connect_", "(_", "host_", "=_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "Host_", "(_", ")_", ",_", "user_", "=_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "User_", "(_", ")_", ",_", "passwd_", "=_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "Passw", "d_", "(_", ")_", ",_", "db_", "=_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "connect", " ", "to", " ", "databa", "se", ":", " ", "{}", ",", " ", "{}\"_", "._", "format_", "(_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "Host_", "(_", ")_", ",_", "self_", "._", "db_", "._", "proj_", "._", "get", "DB", "Name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "with", " ", "no", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clos", "e", " ", "the", " ", "connecti", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "Tx", "n_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "a", " ", "transaction", ".", " ", " ", "Ensur", "e", " ", "databa", "se", " ", "is", " ", "in", " ", "multi", "-", "statem", "ent", " ", "mode", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"", "START", " ", "TRANSACTION", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Commi", "t", " ", "the", " ", "transaction", ".", " ", " ", "Move", "d", " ", "out", " ", "of", " ", "del", " ", "to", " ", "make", " ", "explicit", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Roll", "back", " ", "the", " ", "transaction", ".", " ", " ", "To", " ", "be", " ", "call", "ed", " ", "on", " ", "exception", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "ncu", "rs", "or_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Chan", "nel", "Id_", "(_", "self_", ",_", "ch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "the", " ", "channel", " ", "id", " ", "for", " ", "the", " ", "oldc", "hannel", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "chan", "id", " ", "from", " ", "channel", "s", " ", "where", " ", "chans", "tr", "=", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "[_", "ch_", "._", "get", "Chan", "nel", "Name_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "retrieve", " ", "data", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\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_", "row_", "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 ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Cube_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "a", " ", "cube", " ", "from", " ", "the", " ", "databa", "se", " ", "by", " ", "token", ",", " ", "resolu", "tion", ",", " ", "and", " ", "zi", "dx", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ch_", "._", "get", "Chan", "nel", "Type_", "(_", ")_", "==_", "OLD", "CHANNEL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel", "\\u", "id_", "=_", "self_", "._", "get", "Chan", "nel", "Id_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "(", "channel", ",", "zin", "dex", ")", " ", "=", " ", "({},", "{})\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "channel", "\\u", "id_", ",_", "zi", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "SELECT", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "zin", "dex", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "+=_", "\"", " ", "FOR", " ", "UPDATE", "\"_", "\\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 ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "retrieve", " ", "data", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "cube", ",", " ", "assume", " ", "it", " ", "hasn", "'", "t", " ", "bee", "n", " ", "writt", "en", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "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 ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Time", "Cube_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "timestamp_", ",_", "resolution_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "a", " ", "cube", " ", "from", " ", "the", " ", "Time", "Serie", "s", " ", "databa", "se", " ", "by", " ", "token", ",", " ", "resolu", "tion", ",", " ", "timestamp", " ", "and", " ", "zi", "dx", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "(", "zin", "dex", ",", "timestamp", ")", " ", "=", " ", "({},", "{})\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ",_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "+=_", "\"", " ", "FOR", " ", "UPDATE", "\"_", "\\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 ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "retrieve", " ", "data", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "cube", ",", " ", "assume", " ", "it", " ", "hasn", "'", "t", " ", "bee", "n", " ", "writt", "en", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "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 ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Cub", "es_", "(_", "self_", ",_", "ch_", ",_", "listo", "fid", "xs_", ",_", "resolution_", ",_", "near", "iso_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ch_", "._", "get", "Chan", "nel", "Type_", "(_", ")_", "==_", "OLD", "CHANNEL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel", "\\u", "id_", "=_", "self_", "._", "get", "Chan", "nel", "Id_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "zin", "dex", ",", "cube", " ", "FROM", " ", "{}", " ", "where", " ", "channel", "={}", " ", "and", " ", "zin", "dex", " ", "in", " ", "(%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "channel", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "near", "iso_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "SELECT", " ", "zin", "dex", ",", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "zin", "dex", " ", "in", " ", "(%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Near", "Iso", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "SELECT", " ", "zin", "dex", ",", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "zin", "dex", " ", "in", " ", "(%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "creat", "s", " ", "a", " ", "%", "s", " ", "for", " ", "each", " ", "list", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "p_", "=_", "',", " ", "'_", "._", "join_", "(_", "map_", "(_", "lambda_", "x_", ":_", "'%", "s", "'_", ",_", "listo", "fid", "xs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "single", " ", "%", "s", " ", "with", " ", "the", " ", "in", "\\u", "p", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "sql_", "%_", "in", "\\u", "p_", "\\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 ", " _", "rc_", "=_", "cursor_", "._", "execute_", "(_", "sql_", ",_", "listo", "fid", "xs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "object", "s", " ", "and", " ", "add", " ", "to", " ", "the", " ", "cube_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\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 ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retval_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "retval_", ")_", "\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Time", "Cub", "es_", "(_", "self_", ",_", "ch_", ",_", "idx_", ",_", "listo", "fti", "mes", "tamp", "s_", ",_", "resolution_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "zin", "dex", ",", "timestamp", ",", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "zin", "dex", "={}", " ", "and", " ", "timestamp", " ", "in", " ", "(%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "creat", "s", " ", "a", " ", "%", "s", " ", "for", " ", "each", " ", "list", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "p_", "=_", "',", " ", "'_", "._", "join_", "(_", "map_", "(_", "lambda_", "x_", ":_", "'%", "s", "'_", ",_", "listo", "fti", "mes", "tamp", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "single", " ", "%", "s", " ", "with", " ", "the", " ", "in", "\\u", "p", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "sql_", "%_", "in", "\\u", "p_", "\\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 ", " _", "rc_", "=_", "cursor_", "._", "execute_", "(_", "sql_", ",_", "listo", "fti", "mes", "tamp", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "object", "s", " ", "and", " ", "add", " ", "to", " ", "the", " ", "cube_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\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 ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retval_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "retval_", ")_", "\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "put", "Cub", "es_", "(_", "self_", ",_", "ch_", ",_", "listo", "fid", "xs_", ",_", "resolution_", ",_", "listo", "fc", "ube", "s_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stor", "e", " ", "multiple", " ", "cubes", " ", "int", "o", " ", "the", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "REPLACE", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sql", " ", "=", " ", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",%", "s", ")\"", ".", "format", "(", "ch", ".", "get", "Table", "(", "resolu", "tion", "))", "_", "\\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 ", " _", "cursor_", "._", "executemany", "_", "(_", "sql_", ",_", "zip_", "(_", "listo", "fid", "xs_", ",_", "listo", "fc", "ube", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "insert", "ing", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "put", "Cube_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "cubes", "tr_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stor", "e", " ", "a", " ", "cube", " ", "from", " ", "the", " ", "annot", "ation", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "created", " ", "a", " ", "cube", " ", "from", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "use", "s", " ", "a", " ", "cursor", " ", "defin", "ed", " ", "in", " ", "the", " ", "caller", " ", "(", "locking", " ", "context", "):", " ", "not", " ", "beautif", "ul", ",", " ", "but", " ", "need", "ed", " ", "for", " ", "locking_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "zi", "dx_", ",_", "cubes", "tr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "insert", "ing", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "UPDATE", " ", "{}", " ", "SET", " ", "cube", "=(", "%", "s", ")", " ", "WHE", "RE", " ", "zin", "dex", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "cubes", "tr_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "updat", "ing", " ", "data", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\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_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "put", "Time", "Cube_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "timestamp_", ",_", "resolution_", ",_", "cubes", "tr_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stor", "e", " ", "a", " ", "cube", " ", "from", " ", "the", " ", "times", "eries", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "created", " ", "a", " ", "cube", " ", "from", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", " ", "timestamp", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "use", "s", " ", "a", " ", "cursor", " ", "defin", "ed", " ", "in", " ", "the", " ", "caller", " ", "(", "locking", " ", "context", "):", " ", "not", " ", "beautif", "ul", ",", " ", "but", " ", "need", "ed", " ", "for", " ", "locking_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "zi", "dx_", ",_", "timestamp_", ",_", "cubes", "tr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "insert", "ing", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "UPDATE", " ", "{}", " ", "SET", " ", "cube", "=(", "%", "s", ")", " ", "WHE", "RE", " ", "(", "zin", "dex", ",", "timestamp", ")=", "({},", "{})\"_", "._", "format_", "(_", "ch_", "._", "get", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ",_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "[_", "cubes", "tr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "updat", "ing", " ", "data", " ", "cube", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "commit", " ", "right", " ", "away_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\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_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Annot", "ation", "Type_", "(_", "self_", ",_", "ch_", ",_", "ann", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "My", "SQL", " ", "fetch", " ", "index", " ", "routin", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "the", " ", "block", " ", "from", " ", "the", " ", "databa", "se", " ", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "type", " ", "FROM", " ", "{}", " ", "where", " ", "anno", "id", " ", "=", " ", "{}\"_", "._", "format_", "(_", "ch_", "._", "get", "Ann", "o", "Table_", "(_", "'", "annot", "ation", "'_", ")_", ",_", "ann", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Error", " ", "readi", "ng", " ", "Id", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "OC", "PCA", "Error", " ", "(\"", "Error", " ", "readi", "ng", " ", "Id", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}", "\".", "format", "(", "e", ".", "args", "[", "0", "],", " ", "e", ".", "args", "[", "1", "],", " ", "sql", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "index", ",", " ", "the", "y", " ", "don", "'", "t", " ", "exist", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "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 ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Annotation_", "(_", "self_", ",_", "ch_", ",_", "ann", "id_", ",_", "anno", "\\u", "type_", "=_", "'", "annot", "ation", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "My", "SQL", " ", "fetch", " ", "index", " ", "routin", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "the", " ", "block", " ", "from", " ", "the", " ", "databa", "se", " ", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "{}", " ", "where", " ", "anno", "id", " ", "=", " ", "{}\"_", "._", "format_", "(_", "ch_", "._", "get", "Ann", "o", "Table_", "(_", "anno", "\\u", "type_", ")_", ",_", "ann", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Error", " ", "readi", "ng", " ", "Id", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "OC", "PCA", "Error", " ", "(\"", "Error", " ", "readi", "ng", " ", "Id", ":", " ", "{}:", " ", "{}.", " ", "sql", "={}", "\".", "format", "(", "e", ".", "args", "[", "0", "],", " ", "e", ".", "args", "[", "1", "],", " ", "sql", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "index", ",", " ", "the", "y", " ", "don", "'", "t", " ", "exist", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "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 ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Index_", "(_", "self_", ",_", "ch_", ",_", "ann", "id_", ",_", "resolution_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "My", "SQL", " ", "fetch", " ", "index", " ", "routin", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "block", " ", "from", " ", "the", " ", "databa", "se", " ", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "cube", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "ann", "id", " ", "=", " ", "{}\"_", "._", "format_", "(_", "ch_", "._", "get", "Id", "x", "Table_", "(_", "resolution_", ")_", ",_", "ann", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "+=_", "\"", " ", "FOR", " ", "UPDATE", "\"_", "\\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 ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Fail", "ed", " ", "to", " ", "retrieve", " ", "cube", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "index", ",", " ", "the", "y", " ", "don", "'", "t", " ", "exist", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "put", "Index_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "index", "str_", ",_", "update_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "My", "SQL", " ", "put", " ", "index", " ", "routin", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", " ", "ann", "id", ",", " ", "cube", ")", " ", "VALU", "ES", " ", "(", " ", "%", "s", ",", " ", "%", "s", " ", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Id", "x", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "zi", "dx_", ",_", "index", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Error", " ", "updat", "ing", " ", "index", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "error", " ", "whe", "n", " ", "updat", "ing", " ", "index", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "index", " ", "in", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "UPDATE", " ", "{}", " ", "SET", " ", "cube", "=(", "%", "s", ")", " ", "WHE", "RE", " ", "ann", "id", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Id", "x", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "index", "str_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Error", " ", "updat", "ing", " ", "exception", "s", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\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_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Index_", "(_", "self_", ",_", "ch_", ",_", "ann", "id_", ",_", "resolution_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "My", "SQL", " ", "update", " ", "index", " ", "routin", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "DELET", "E", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "ann", "id", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Id", "x", "Table_", "(_", "resolution_", ")_", ",_", "ann", "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 ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "delet", "ing", " ", "the", " ", "index", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Un", "know", "n", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Exceptions_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "ann", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", " ", "a", " ", "the", " ", "list", " ", "of", " ", "exc", "peti", "ons", " ", "for", " ", "this", " ", "cube", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "block", " ", "from", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "SELECT", " ", "ex", "list", " ", "FROM", " ", "{}", " ", "where", " ", "zin", "dex", "={}", " ", "AND", " ", "id", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Except", "ion", "s", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ",_", "ann", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "readi", "ng", " ", "exception", "s", " ", "{}:", " ", "{}.", " ", "sql", "={}\"_", "._", "format_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "the", " ", "local", " ", "cursor", " ", "if", " ", "not", " ", "in", " ", "a", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "find", " ", "a", " ", "list", " ", "of", " ", "exception", "s", ",", " ", "the", "y", " ", "don", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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", "Exceptions_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "ann", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "list", " ", "of", " ", "exception", "s", " ", "for", " ", "this", " ", "cub", "oid", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "=_", "\"", "DELET", "E", " ", "FROM", " ", "{}", " ", "WHE", "RE", " ", "zin", "dex", " ", "={}", " ", "AND", " ", "id", " ", "={}\"_", "._", "format_", "(_", "ch_", "._", "get", "Except", "ion", "s", "Table_", "(_", "resolution_", ")_", ",_", "zi", "dx_", ",_", "ann", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "delet", "ing", " ", "exception", "s", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"_", "%_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "KV", "IO_", ":_", "\\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_", "put", "Exceptions_", "(_", "self_", ",_", "ch_", ",_", "zi", "dx_", ",_", "resolution_", ",_", "ann", "id_", ",_", "exc", "str_", ",_", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stor", "e", " ", "a", " ", "list", " ", "of", " ", "exception", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "don", "e", " ", "in", " ", "a", " ", "transaction", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "Tx", "N", " ", "us", " ", "the", " ", "transaction", " ", "cursor", ".", " ", " ", "Ot", "her", "wis", "e", " ", "create", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "tx", "ncu", "rs", "or_", "\\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_", "not_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "{}", " ", "(", "zin", "dex", ",", " ", "id", ",", " ", "ex", "list", ")", " ", "VALU", "ES", " ", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")\"_", "._", "format_", "(_", "ch_", "._", "get", "Except", "ion", "s", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "zi", "dx_", ",_", "ann", "id_", ",_", "exc", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "insert", "ing", " ", "exception", "s", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"_", "%_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "this", " ", "case", " ", "we", " ", "have", " ", "an", " ", "update", " ", "query_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\"", "UPDATE", " ", "{}", " ", "SET", " ", "ex", "list", "=(", "%", "s", ")", " ", "WHE", "RE", " ", "zin", "dex", "=", "%", "s", " ", "AND", " ", "id", "=", "%", "s", "\"_", "._", "format_", "(_", "ch_", "._", "get", "Except", "ion", "s", "Table_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "sql_", ",_", "(_", "zlib_", "._", "compress_", "(_", "exc", "str_", ")_", ",_", "zi", "dx_", ",_", "ann", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "My", "SQL", "db_", "._", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "updat", "ing", " ", "exception", "s", " ", "%", "d", ":", " ", "%", "s", ".", " ", "sql", "=", "%", "s", "\"_", "%_", "(_", "e_", "._", "args_", "[_", "0_", "]_", ",_", "e_", "._", "args_", "[_", "1_", "]_", ",_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "if", " ", "not", " ", "in", " ", "a", " ", "txn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "tx", "ncu", "rs", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
PublicMapping/DistrictBuilder/django/publicmapping/redistricting/views.py
[ { "content": "\"\"\"\nDjango views used by the redistricting application.\n\nThe methods in redistricting.views define the views used to interact with\nthe models in the redistricting application. Each method relates to one \ntype of output url. There are views that return GeoJSON, JSON, and HTML.\n\nThis file is part of The Public Mapping Project\nhttps://github.com/PublicMapping/\n\nLicense:\n Copyright 2010-2012 Micah Altman, Michael McDonald\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\nAuthor: \n Andrew Jennings, David Zwarg, Kenny Shepard\n\"\"\"\n\nfrom django.http import *\nfrom django.core import serializers\nfrom django.core.exceptions import ValidationError, SuspiciousOperation, ObjectDoesNotExist\nfrom django.db import IntegrityError, connection, transaction\nfrom django.shortcuts import render_to_response\nfrom django.core.urlresolvers import reverse\nfrom django.core.context_processors import csrf\nfrom django.contrib.comments.models import Comment\nfrom django.contrib.comments.forms import CommentForm\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.auth.decorators import login_required, user_passes_test\nfrom django.contrib.sessions.models import Session\nfrom django.contrib.sessions.backends.db import SessionStore\nfrom django.contrib.gis.geos.collections import MultiPolygon\nfrom django.contrib.gis.geos import GEOSGeometry\nfrom django.contrib.gis.gdal import *\nfrom django.contrib.gis.gdal.libgdal import lgdal\nfrom django.contrib.sites.models import Site\nfrom django.contrib import humanize\nfrom django.template import loader, Context as DjangoContext, RequestContext\nfrom django.utils import simplejson as json, translation\nfrom django.utils.translation import ugettext as _, ungettext as _n\nfrom django.template.defaultfilters import slugify, force_escape\nfrom django.conf import settings\nfrom tagging.utils import parse_tag_input\nfrom tagging.models import Tag, TaggedItem\nfrom datetime import datetime, time, timedelta\nfrom decimal import *\nfrom functools import wraps\nfrom redistricting.calculators import *\nfrom redistricting.models import *\nfrom redistricting.tasks import *\nimport random, string, math, types, copy, time, threading, traceback, os\nimport commands, sys, tempfile, csv, hashlib, inflect, logging\n\nimport ModestMaps\nfrom PIL import Image, ImageChops, ImageMath\nimport urllib, urllib2\nfrom xhtml2pdf.pisa import CreatePDF\nimport StringIO\n\nlogger = logging.getLogger(__name__)\n\n# This constant is reused in multiple places.\nUNASSIGNED_DISTRICT_ID = 0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#\n# Comment views\n#\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def using_unique_session(u):\n \"\"\"\n A test to determine if the user of the application is using a unique \n session. Each user is permitted one unique session (one session in the\n django_session table that has not yet expired). If the user exceeds\n this quota, this test fails, and the user will get bounced to the login\n url.\n\n Parameters:\n u - The user. May be anonymous or registered.\n\n Returns:\n True - the user is an AnonymousUser or the number of sessions open\n by the user is only 1 (one must be open to make the request)\n False - the user is registered and has more than one open session.\n \"\"\"\n if u.is_anonymous() or u.is_superuser:\n return True\n\n sessions = Session.objects.all()\n count = 0\n for session in sessions:\n try:\n decoded = session.get_decoded()\n\n if '_auth_user_id' in decoded and decoded['_auth_user_id'] == u.id:\n if 'activity_time' in decoded and decoded['activity_time'] < datetime.now():\n # delete this session of mine; it is dormant\n Session.objects.filter(session_key=session.session_key).delete()\n else:\n count += 1\n except SuspiciousOperation:\n logger.debug(\"SuspiciousOperation caught while checking the number of sessions a user has open. Session key: %s\", session.session_key)\n\n # after counting all the open and active sessions, go back through\n # the session list and assign the session count to all web sessions\n # for this user. (do this for inactive sessions, too)\n for session in sessions:\n try:\n decoded = session.get_decoded()\n if '_auth_user_id' in decoded and decoded['_auth_user_id'] == u.id:\n websession = SessionStore(session_key=session.session_key)\n websession['count'] = count\n websession.save()\n except SuspiciousOperation:\n logger.debug(\"SuspiciousOperation caught while setting the session count on all user sessions. Session key: %s\", session.session_key)\n\n return (count <= 1)", "metadata": "root.using_unique_session", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def unique_session_or_json_redirect(function):\n \"\"\" \n A decorator method. Any method that accepts this decorator\n should have an HttpRequest as a parameter called \"request\".\n That request will be checked for a unique session. If the\n test passes, the original method is returned. If the session\n is not unique, then a JSON response is returned and the\n client is redirected to log off.\n \"\"\"\n def decorator(request, *args, **kwargs) :\n def return_nonunique_session_result():\n status = { 'success': False }\n status['message'] = _(\n \"The current user may only have one session open at a time.\")\n status['redirect'] = '/?msg=logoff'\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not using_unique_session(request.user):\n return return_nonunique_session_result()\n else:\n return function(request, *args, **kwargs)\n return wraps(function)(decorator)", "metadata": "root.unique_session_or_json_redirect", "header": "['module', '___EOS___']", "index": 124 }, { "content": "def is_session_available(req):\n \"\"\"\n Determine if a session is available. This is similar to a user test,\n but requires access to the user's session, so it cannot be used in the\n user_passes_test decorator.\n\n Parameters:\n req - The HttpRequest object, with user and session information.\n \"\"\"\n if req.user.is_superuser or req.user.is_staff:\n return True\n\n sessions = Session.objects.filter(expire_date__gt=datetime.now())\n count = 0\n for session in sessions:\n try:\n decoded = session.get_decoded()\n if (not req.user.is_anonymous()) and 'activity_time' in decoded and decoded['activity_time'] > datetime.now():\n count += 1\n except SuspiciousOperation:\n logger.debug(\"SuspiciousOperation caught while checking the last activity time in a user's session. Session key: %s\", session.session_key)\n\n avail = count < settings.CONCURRENT_SESSIONS\n req.session['avail'] = avail\n\n return avail", "metadata": "root.is_session_available", "header": "['module', '___EOS___']", "index": 147 }, { "content": "def note_session_activity(req):\n \"\"\"\n Add a session 'timeout' whenever a user performs an action. This is \n required to keep dormant (not yet expired, but inactive) sessions\n from maxing out the concurrent session limit.\n\n Parameters:\n req - An HttpRequest, with a session attribute\n \"\"\"\n # The timeout in this timedelta specifies the number of minutes.\n window = timedelta(0,0,0,0,settings.SESSION_TIMEOUT)\n req.session['activity_time'] = datetime.now() + window", "metadata": "root.note_session_activity", "header": "['module', '___EOS___']", "index": 174 }, { "content": "@login_required\ndef unloadplan(request, planid):\n \"\"\"\n Unload a plan.\n\n This view is called anytime a plan is unloaded. Example: navigating\n away from the page, or selecting a new plan. This method allows\n for any required plan cleanup such as purging temporary versions.\n\n Parameters:\n request -- The HttpRequest, which includes the user.\n planid -- The plan to unload.\n\n Returns:\n A JSON HttpResponse which includes a status.\n \"\"\"\n note_session_activity(request)\n status = { 'success': False }\n\n ps = Plan.objects.filter(pk=planid)\n if len(ps) > 0:\n p = ps[0]\n\n if not can_copy(request.user, p):\n status['message'] = _(\"User %(user)s doesn't have permission to unload this plan\") % {'user':request.user.username}\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n # Purge temporary versions\n if settings.MAX_UNDOS_AFTER_EDIT > 0:\n p.purge_beyond_nth_step(settings.MAX_UNDOS_AFTER_EDIT)\n \n status['success'] = True\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.unloadplan", "header": "['module', '___EOS___']", "index": 188 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef copyplan(request, planid):\n \"\"\"\n Copy a plan to a new, editable plan.\n\n This view is called by the plan chooser and the share plan tab. These\n actions take a template or shared plan, and copy the plan without its\n history into an editable plan in the current user's account.\n\n Parameters:\n request -- The HttpRequest, which includes the user.\n planid -- The original plan to copy.\n\n Returns:\n A JSON HttpResponse which includes either an error message or the\n copied plan ID.\n \"\"\"\n note_session_activity(request)\n\n if not is_plan_ready(planid):\n return HttpResponseRedirect('/')\n\n status = { 'success': False }\n p = Plan.objects.get(pk=planid)\n # Check if this plan is copyable by the current user.\n if not can_copy(request.user, p):\n status['message'] = _(\"User %(username)s doesn't have permission to \" \\\n \"copy this model\" % {'username': request.user.username})\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n # Create a random name if there is no name provided\n newname = p.name + \" \" + str(random.random()) \n if (request.method == \"POST\" ):\n newname = request.POST[\"name\"][0:200]\n shared = request.POST.get(\"shared\", False)\n\n plan_copy = Plan.objects.filter(name=newname, owner=request.user, legislative_body=p.legislative_body)\n # Check that the copied plan's name doesn't already exist.\n if len(plan_copy) > 0:\n status['message'] = _(\"You already have a plan named that. \" \\\n \"Please pick a unique name.\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n plan_copy = Plan(name=newname, owner=request.user, is_shared=shared, legislative_body=p.legislative_body, processing_state=ProcessingState.READY)\n plan_copy.create_unassigned = False\n plan_copy.save()\n\n # Get all the districts in the original plan at the most recent version\n # of the original plan.\n districts = p.get_districts_at_version(p.version, include_geom=True)\n for district in districts:\n district_copy = copy.copy(district)\n\n district_copy.id = None\n district_copy.version = 0\n district_copy.is_locked = False\n district_copy.plan = plan_copy\n\n try:\n district_copy.save() \n except Exception as inst:\n status[\"message\"] = _(\"Could not save district copies\")\n status[\"exception\"] = inst.message\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n # clone the characteristics, comments, and tags from the original \n # district to the copy \n district_copy.clone_relations_from(district)\n\n # Serialize the plan object to the response.\n data = serializers.serialize(\"json\", [ plan_copy ])\n\n return HttpResponse(data, mimetype='application/json')", "metadata": "root.copyplan", "header": "['module', '___EOS___']", "index": 222 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef scoreplan(request, planid):\n \"\"\"\n Validate a plan to allow for it to be shown in the leaderboard\n\n Parameters:\n request -- The HttpRequest, which includes the user.\n planid -- The plan to score.\n\n Returns:\n A JSON HttpResponse which includes a status, and if applicable,\n a reason why the plan couldn't be validated\n \"\"\"\n note_session_activity(request)\n status = { 'success': False }\n plan = Plan.objects.get(pk=planid)\n\n criterion = ValidationCriteria.objects.filter(legislative_body=plan.legislative_body)\n status['success'] = True\n for criteria in criterion:\n try:\n score = ComputedPlanScore.compute(criteria.function, plan)\n except:\n logger.debug(traceback.format_exc())\n\n if not score or not score['value']:\n status['success'] = False\n status['message'] = '<p>%s</p><p>%s</p>' % (criteria.get_short_label(), criteria.get_long_description() or criteria.function.get_long_description())\n break\n\n if status['success']:\n status['success'] = True\n status['message'] = _(\"Validation successful\")\n\n # Set is_valid status on the plan\n plan.is_valid = True\n plan.save()\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.scoreplan", "header": "['module', '___EOS___']", "index": 297 }, { "content": "def get_user_info(user):\n \"\"\"\n Get extended user information for the current user.\n\n Parameters:\n user -- The user attached to the HttpRequest\n\n Returns:\n A dict with user information, including profile information.\n \"\"\"\n if user.is_anonymous():\n return None\n\n profile = user.get_profile()\n\n return {\n 'username':user.username,\n 'email':user.email,\n 'password_hint':profile.pass_hint,\n 'firstname':user.first_name,\n 'lastname':user.last_name,\n 'organization':profile.organization,\n 'id':user.id\n }", "metadata": "root.get_user_info", "header": "['module', '___EOS___']", "index": 339 }, { "content": "def commonplan(request, planid):\n \"\"\"\n A common method that gets the same data structures for viewing\n and editing. This method is called by the viewplan and editplan \n views.\n \n Parameters:\n request -- An HttpRequest\n planid -- The plan ID to fetch.\n \n Returns:\n A python dict with common plan attributes set to the plan's values.\n \"\"\"\n note_session_activity(request)\n\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 1:\n plan = plan[0] \n plan.edited = getutc(plan.edited)\n levels = plan.legislative_body.get_geolevels()\n districts = plan.get_districts_at_version(plan.version,include_geom=False)\n editable = can_edit(request.user, plan)\n default_demo = plan.legislative_body.get_default_subject()\n max_dists = plan.legislative_body.max_districts\n body_member_short_label = plan.legislative_body.get_short_label()\n body_member_long_label = plan.legislative_body.get_label()\n body_members = plan.legislative_body.get_members_label()\n reporting_template = 'bard_%s.html' % plan.legislative_body.name if not plan.is_community() else None\n \n index = body_member_short_label.find('%(district_id)s')\n if index >= 0:\n body_member_short_label = body_member_short_label[0:index]\n index = body_member_long_label.find('%(district_id)s')\n if index >= 0:\n body_member_long_label = body_member_long_label[0:index]\n if not editable and not can_view(request.user, plan):\n plan = {}\n tags = []\n calculator_reports = []\n else:\n tags = Tag.objects.filter(name__startswith='type=').order_by('id').values_list('name',flat=True)\n tags = map(lambda x:x[5:], tags)\n\n # Reports defined with calculators (Score Displays, Panels, and Functions)\n # result is a map of relevant panels to score functions with labels and ids,\n # used for generating groups of checkboxes on the evaluate tab.\n calculator_reports = []\n if settings.REPORTS_ENABLED == 'CALC':\n report_displays = ScoreDisplay.objects.filter(name=\"%s_reports\" % plan.legislative_body.name)\n if len(report_displays) > 0:\n calculator_reports = map(lambda p: {\n 'title': p.__unicode__(),\n 'functions': map(lambda f: {\n 'label': f.get_label(),\n 'id': f.id\n }, p.score_functions.all().filter(selectable_bodies=plan.legislative_body))\n }, report_displays[0].scorepanel_set.all().order_by('position'))\n \n else:\n # If said plan doesn't exist, use an empty plan & district list.\n plan = {}\n levels = list()\n districts = {}\n editable = False\n default_demo = None\n max_dists = 0\n body_member_short_label = ''\n body_member_long_label = _('District') + ' '\n body_members = _n('district','districts',2)\n reporting_template = None\n tags = []\n calculator_reports = []\n demos = Subject.objects.all().order_by('sort_key')[0:3]\n layers = []\n snaplayers = []\n\n if len(levels) > 0:\n study_area_extent = list(levels[0].geounit_set.extent(field_name='simple'))\n else:\n # The geolevels with higher indexes are larger geography\n # Cycle through legislative bodies, since they may be in different regions\n for lb in LegislativeBody.objects.all():\n biglevel = lb.get_geolevels()[0]\n if biglevel.geounit_set.count() > 0:\n study_area_extent = biglevel.geounit_set.extent(field_name='simple')\n break\n\n for level in levels:\n # i18n-ize name here, not in js\n snaplayers.append({\n 'geolevel': level.id,\n 'level': level.name,\n 'layer': 'simple_' + level.name, \n 'long_description': level.get_long_description(),\n 'min_zoom': level.min_zoom\n })\n default_selected = False\n for demo in demos:\n isdefault = str((not default_demo is None) and (demo.id == default_demo.id)).lower()\n if isdefault == 'true':\n default_selected = True\n # i18n-ize name & short_display here, not in js\n layers.append({\n 'id':demo.id,\n 'text':demo.get_short_label(),\n 'value':demo.name, \n 'isdefault':isdefault, \n 'isdisplayed':str(demo.is_displayed).lower()\n })\n # If the default demo was not selected among the first three, we'll still need it for the dropdown menus\n if default_demo and not default_selected:\n layers.insert( 0, {\n 'id':default_demo.id,\n 'text':default_demo.get_short_label(),\n 'value':default_demo.name, \n 'isdefault':str(True).lower(), \n 'isdisplayed':str(default_demo.is_displayed).lower()\n })\n\n # Try to get the mapserver protocol from the settings module.\n # Set it to an empty string if the setting isn't defined so the \n # front-end Javascript will set a reasonable default (currently\n # the same protocol as the request to the webserver).\n if 'MAP_SERVER_PROTOCOL' in settings.__members__:\n mapserver_protocol = settings.MAP_SERVER_PROTOCOL\n else:\n mapserver_protocol = ''\n\n short_label = body_member_short_label.strip().lower()\n long_label = body_member_long_label.strip().lower()\n\n has_regions = Region.objects.all().count() > 1\n bodies = LegislativeBody.objects.all().order_by('region__sort_key','sort_key')\n l_bodies = [b for b in bodies if b in [sd.legislative_body for sd in ScoreDisplay.objects.filter(is_page=True)]]\n\n try:\n loader.get_template(reporting_template)\n except:\n reporting_template = None\n\n return RequestContext(request, {\n 'bodies': bodies,\n 'has_regions': has_regions,\n 'leaderboard_bodies': l_bodies,\n 'plan': plan,\n 'districts': districts,\n 'mapserver': settings.MAP_SERVER,\n 'mapserver_protocol': mapserver_protocol,\n 'basemaps': settings.BASE_MAPS,\n 'namespace': settings.MAP_SERVER_NS,\n 'ns_href': settings.MAP_SERVER_NSHREF,\n 'feature_limit': settings.FEATURE_LIMIT,\n 'adjacency': settings.ADJACENCY,\n 'convexchoropleth': settings.CONVEX_CHOROPLETH,\n 'demographics': layers,\n 'snaplayers': snaplayers,\n 'unassigned_id': UNASSIGNED_DISTRICT_ID,\n 'is_registered': request.user.username != 'anonymous' and request.user.username != '',\n 'debugging_staff': settings.DEBUG and request.user.is_staff,\n 'userinfo': get_user_info(request.user),\n 'is_editable': editable,\n 'max_dists': max_dists + 1,\n 'ga_account': settings.GA_ACCOUNT,\n 'ga_domain': settings.GA_DOMAIN,\n 'body_member_short_label': short_label, \n 'body_member_long_label': long_label,\n 'body_members': body_members,\n 'reporting_template': reporting_template,\n 'study_area_extent': study_area_extent,\n 'has_leaderboard' : len(ScoreDisplay.objects.filter(is_page=True)) > 0,\n 'calculator_reports' : json.dumps(calculator_reports),\n 'allow_email_submissions': ('EMAIL_SUBMISSION' in settings.__members__),\n 'tags': tags,\n 'site': Site.objects.get_current(),\n 'plan_text': _(\"community map\") if (plan and plan.is_community()) else _(\"plan\"),\n 'language_code': translation.get_language(),\n 'LANGUAGES': settings.LANGUAGES # needed (as CAPS) for language chooser\n })", "metadata": "root.commonplan", "header": "['module', '___EOS___']", "index": 364 }, { "content": "def is_plan_ready(planid):\n \"\"\"\n Determines if a plan is in a Ready state\n \"\"\"\n planid = int(planid)\n return planid == 0 or len(Plan.objects.filter(id=planid, processing_state=ProcessingState.READY)) > 0", "metadata": "root.is_plan_ready", "header": "['module', '___EOS___']", "index": 543 }, { "content": "@user_passes_test(using_unique_session)\ndef viewplan(request, planid):\n \"\"\"\n View a plan. \n \n This template has no editing capability.\n \n Parameters:\n request -- An HttpRequest, which includes the current user.\n planid -- The plan to view\n\n Returns:\n A rendered HTML page for viewing a plan.\n \"\"\"\n\n if not is_session_available(request) or not is_plan_ready(planid):\n return HttpResponseRedirect('/')\n\n # Cleanup old versions for logged in users\n if not request.user.is_anonymous() and (int(planid) == 0) and (settings.MAX_UNDOS_AFTER_EDIT > 0):\n for p in Plan.objects.filter(owner=request.user):\n p.purge_beyond_nth_step(settings.MAX_UNDOS_AFTER_EDIT)\n\n return render_to_response('viewplan.html', commonplan(request, planid))", "metadata": "root.viewplan", "header": "['module', '___EOS___']", "index": 550 }, { "content": "@user_passes_test(using_unique_session)\ndef editplan(request, planid):\n \"\"\"\n Edit a plan. \n \n This template enables editing tools and functionality.\n \n Parameters:\n request -- An HttpRequest, which includes the current user.\n planid -- The plan to edit.\n\n Returns:\n A rendered HTML page for editing a plan.\n \"\"\"\n if request.user.is_anonymous() or not is_session_available(request) or not is_plan_ready(planid):\n return HttpResponseRedirect('/')\n\n cfg = commonplan(request, planid)\n if cfg['is_editable'] == False:\n return HttpResponseRedirect('/districtmapping/plan/%s/view/' % planid)\n plan = Plan.objects.get(id=planid,owner=request.user)\n cfg['dists_maxed'] = len(cfg['districts']) > plan.legislative_body.max_districts\n cfg['available_districts'] = plan.get_available_districts()\n\n # Cleanup old versions\n if settings.MAX_UNDOS_AFTER_EDIT > 0:\n plan.purge_beyond_nth_step(settings.MAX_UNDOS_AFTER_EDIT)\n\n return render_to_response('editplan.html', cfg)", "metadata": "root.editplan", "header": "['module', '___EOS___']", "index": 576 }, { "content": "@user_passes_test(using_unique_session)\ndef printplan(request, planid):\n \"\"\"\n Print a static map of a plan.\n \n This template renders a static HTML document for use with xhtml2pdf.\n \n Parameters:\n request -- An HttpRequest, which includes the current user.\n planid -- The plan to edit.\n \n Returns:\n A rendered HTML page suitable for conversion to a PDF.\n \"\"\"\n if not is_session_available(request):\n return HttpResponseRedirect('/')\n \n cfg = commonplan(request, planid)\n\n sha = hashlib.sha1()\n sha.update(str(planid) + str(datetime.now()))\n cfg['composite'] = '/reports/print-%s.jpg' % sha.hexdigest()\n cfg['prefix'] = 'http://%s' % request.META['SERVER_NAME']\n\n if request.method == 'POST':\n if not 'bbox' in request.REQUEST or \\\n not 'geography_url' in request.REQUEST or \\\n not 'geography_lyr' in request.REQUEST or \\\n not 'district_url' in request.REQUEST or \\\n not 'district_lyr' in request.REQUEST:\n logger.warning('Missing required \"bbox\", \"geography_url\", \"geography_lyr\", \"district_url\", or \"districts_lyr\" parameter.')\n return HttpResponseRedirect('../view/')\n\n height = 500*2\n if 'height' in request.REQUEST:\n height = int(request.REQUEST['height'])*2\n width = 1024*2\n if 'width' in request.REQUEST:\n width = int(request.REQUEST['width'])*2\n opacity = 0.8\n if 'opacity' in request.REQUEST:\n opacity = float(request.REQUEST['opacity'])\n\n full_legend = json.loads(request.REQUEST['legend'])\n\n cfg['geography_url'] = request.REQUEST['geography_url']\n cfg['geography_lyr'] = request.REQUEST['geography_lyr']\n cfg['district_url'] = request.REQUEST['district_url']\n cfg['district_lyr'] = request.REQUEST['district_lyr']\n cfg['geo_legend'] = full_legend['geo']\n cfg['geo_legend_title'] = full_legend['geotitle']\n cfg['dist_legend'] = full_legend['dist']\n cfg['dist_legend_title'] = full_legend['disttitle']\n cfg['plan'] = Plan.objects.get(id=int(request.REQUEST['plan_id']))\n cfg['printed'] = datetime.now()\n\n # use modestmaps to get the basemap\n bbox = request.REQUEST['bbox'].split(',')\n\n pt1 = Point(float(bbox[0]), float(bbox[1]), srid=3785)\n pt1.transform(SpatialReference('EPSG:4326'))\n ll = ModestMaps.Geo.Location(pt1.y, pt1.x)\n\n pt2 = Point(float(bbox[2]), float(bbox[3]), srid=3785)\n pt2.transform(SpatialReference('EPSG:4326'))\n ur = ModestMaps.Geo.Location(pt2.y, pt2.x)\n\n dims = ModestMaps.Core.Point(width, height)\n provider = ModestMaps.OpenStreetMap.Provider()\n basemap = ModestMaps.mapByExtent(provider, ll, ur, dims)\n\n # create basemap for compositing\n fullImg = basemap.draw()\n\n\n # geography layer\n provider = ModestMaps.WMS.Provider(cfg['geography_url'], {\n 'LAYERS':cfg['geography_lyr'],\n 'TRANSPARENT':'true',\n 'SRS': 'EPSG:3785',\n 'HEIGHT': 512,\n 'WIDTH': 512\n })\n overlayImg = ModestMaps.mapByExtent(provider, ll, ur, dims).draw()\n\n # create an invert mask of the geography\n maskImg = ImageChops.invert(overlayImg)\n\n\n # district fill layer\n provider = ModestMaps.WMS.Provider(cfg['district_url'], {\n 'LAYERS':cfg['district_lyr'],\n 'TRANSPARENT':'false',\n 'SRS': 'EPSG:3785',\n 'SLD_BODY': request.REQUEST['district_sld'],\n 'HEIGHT': 512,\n 'WIDTH': 512\n })\n overlayImg = Image.blend(overlayImg, ModestMaps.mapByExtent(provider, ll, ur, dims).draw(), 0.5)\n\n # composite the overlay onto the base, using the mask (from geography)\n fullImg = Image.composite(fullImg, Image.blend(fullImg, overlayImg, opacity), maskImg)\n\n\n # district line & label layer\n provider = ModestMaps.WMS.Provider(cfg['district_url'], {\n 'LAYERS':cfg['district_lyr'],\n 'TRANSPARENT':'true',\n 'SRS': 'EPSG:3785',\n 'SLD_BODY': request.REQUEST['label_sld'],\n 'HEIGHT': 512,\n 'WIDTH': 512\n })\n overlayImg = ModestMaps.mapByExtent(provider, ll, ur, dims).draw()\n\n # create an invert mask of the labels & lines\n maskImg = ImageChops.invert(overlayImg)\n\n # composite the district labels on top of the composited basemap, geography & district areas\n fullImg = Image.composite(fullImg, Image.blend(fullImg, overlayImg, opacity), maskImg)\n\n # save\n fullImg.save(settings.WEB_TEMP + ('/print-%s.jpg' % sha.hexdigest()),'jpeg',quality=100)\n\n # render pg to a string\n t = loader.get_template('printplan.html')\n page = t.render(DjangoContext(cfg))\n result = StringIO.StringIO()\n\n # setting encoding='UTF-8' causes an exception. removing this for now,\n # as allowing the method to set an encoding itself fixes the problem.\n # we may need to find an alternate strategy if it finds encodings that\n # it isn't able to decipher.\n CreatePDF(page, result, show_error_as_pdf=True)\n\n response = HttpResponse(result.getvalue(), mimetype='application/pdf')\n response['Content-Disposition'] = 'attachment; filename=plan.pdf'\n\n return response\n \n else:\n return HttpResponseRedirect('../view/')", "metadata": "root.printplan", "header": "['module', '___EOS___']", "index": 606 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef createplan(request):\n \"\"\"\n Create a plan.\n\n Create a plan from a POST request. This plan will be 'blank', and will\n contain only the Unassigned district initially.\n\n Parameters:\n request -- An HttpRequest, which contains the current user.\n\n Returns:\n A JSON HttpResponse, including the new plan's information, or an\n error describing why the plan could not be created.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n if request.method == \"POST\":\n name = request.POST['name'][0:200]\n body = LegislativeBody.objects.get(id=int(request.POST['legislativeBody']))\n plan = Plan(name=name, owner=request.user, legislative_body=body, processing_state=ProcessingState.READY)\n try:\n plan.save()\n status = serializers.serialize(\"json\", [ plan ])\n except:\n status = { 'success': False, 'message': _(\"Couldn't save new plan\") }\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.createplan", "header": "['module', '___EOS___']", "index": 749 }, { "content": "@unique_session_or_json_redirect\ndef uploadfile(request):\n \"\"\"\n Accept a block equivalency file, and create a plan based on that\n file.\n\n Parameters:\n request -- An HttpRequest, with a file upload and plan name.\n\n Returns:\n A plan view, with additional information about the upload status.\n \"\"\"\n note_session_activity(request)\n\n if request.user.is_anonymous():\n # If a user is logged off from another location, they will appear\n # as an anonymous user. Redirect them to the front page. Sadly,\n # they will not get a notice that they were logged out.\n return HttpResponseRedirect('/')\n\n status = commonplan(request,0)\n status['upload'] = True\n status['upload_status'] = True\n\n index_file = request.FILES.get('indexFile', False)\n if not index_file:\n status['upload_status'] = False\n return render_to_response('viewplan.html', status)\n else:\n filename = index_file.name\n\n if index_file.size > settings.MAX_UPLOAD_SIZE:\n logger.error('File size exceeds allowable size.')\n status['upload_status'] = False\n return render_to_response('viewplan.html', status)\n\n if not filename.endswith(('.csv','.zip')):\n logger.error('Uploaded file must be \".csv\" or \".zip\".')\n status['upload_status'] = False\n elif request.POST['userEmail'] == '':\n logger.error('No email provided for user notification.')\n status['upload_status'] = False\n else:\n try:\n dest = tempfile.NamedTemporaryFile(mode='wb+', delete=False)\n for chunk in request.FILES['indexFile'].chunks():\n dest.write(chunk)\n dest.close()\n if request.FILES['indexFile'].name.endswith('.zip'):\n os.rename(dest.name, '%s%s' % (dest.name,'.zip'))\n filename = '%s%s' % (dest.name,'.zip')\n else:\n filename = dest.name\n\n except Exception as ex:\n logger.error('Could not save uploaded file')\n logger.error('Reason: %s', ex)\n status['upload_status'] = False\n return render_to_response('viewplan.html', status)\n\n # Put in a celery task to create the plan and email user on completion\n DistrictIndexFile.index2plan.delay(request.POST['txtNewName'], request.POST['legislativeBody'], filename, owner = request.user, template = False, purge = True, email = request.POST['userEmail'], language=translation.get_language())\n\n return render_to_response('viewplan.html', status) ", "metadata": "root.uploadfile", "header": "['module', '___EOS___']", "index": 779 }, { "content": "def generate_report_hash(qdict):\n \"\"\"\n Generate a hash based on the query items passed to this report request.\n \"\"\"\n\n params = qdict.get('popVar', ' ') + \\\n qdict.get('popVarExtra', ' ') + \\\n qdict.get('ratioVars[]', ' ') + \\\n qdict.get('splitVars', ' ') + \\\n qdict.get('blockLabelVar', 'CTID') + \\\n qdict.get('repCompactness', ' ') + \\\n qdict.get('repCompactnessExtra', ' ') + \\\n qdict.get('repSpatial', ' ') + \\\n qdict.get('repSpatialExtra', ' ')\n sha = hashlib.sha1()\n sha.update(params)\n return sha.hexdigest()", "metadata": "root.generate_report_hash", "header": "['module', '___EOS___']", "index": 844 }, { "content": "@unique_session_or_json_redirect\ndef getreport(request, planid):\n \"\"\"\n Get a BARD report.\n\n This view will write out an HTML-formatted BARD report to the directory\n given in the settings.\n \n Parameters:\n request -- An HttpRequest\n planid -- The plan to be reported.\n \n Returns:\n The HTML for use as a preview in the web application, along with \n the web address of the BARD report.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_view(request.user, plan):\n status['message'] = _(\"User can't view the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not settings.REPORTS_ENABLED is None:\n status['message'] = _('Reports functionality is turned off.')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n # Get the variables from the request\n if request.method != 'POST':\n status['message'] = _(\"Information for report wasn't sent via POST\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n stamp = request.POST.get('stamp', generate_report_hash(request.POST))\n\n rptstatus = PlanReport.checkreport(planid, stamp)\n if rptstatus == 'ready':\n status = {\n 'success': True,\n 'url': PlanReport.getreport(planid, stamp),\n 'retry': 0,\n 'message': _('Plan report is ready.'),\n 'stamp': stamp\n }\n elif rptstatus == 'busy':\n status = {\n 'success': True,\n 'url': reverse(getreport, args=[planid]),\n 'retry': 10,\n 'message': _('Report is building.'),\n 'stamp': stamp\n }\n elif rptstatus == 'free':\n status = {\n 'success': True,\n 'url': reverse(getreport, args=[planid]),\n 'retry': 10,\n 'message': _('Report generation started.'),\n 'stamp': stamp\n }\n\n req = {\n 'popVar': request.POST.get('popVar', ''),\n 'popVarExtra': request.POST.get('popVarExtra', ''),\n 'ratioVars[]': request.POST.getlist('ratioVars[]'),\n 'splitVars': request.POST.get('splitVars', ''),\n 'blockLabelVar': request.POST.get('blockLabelVar', 'CTID'),\n 'repComp': request.POST.get('repCompactness', ''),\n 'repCompExtra': request.POST.get('repCompactnessExtra', ''),\n 'repSpatial': request.POST.get('repSpatial', ''),\n 'repSpatialExtra': request.POST.get('repSpatialExtra', '')\n }\n\n PlanReport.markpending(planid, stamp)\n PlanReport.createreport.delay(planid, stamp, req, language=translation.get_language())\n else:\n status['message'] = _(\n 'Unrecognized status when checking report status.')\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.getreport", "header": "['module', '___EOS___']", "index": 862 }, { "content": "@unique_session_or_json_redirect\ndef getcalculatorreport(request, planid):\n \"\"\"\n Get a report which is generated by using calculators.\n\n This view will write out an HTML-formatted report to the directory\n given in the settings.\n \n Parameters:\n request -- An HttpRequest\n planid -- The plan to be reported.\n \n Returns:\n The HTML for use as a preview in the web application, along with \n the web address of the report.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_view(request.user, plan):\n status['message'] = _(\"User can't view the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if request.method != 'POST':\n status['message'] = _(\"Information for report wasn't sent via POST\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n # extract the function ids from the POST\n function_ids = request.POST.get('functionIds', '')\n \n # generate a hash of the function ids\n sha = hashlib.sha1()\n sha.update(function_ids)\n stamp = request.POST.get('stamp', sha.hexdigest())\n\n rptstatus = CalculatorReport.checkreport(planid, stamp)\n if rptstatus == 'ready':\n status = {\n 'success': True,\n 'url': CalculatorReport.getreport(planid, stamp),\n 'retry': 0,\n 'message': _('Plan report is ready.'),\n 'stamp': stamp\n }\n elif rptstatus == 'busy':\n status = {\n 'success': True,\n 'url': reverse(getcalculatorreport, args=[planid]),\n 'retry': 5,\n 'message': _('Report is building.'),\n 'stamp': stamp\n }\n elif rptstatus == 'free':\n status = {\n 'success': True,\n 'url': reverse(getcalculatorreport, args=[planid]),\n 'retry': 5,\n 'message': _('Report generation started.'),\n 'stamp': stamp\n }\n\n req = { 'functionIds': function_ids }\n CalculatorReport.markpending(planid, stamp)\n CalculatorReport.createcalculatorreport.delay(planid, stamp, req, language=translation.get_language())\n else:\n status['message'] = _(\n 'Unrecognized status when checking report status.')\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.getcalculatorreport", "header": "['module', '___EOS___']", "index": 948 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef newdistrict(request, planid):\n \"\"\"\n Create a new district.\n\n The 'geolevel' parameter is required to create a new district. Geounits\n may be added to this new district by setting the 'geounits' key in the\n request. \n\n Parameters:\n request - An HttpRequest, with the current user.\n planid - The plan id to which the district should be added.\n \n Returns:\n The new District's name and district_id.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n if len(request.REQUEST.items()) >= 3:\n plan = Plan.objects.get(pk=planid, owner=request.user)\n\n if 'geolevel' in request.REQUEST:\n geolevel = request.REQUEST['geolevel']\n else:\n geolevel = None\n if 'geounits' in request.REQUEST:\n geounit_ids = string.split(request.REQUEST['geounits'], '|')\n else:\n geounit_ids = None\n\n if 'district_id' in request.REQUEST:\n district_id = int(request.REQUEST['district_id'])\n else:\n district_id = None\n\n if 'district_short' in request.REQUEST:\n district_short = request.REQUEST['district_short'][0:10]\n elif not district_id is None:\n district_short = plan.legislative_body.get_short_label() % {'district_id':district_id}\n else:\n district_short = None\n\n if 'district_long' in request.REQUEST:\n district_long = request.REQUEST['district_long'][0:256]\n elif not district_id is None:\n district_long = plan.legislative_body.get_label() % {'district_id':district_id}\n else:\n district_long = None\n\n if 'version' in request.REQUEST:\n version = request.REQUEST['version']\n else:\n version = plan.version\n\n if geolevel and geounit_ids and district_id:\n try: \n # add the geounits selected to this district -- this will\n # create a new district w/1 version higher\n fixed = plan.add_geounits((district_id, district_short, district_long,), geounit_ids, geolevel, version)\n\n # if there are comments, types or multiple members, add them to the district\n district = plan.district_set.filter(district_id=district_id,short_label=district_short,long_label=district_long)[0]\n if plan.legislative_body.multi_members_allowed:\n district.num_members = plan.legislative_body.min_multi_district_members\n district.save()\n ct = ContentType.objects.get(app_label='redistricting',model='district')\n if 'comment' in request.POST and request.POST['comment'] != '':\n comment = Comment(\n object_pk=district.id, \n content_type=ct, \n site_id=Site.objects.get_current().id, \n user_name=request.user.username, \n user_email=request.user.email, \n comment=request.POST['comment'])\n comment.save()\n\n if len(request.REQUEST.getlist('type[]')) > 0:\n strtags = request.REQUEST.getlist('type[]')\n for strtag in strtags:\n if strtag == '':\n continue\n if strtag.count(' ') > 0:\n strtag = '\"type=%s\"' % strtag\n else:\n strtag = 'type=%s' % strtag\n Tag.objects.add_tag(district, strtag)\n\n status['success'] = True\n status['message'] = _('Created 1 new district')\n plan = Plan.objects.get(pk=planid, owner=request.user)\n status['edited'] = getutc(plan.edited).isoformat()\n status['district_id'] = district_id\n status['version'] = plan.version\n except ValidationError:\n status['message'] = _('Reached Max districts already')\n except Exception, ex:\n logger.warn('Error saving new district')\n logger.debug('Reason: %s', ex)\n status['message'] = _(\"Couldn't save new district.\")\n else:\n status['message'] = _('Must specify name, geolevel, ' \\\n 'and geounit ids for new district.')\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.newdistrict", "header": "['module', '___EOS___']", "index": 1024 }, { "content": "@login_required\n@unique_session_or_json_redirect\[email protected]_manually\ndef add_districts_to_plan(request, planid):\n \"\"\"\n This handler is used to paste existing districts from one\n plan into another plan\n \n Parameters:\n request -- An HttpRequest object including a list of districtids and\n a version\n planid -- The plan into which to paste the districts\n\n Returns:\n Some JSON explaining the success or failure of the paste operation\n \"\"\"\n\n status = { 'success': False }\n\n # Make sure we can edit the given plan\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_edit(request.user, plan):\n status['message'] = _(\"User can't edit the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n # Get the districts we want to merge\n district_list = request.POST.getlist('districts[]')\n if len(district_list) == 0:\n status['message'] = _(\"No districts selected to add to the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n else:\n districts = District.objects.filter(id__in=district_list)\n version = int(request.POST.get('version', None))\n status['message'] = _('Going to merge %(number_of_merged_districts)d' \\\n ' districts') % {'number_of_merged_districts': len(districts)}\n \n # Check to see if we have enough room to add these districts without\n # going over MAX_DISTRICTS for the legislative_body\n allowed_districts = plan.get_available_districts(version=version)\n \n if len(districts) > allowed_districts:\n status['message'] = _('Tried to merge too many districts; ' \\\n '%(allowed_districts)d slots left') % {'allowed_districts': allowed_districts}\n\n # Everything checks out, let's paste those districts\n try:\n results = plan.paste_districts(districts, version=version)\n transaction.commit()\n status['success'] = True\n status['message'] = _('Merged %(num_merged_districts)d districts') % {'num_merged_districts': len(results)}\n status['version'] = plan.version\n except Exception as ex:\n transaction.rollback()\n status['message'] = str(ex)\n status['exception'] = traceback.format_exc()\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.add_districts_to_plan", "header": "['module', '___EOS___']", "index": 1130 }, { "content": "@login_required\n@unique_session_or_json_redirect\[email protected]_manually\ndef assign_district_members(request, planid):\n \"\"\"\n This handler is used to assign members to districts\n \n Parameters:\n request -- An HttpRequest object including a version,\n and a mapping of districtids to num_members\n planid -- The plan into which to assign district members\n\n Returns:\n Some JSON explaining the success or failure of the paste operation\n \"\"\"\n\n status = { 'success': False }\n\n # Make sure we can edit the given plan\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_edit(request.user, plan):\n status['message'] = _(\"User can't edit the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n # Make sure this district allows multi-member assignment\n leg_bod = plan.legislative_body\n if (not leg_bod.multi_members_allowed):\n status['message'] = _(\n 'Multi-members not allowed for this legislative body')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n # Get the districts we want to assign members to\n districts = request.POST.getlist('districts[]')\n counts = request.POST.getlist('counts[]')\n version = int(request.POST.get('version', None)) \n\n # Assign the district members and return status\n try:\n changed = 0\n for i in range(0, len(districts)):\n id = int(districts[i])\n count = int(counts[i])\n district = District.objects.filter(plan=plan,district_id=id,version__lte=version).order_by('version').reverse()[0]\n\n if district.num_members != count:\n if (changed == 0):\n # If there is at least one change, update the plan\n if version != plan.version:\n plan.purge(after=version)\n\n plan.version = plan.version + 1\n plan.save()\n\n plan.update_num_members(district, count)\n changed += 1\n\n transaction.commit()\n status['success'] = True\n status['version'] = plan.version\n status['modified'] = changed\n status['message'] = _('Modified members for %(num_districts)d '\n 'districts') % {'num_districts': changed}\n except Exception, ex:\n transaction.rollback()\n status['message'] = str(ex)\n status['exception'] = traceback.format_exc()\n logger.warn('Could not assign district members')\n logger.debug('Reason: %s', ex)\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.assign_district_members", "header": "['module', '___EOS___']", "index": 1193 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef combine_districts(request, planid):\n \"\"\"\n Take the contents of one district and add them to another districts\n \"\"\"\n \n status = { 'success': False }\n\n # Make sure we can edit the given plan\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_edit(request.user, plan):\n status['message'] = _(\"User can't edit the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n # Get the districts we want to merge\n version = int(request.POST.get('version', plan.version))\n from_id = int(request.POST.get('from_district_id', -1))\n to_id = int(request.POST.get('to_district_id', None))\n\n try:\n all_districts = plan.get_districts_at_version(version, include_geom=True)\n \n from_districts = filter(lambda d: True if d.district_id == from_id else False, all_districts)\n to_district = filter(lambda d: True if d.district_id == to_id else False, all_districts)[0]\n\n locked = to_district.is_locked\n for district in from_districts:\n if district.is_locked:\n locked = True\n\n if locked:\n status['message'] = _(\"Can't combine locked districts\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n result = plan.combine_districts(to_district, from_districts, version=version)\n\n if result[0] == True:\n status['success'] = True\n status['message'] = _('Successfully combined districts')\n status['version'] = result[1]\n except Exception, ex:\n status['message'] = _('Could not combine districts')\n status['exception'] = traceback.format_exc()\n logger.warn('Could not combine districts')\n logger.debug('Reason: %s', ex)\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.combine_districts", "header": "['module', '___EOS___']", "index": 1269 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef fix_unassigned(request, planid):\n \"\"\"\n Assign unassigned base geounits that are fully contained\n or adjacent to another district\n \"\"\"\n \n status = { 'success': False }\n\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_edit(request.user, plan):\n status['message'] = _(\"User can't edit the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n try:\n version = int(request.POST.get('version', plan.version))\n result = plan.fix_unassigned(version)\n status['success'] = result[0]\n status['message'] = result[1]\n status['version'] = plan.version\n except Exception, ex:\n status['message'] = _('Could not fix unassigned')\n status['exception'] = traceback.format_exc()\n logger.warn('Could not fix unassigned')\n logger.debug('Reason: %s', ex)\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.fix_unassigned", "header": "['module', '___EOS___']", "index": 1322 }, { "content": "@unique_session_or_json_redirect\ndef get_splits(request, planid, otherid, othertype):\n \"\"\"\n Find all splits between this plan and another plan\n\n Parameters:\n request -- An HttpRequest optionally containing version and/or otherversion\n planid -- The plan ID\n otherid -- The plan ID or geolevel ID to find splits with\n othertype -- One of: 'plan' or 'geolevel'. For specifying otherid\n\n Returns:\n A JSON HttpResponse that contains an array of splits, given as arrays,\n where the first item is the district_id of the district in this plan\n which causes the split, and the second item is the district_id of the\n district in the other plan or geolevel. When a geolevel is specified,\n the portable_id will be used, rather than the district_id.\n \"\"\"\n\n otherid = int(otherid)\n status = { 'success': False }\n\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _('No plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n if not can_view(request.user, plan):\n status['message'] = _(\"User can't view the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n version = int(request.REQUEST['version'] if 'version' in request.REQUEST else plan.version)\n try:\n if othertype == 'plan':\n try:\n otherplan = Plan.objects.get(pk=otherid)\n except:\n status['message'] = _('No other plan with the given id')\n return HttpResponse(json.dumps(status),mimetype='application/json')\n if not can_view(request.user, otherplan):\n status['message'] = _(\"User can't view the given plan\")\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n otherversion = int(request.REQUEST['otherversion'] if 'otherversion' in request.REQUEST else otherplan.version)\n splits = plan.find_plan_splits(otherplan, version, otherversion)\n elif othertype == 'geolevel':\n splits = plan.find_geolevel_splits(otherid, version)\n else:\n status['message'] = _('othertype not supported: %(other)s') % { 'other': othertype }\n return HttpResponse(json.dumps(status),mimetype='application/json')\n\n split_word = _('split') if len(splits) == 1 else inflect.engine().plural(_('split'))\n\n status['success'] = True\n status['message'] = _('Found %(num_splits)d %(split_word)s') % \\\n {'num_splits': len(splits), 'split_word': split_word}\n status['splits'] = splits\n status['above_ids'] = list(set([i[0] for i in splits]))\n status['below_ids'] = list(set([i[1] for i in splits]))\n except Exception, ex:\n status['message'] = _('Could not query for splits')\n status['exception'] = traceback.format_exc()\n logger.warn('Could not query for splits')\n logger.debug('Reason: %s', ex)\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.get_splits", "header": "['module', '___EOS___']", "index": 1356 }, { "content": "def get_processing_status(request):\n \"\"\"\n Get the processing status for a list of plan ids\n \"\"\"\n status = { 'success': False }\n plan_ids = request.REQUEST.getlist('planIds[]')\n if len(plan_ids) == 0:\n status['message'] = _('No planIds provided')\n else:\n statuses = {}\n for p in Plan.objects.filter(id__in=plan_ids):\n statuses[str(p.id)] = p.get_processing_state_display()\n\n status['success'] = True\n status['message'] = statuses\n \n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.get_processing_status", "header": "['module', '___EOS___']", "index": 1423 }, { "content": "def get_splits_report(request, planid):\n \"\"\"\n Get the rendered splits report\n \"\"\"\n note_session_activity(request)\n\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n return HttpResponse(_('Plan does not exist.'), mimetype='text/plain')\n\n if not using_unique_session(request.user) or not can_view(request.user, plan):\n return HttpResponseForbidden()\n\n version = int(request.REQUEST['version'] if 'version' in request.REQUEST else plan.version)\n inverse = request.REQUEST['inverse'] == 'true' if 'inverse' in request.REQUEST else False\n extended = request.REQUEST['extended'] == 'true' if 'extended' in request.REQUEST else False\n layers = request.REQUEST.getlist('layers[]')\n if len(layers) == 0:\n return HttpResponse(_('No layers were provided.'), mimetype='text/plain')\n\n try :\n report = loader.get_template('split_report.html')\n html = ''\n for layer in layers:\n my_context = {'extended': extended}\n my_context.update(plan.compute_splits(layer, version = version, inverse = inverse, extended = extended))\n last_item = layer is layers[-1]\n community_info = plan.get_community_type_info(layer, version = version, inverse = inverse, include_counts=last_item)\n if community_info is not None:\n my_context.update(community_info)\n calc_context = DjangoContext(my_context)\n html += report.render(calc_context)\n if not last_item:\n html += '<hr />'\n return HttpResponse(html, mimetype='text/html')\n except Exception, ex:\n logger.warn('Could not produce split report')\n logger.debug('Reason: %s', ex)\n return HttpResponse(str(ex), mimetype='text/plain')", "metadata": "root.get_splits_report", "header": "['module', '___EOS___']", "index": 1441 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef addtodistrict(request, planid, districtid):\n \"\"\"\n Add geounits to a district.\n\n This method requires both \"geolevel\" and \"geounits\" URL parameters. \n The geolevel must be a valid geolevel name and the geounits parameters \n should be a pipe-separated list of geounit ids.\n\n Parameters:\n request -- An HttpRequest, with the current user, the geolevel, and\n the pipe-separated geounit list.\n planid -- The plan ID that contains the district.\n districtid -- The district ID to which the geounits will be added.\n\n Returns:\n A JSON HttpResponse that contains the number of districts modified,\n or an error message if adding fails.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n\n if len(request.REQUEST.items()) >= 2:\n try:\n geolevel = request.REQUEST[\"geolevel\"]\n geounit_ids = string.split(request.REQUEST[\"geounits\"], \"|\")\n plan = Plan.objects.get(pk=planid,owner=request.user)\n except:\n status['exception'] = traceback.format_exc()\n status['message'] = _('Could not add units to district.')\n\n # get the version from the request or the plan\n if 'version' in request.REQUEST:\n version = request.REQUEST['version']\n else:\n version = plan.version\n\n try:\n fixed = plan.add_geounits(districtid, geounit_ids, geolevel, version)\n status['success'] = True;\n status['message'] = _('Updated %(num_fixed_districts)d districts') \\\n % {'num_fixed_districts': fixed}\n status['updated'] = fixed\n plan = Plan.objects.get(pk=planid,owner=request.user)\n status['edited'] = getutc(plan.edited).isoformat()\n status['version'] = plan.version\n except Exception, ex: \n status['exception'] = traceback.format_exc()\n status['message'] = _('Could not add units to district.')\n logger.warn('Could not add units to district')\n logger.debug('Reason: %s', ex)\n\n else:\n status['message'] = _(\"Geounits weren't found in a district.\")\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.addtodistrict", "header": "['module', '___EOS___']", "index": 1483 }, { "content": "@unique_session_or_json_redirect\n@login_required\ndef setdistrictlock(request, planid, district_id):\n \"\"\"\n Set whether this district is locked for editing.\n\n Parameters:\n request -- An HttpRequest, with a boolean that indicates whether the district\n should be locked or unlocked\n planid -- The plan ID that contains the district.\n district_id -- The district_id to lock or unlock\n\n Returns:\n A JSON HttpResponse that contains a boolean of whether the district is locked.\n \"\"\"\n note_session_activity(request)\n\n status = {'success':False}\n\n if request.method != 'POST':\n return HttpResponseForbidden()\n \n lock = request.POST.get('lock').lower() == 'true'\n version = request.POST.get('version')\n if lock == None:\n status['message'] = _('Must include lock parameter.')\n elif version == None:\n status['message'] = _('Must include version parameter.')\n\n try:\n plan = Plan.objects.get(pk=planid)\n district = plan.district_set.filter(district_id=district_id,version__lte=version).order_by('version').reverse()[0]\n except ObjectDoesNotExist:\n status['message'] = _('Plan or district does not exist.')\n return HttpResponse(json.dumps(status), mimetype='application/json')\n\n if plan.owner != request.user:\n return HttpResponseForbidden()\n \n district.is_locked = lock\n district.save()\n status['success'] = True\n status['message'] = _('District successfully %(locked_state)s') % \\\n {'locked_state': _('locked') if lock else _('unlocked')}\n \n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.setdistrictlock", "header": "['module', '___EOS___']", "index": 1542 }, { "content": "@unique_session_or_json_redirect\ndef getdistricts(request, planid):\n \"\"\"\n Get the districts in a plan at a specific version.\n\n Parameters:\n request - An HttpRequest, with the current user.\n planid - The plan id to query for the districts.\n Returns:\n \"\"\"\n note_session_activity(request)\n\n status = {'success':False}\n\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 1:\n plan = plan[0]\n\n if 'version' in request.REQUEST:\n version = int(request.REQUEST['version'])\n else:\n version = plan.version\n\n districts = plan.get_districts_at_version(version,include_geom=False)\n\n status['districts'] = []\n\n # Same calculation as plan.get_available_districts, but\n # g_a_d fetches districts all over again -- skip that overhead\n status['available'] = plan.legislative_body.max_districts - len(districts) + 1\n\n # Find the maximum version in the returned districts\n max_version = max([d.version for d in districts])\n\n # Only allow undo if the max version being returned isn't\n # equal to the minimum stored version\n can_undo = max_version > plan.min_version\n\n for district in districts:\n status['districts'].append({\n 'id':district.district_id,\n 'short_label':' '.join(map(_, district.short_label.split(' '))),\n 'long_label':' '.join(map(_, district.long_label.split(' '))),\n 'version':district.version\n })\n status['canUndo'] = can_undo\n status['success'] = True\n\n else:\n status['message'] = _('No plan exists with that ID.')\n\n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.getdistricts", "header": "['module', '___EOS___']", "index": 1590 }, { "content": "def simple_district_versioned(request, planid, district_ids=None):\n \"\"\"\n Emulate a WFS service for versioned districts.\n\n This function retrieves one version of the districts in a plan, with\n the value of the subject attached to the feature. This function is\n necessary because a traditional view could not be used to get the\n districts in a versioned fashion.\n\n This method accepts 'version__eq' and 'subjects__eq' URL parameters.\n\n This method accepts an optional 'district_ids__eq' parameter, which is\n a comma-separated list of district_ids to filter by\n\n Parameters:\n request -- An HttpRequest, with the current user.\n planid -- The plan ID from which to get the districts.\n\n Returns:\n A GeoJSON HttpResponse, describing the districts in the plan.\n \"\"\"\n note_session_activity(request)\n\n status = {'type':'FeatureCollection'}\n\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 1:\n plan = plan[0]\n if 'version__eq' in request.REQUEST:\n version = request.REQUEST['version__eq']\n else:\n version = plan.version\n\n subject_id = None\n if 'subject__eq' in request.REQUEST:\n subject_id = request.REQUEST['subject__eq']\n elif plan.legislative_body.get_default_subject():\n subject_id = plan.legislative_body.get_default_subject().id\n\n geolevel = plan.legislative_body.get_geolevels()[0].id\n if 'level__eq' in request.REQUEST:\n geolevel = int(request.REQUEST['level__eq'])\n\n if 'district_ids__eq' in request.REQUEST:\n district_ids = request.REQUEST['district_ids__eq']\n if len(district_ids) > 0:\n district_ids = district_ids.split(',')\n else:\n district_ids = []\n\n if subject_id:\n bbox = None\n if 'bbox' in request.REQUEST:\n bbox = request.REQUEST['bbox']\n # convert the request string into a tuple full of floats\n bbox = tuple( map( lambda x: float(x), bbox.split(',')))\n else:\n bbox = plan.district_set.all().extent(field_name='simple')\n\n status['features'] = plan.get_wfs_districts(version, subject_id, bbox, geolevel, district_ids)\n else:\n status['features'] = []\n status['message'] = _('Subject for districts is required.')\n else:\n status['features'] = []\n status['message'] = _('Query failed.')\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.simple_district_versioned", "header": "['module', '___EOS___']", "index": 1644 }, { "content": "def get_unlocked_simple_geometries(request,planid):\n \"\"\"\n Emulate a WFS service for selecting unlocked geometries.\n\n This function retrieves all unlocked geometries within a geolevel\n for a given plan. This function is necessary because a traditional\n view could not be used to obtain the geometries in a versioned fashion.\n\n This method accepts 'version__eq', 'level__eq', and 'geom__eq' URL parameters.\n\n Parameters:\n request -- An HttpRequest, with the current user.\n planid -- The plan ID from which to get the districts.\n\n Returns:\n A GeoJSON HttpResponse, describing the unlocked simplified geometries\n \"\"\"\n note_session_activity(request)\n\n status = {'type':'FeatureCollection'}\n\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 1:\n plan = plan[0]\n version = request.POST.get('version__eq', plan.version)\n geolevel = request.POST.get('level__eq', plan.legislative_body.get_geolevels()[0].id)\n geom = request.POST.get('geom__eq', None)\n if geom is not None:\n try:\n wkt = request.POST.get('geom__eq', None)\n geom = GEOSGeometry(wkt)\n # If we can't get a poly, try a linestring\n except GEOSException:\n wkt = request.REQUEST['geom__eq'].replace('POLYGON', 'LINESTRING')\n wkt = wkt.replace('((', '(').replace('))', ')')\n try: \n geom = GEOSGeometry(wkt)\n except GEOSException:\n # If the line doesn't work, just don't return anything\n geom = None\n\n # Selection is the geounits that intersects with the drawing tool used:\n # either a lasso, a rectangle, or a point\n selection = Q(geom__intersects=geom)\n\n # Create a union of locked geometries\n districts = [d.id for d in plan.get_districts_at_version(version, include_geom=True) if d.is_locked]\n locked = District.objects.filter(id__in=districts).collect()\n\n # Create a simplified locked boundary for fast, but not completely accurate lookups\n # Note: the preserve topology parameter of simplify is needed here\n locked_buffered = locked.simplify(100, True).buffer(100) if locked else None\n\n # Filter first by geolevel, then selection\n filtered = Geolevel.objects.get(id=geolevel).geounit_set.filter(selection)\n # Assemble the matching features into geojson\n features = []\n for feature in filtered:\n # We want to allow for the selection of a geometry that is partially split\n # with a locked district, so subtract out all sections that are locked\n geom = feature.simple\n\n # Only perform additional tests if the fast, innacurate lookup passed\n if locked and geom.intersects(locked_buffered):\n\n # If a geometry is fully locked, don't add it\n if feature.geom.within(locked):\n continue\n\n # Overlapping geometries are the ones we need to subtract pieces of\n if feature.geom.overlaps(locked):\n # Since this is just for display, do the difference on the simplified geometries\n geom = geom.difference(locked_buffered)\n \n features.append({\n # Note: OpenLayers breaks when the id is set to an integer, or even an integer string.\n # The id ends up being treated as an array index, rather than a property list key, and\n # there are some bizarre consequences. That's why the underscore is here.\n 'id': '_%d' % feature.id,\n 'geometry': json.loads(geom.json),\n 'properties': {\n 'name': feature.name,\n 'geolevel_id': geolevel,\n 'id': feature.id\n }\n })\n \n status['features'] = features\n return HttpResponse(json.dumps(status),mimetype='application/json')\n \n else:\n status['features'] = []\n status['message'] = _('Geometry is required.')\n \n else:\n status['features'] = []\n status['message'] = _('Invalid plan.')\n\n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.get_unlocked_simple_geometries", "header": "['module', '___EOS___']", "index": 1714 }, { "content": "@unique_session_or_json_redirect\ndef get_statistics(request, planid):\n note_session_activity(request)\n\n status = { 'success': False }\n try:\n plan = Plan.objects.get(pk=planid)\n except:\n status['message'] = _(\n \"Couldn't get geography info from the server. No plan with the given id.\")\n return HttpResponse( json.dumps(status), mimetype='application/json', status=500)\n\n if 'version' in request.REQUEST:\n try:\n version = int(request.REQUEST['version'])\n except:\n version = plan.version\n else:\n version = plan.version\n\n try:\n display = ScoreDisplay.objects.get(legislative_body=plan.legislative_body, name=\"%s_sidebar_demo\" % plan.legislative_body.name)\n except:\n status['message'] = _('Unable to get Demographics ScoreDisplay')\n status['exception'] = traceback.format_exc()\n \n if 'displayId' in request.REQUEST:\n try:\n display = ScoreDisplay.objects.get(pk=request.POST['displayId'])\n except:\n status['message'] = _('Unable to get Personalized ScoreDisplay')\n status['exception'] = traceback.format_exc()\n\n else:\n logger.warn('No displayId in request.')\n logger.warn(str(request.POST))\n \n try :\n html = display.render(plan, request, version=version)\n return HttpResponse(html, mimetype='text/html')\n except Exception, ex:\n status['message'] = _(\"Couldn't render display tab.\")\n status['exception'] = traceback.format_exc()\n logger.warn(\"Couldn't render display tab\")\n logger.debug('Reason: %s', ex)\n return HttpResponse( json.dumps(status), mimetype='application/json', status=500)", "metadata": "root.get_statistics", "header": "['module', '___EOS___']", "index": 1814 }, { "content": "def getutc(t):\n \"\"\"\n Given a datetime object, translate to a datetime object for UTC time.\n \"\"\"\n t_tuple = t.timetuple()\n t_seconds = time.mktime(t_tuple)\n return t.utcfromtimestamp(t_seconds)", "metadata": "root.getutc", "header": "['module', '___EOS___']", "index": 1862 }, { "content": "@unique_session_or_json_redirect\ndef getdistrictfilestatus(request, planid):\n \"\"\"\n Given a plan id, return the status of the district index file\n \"\"\" \n note_session_activity(request)\n\n status = { 'success':False }\n plan = Plan.objects.get(pk=planid)\n if not can_copy(request.user, plan):\n return HttpResponseForbidden()\n try:\n is_shape = 'type' in request.REQUEST and request.REQUEST['type'] == 'shape'\n file_status = DistrictFile.get_file_status(plan, shape=is_shape)\n status['success'] = True\n status['status'] = file_status \n except Exception as ex:\n status['message'] = _('Failed to get file status')\n status['exception'] = ex \n return HttpResponse(json.dumps(status),mimetype='application/json')", "metadata": "root.getdistrictfilestatus", "header": "['module', '___EOS___']", "index": 1870 }, { "content": "@unique_session_or_json_redirect\ndef getdistrictfile(request, planid):\n \"\"\"\n Given a plan id, email the user a zipped copy of \n the district index file\n \"\"\"\n note_session_activity(request)\n\n # Get the districtindexfile and create a response\n plan = Plan.objects.get(pk=planid)\n if not can_copy(request.user, plan):\n return HttpResponseForbidden()\n \n is_shape = 'type' in request.REQUEST and request.REQUEST['type'] == 'shape'\n file_status = DistrictFile.get_file_status(plan, shape=is_shape)\n if file_status == 'done':\n if is_shape:\n archive = DistrictShapeFile.plan2shape(plan)\n else:\n archive = DistrictIndexFile.plan2index(plan)\n response = HttpResponse(open(archive.name).read(), content_type='application/zip')\n response['Content-Disposition'] = 'attachment; filename=\"%s.zip\"' % plan.get_friendly_name()\n else:\n # Put in a celery task to create this file\n if is_shape:\n DistrictShapeFile.plan2shape.delay(plan)\n else:\n DistrictIndexFile.plan2index.delay(plan)\n response = HttpResponse(_('File is not yet ready. Please try again in '\n 'a few minutes'))\n return response", "metadata": "root.getdistrictfile", "header": "['module', '___EOS___']", "index": 1891 }, { "content": "@unique_session_or_json_redirect\ndef emaildistrictindexfile(request, planid):\n \"\"\"\n Given a plan id, email a zipped copy of the district \n index file to a specified address\n \"\"\"\n note_session_activity(request)\n\n if request.method != 'POST':\n return HttpResponseForbidden()\n \n plan = Plan.objects.get(pk=planid)\n if not can_copy(request.user, plan):\n return HttpResponseForbidden()\n \n # Put in a celery task to create the file and send the emails\n DistrictIndexFile.emailfile.delay(plan, request.user, request.POST, translation.get_language())\n return HttpResponse(json.dumps({\n 'success': True,\n 'message': _('Task submitted') }),\n mimetype='application/json')", "metadata": "root.emaildistrictindexfile", "header": "['module', '___EOS___']", "index": 1923 }, { "content": "def getvalidplans(leg_body, owner=None):\n \"\"\"\n Returns the valid plans for a given legislative body and owner (optional)\n \"\"\"\n pfilter = Q(legislative_body=leg_body) & Q(is_valid=True)\n if owner is not None:\n pfilter = pfilter & Q(owner=owner)\n\n return list(Plan.objects.filter(pfilter))", "metadata": "root.getvalidplans", "header": "['module', '___EOS___']", "index": 1945 }, { "content": "def getleaderboarddisplay(leg_body, owner_filter):\n \"\"\"\n Returns the leaderboard ScoreDisplay given a legislative body and owner\n \"\"\"\n try:\n return ScoreDisplay.objects.get(name=\"%s_leader_%s\" % (leg_body.name, owner_filter))\n except:\n return None", "metadata": "root.getleaderboarddisplay", "header": "['module', '___EOS___']", "index": 1955 }, { "content": "def getleaderboard(request):\n \"\"\"\n Get the rendered leaderboard\n \"\"\"\n note_session_activity(request)\n\n if not using_unique_session(request.user):\n return HttpResponseForbidden()\n\n owner_filter = request.REQUEST['owner_filter']\n body_pk = int(request.REQUEST['legislative_body']);\n leg_body = LegislativeBody.objects.get(pk=body_pk)\n \n display = getleaderboarddisplay(leg_body, owner_filter)\n if display is None:\n return HttpResponse(_('No display configured'), mimetype='text/plain')\n \n plans = getvalidplans(leg_body, request.user if owner_filter == 'mine' else None)\n\n try :\n html = display.render(plans, request)\n return HttpResponse(html, mimetype='text/html; charset=utf-8')\n except Exception, ex:\n logger.warn('Leaderboard could not be fetched.')\n logger.debug('Reason: %s', ex)\n return HttpResponse(str(ex), mimetype='text/plain')", "metadata": "root.getleaderboard", "header": "['module', '___EOS___']", "index": 1964 }, { "content": "def getleaderboardcsv(request):\n \"\"\"\n Get the leaderboard scores in csv form\n \"\"\"\n note_session_activity(request)\n\n if not using_unique_session(request.user):\n return HttpResponseForbidden()\n\n owner_filter = request.REQUEST['owner_filter']\n body_pk = int(request.REQUEST['legislative_body']);\n leg_body = LegislativeBody.objects.get(pk=body_pk)\n plans = getvalidplans(leg_body, request.user if owner_filter == 'mine' else None)\n\n display = getleaderboarddisplay(leg_body, owner_filter)\n plans = getvalidplans(leg_body, request.user if owner_filter == 'mine' else None)\n\n panels = display.scorepanel_set.all().order_by('position')\n \n try :\n # mark the response as csv, and create the csv writer\n response = HttpResponse(mimetype='text/csv')\n response['Content-Disposition'] = 'attachment; filename=leaderboard_scores.csv'\n writer = csv.writer(response)\n\n # write headers\n writer.writerow(['Plan ID', 'Plan Name', 'User Name'] + [p.__unicode__() for p in panels])\n\n # write row for each plan\n for plan in plans:\n row = [plan.id, plan.name, plan.owner.username]\n\n # add each score\n for panel in panels:\n function = panel.score_functions.all()[0]\n score = ComputedPlanScore.compute(function, plan)\n row.append(score['value'])\n \n # write the row\n writer.writerow(row)\n \n return response \n except Exception, ex:\n logger.warn(\"Couldn't generate CSV of leaderboard.\")\n logger.debug('Reason: %s', ex)\n return HttpResponse(str(ex), mimetype='text/plain')", "metadata": "root.getleaderboardcsv", "header": "['module', '___EOS___']", "index": 1991 }, { "content": "def getplans(request):\n \"\"\"\n Get the plans for the given user and return the data in a format readable\n by the jqgrid\n \"\"\"\n note_session_activity(request)\n\n if not using_unique_session(request.user):\n return HttpResponseForbidden()\n\n if request.method == 'POST':\n page = int(request.POST.get('page', 1))\n rows = int(request.POST.get('rows', 10))\n sidx = request.POST.get('sidx', 'id')\n sord = request.POST.get('sord', 'asc')\n owner_filter = request.POST.get('owner_filter');\n body_pk = request.POST.get('legislative_body');\n body_pk = int(body_pk) if body_pk else body_pk;\n search = request.POST.get('_search', False);\n search_string = request.POST.get('searchString', '');\n is_community = request.POST.get('is_community', False) == 'true';\n else:\n return HttpResponseForbidden()\n end = page * rows\n start = end - rows\n \n if owner_filter == 'template':\n available = Q(is_template=True)\n elif owner_filter == 'shared':\n available = Q(is_shared=True)\n elif owner_filter == 'mine':\n if request.user.is_anonymous():\n return HttpResponseForbidden()\n else:\n available = Q(owner__exact=request.user)\n elif owner_filter == 'all_available':\n available = Q(is_template=True) | Q(is_shared=True)\n if not request.user.is_anonymous():\n available = available | Q(owner__exact=request.user)\n else:\n return HttpResponseBadRequest(_(\"Unknown filter method.\"))\n \n not_creating = ~Q(processing_state=ProcessingState.CREATING) & ~Q(processing_state=ProcessingState.UNKNOWN)\n\n # Set up the order_by parameter from sidx and sord in the request\n if sidx.startswith('fields.'):\n sidx = sidx[len('fields.'):]\n if sidx == 'owner':\n sidx = 'owner__username'\n if sidx == 'plan_type':\n sidx = 'legislative_body__name'\n if sord == 'desc':\n sidx = '-' + sidx\n\n if search:\n search_filter = Q(name__icontains = search_string) | Q(description__icontains = search_string) | Q(owner__username__icontains = search_string)\n else:\n search_filter = None\n\n if body_pk:\n body_filter = Q(legislative_body=body_pk)\n all_plans = Plan.objects.filter(available, not_creating, body_filter, search_filter).order_by(sidx)\n else:\n community_filter = Q(legislative_body__is_community=is_community)\n all_plans = Plan.objects.filter(available, not_creating, search_filter, community_filter).order_by(sidx)\n\n if all_plans.count() > 0:\n total_pages = math.ceil(all_plans.count() / float(rows))\n else:\n total_pages = 1\n\n plans = all_plans[start:end]\n # Create the objects that will be serialized for presentation in the plan chooser\n plans_list = list()\n for plan in plans:\n plans_list.append({\n 'pk': plan.id, \n 'fields': { \n 'name': plan.name, \n 'description': plan.description, \n 'edited': time.mktime(plan.edited.timetuple()), \n 'is_template': plan.is_template, \n 'is_shared': plan.is_shared, \n 'owner': plan.owner.username, \n 'districtCount': '--', # load dynamically -- this is a big performance hit\n 'can_edit': can_edit(request.user, plan),\n 'plan_type': plan.legislative_body.get_long_description(),\n 'processing_state': plan.get_processing_state_display()\n }\n })\n\n json_response = \"{ \\\"total\\\":\\\"%d\\\", \\\"page\\\":\\\"%d\\\", \\\"records\\\":\\\"%d\\\", \\\"rows\\\":%s }\" % (total_pages, page, len(all_plans), json.dumps(plans_list))\n return HttpResponse(json_response,mimetype='application/json') ", "metadata": "root.getplans", "header": "['module', '___EOS___']", "index": 2039 }, { "content": "def get_shared_districts(request, planid):\n \"\"\"\n Get the shared districts in a given plan and return the\n data in a format readable by the jqgrid\n \"\"\"\n note_session_activity(request)\n\n if not using_unique_session(request.user):\n return HttpResponseForbidden()\n\n if request.method == 'POST':\n page = int(request.POST.get('page', 1))\n rows = int(request.POST.get('rows', 10))\n else:\n return HttpResponseForbidden()\n\n end = page * rows\n start = end - rows\n \n try:\n plan = Plan.objects.get(pk=planid)\n if not can_copy(request.user, plan):\n return HttpResponseForbidden()\n\n all_districts = plan.get_districts_at_version(plan.version, include_geom=False)\n except:\n plan = None\n all_districts = () \n\n if len(all_districts) > 0:\n total_pages = math.ceil(len(all_districts) / float(rows))\n else:\n total_pages = 1\n\n districts = all_districts[start:end]\n # Create the objects that will be serialized for presentation in the plan chooser\n districts_list = list()\n for district in districts:\n if not district.is_unassigned:\n districts_list.append({\n 'pk': district.id, \n 'fields': { \n 'short_label': district.short_label,\n 'long_label': district.long_label,\n 'district_id': district.district_id,\n }\n })\n\n json_response = \"{ \\\"total\\\":\\\"%d\\\", \\\"page\\\":\\\"%d\\\", \\\"records\\\":\\\"%d\\\", \\\"rows\\\":%s }\" % (total_pages, page, len(all_districts), json.dumps(districts_list))\n return HttpResponse(json_response,mimetype='application/json') ", "metadata": "root.get_shared_districts", "header": "['module', '___EOS___']", "index": 2133 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef editplanattributes(request, planid):\n \"\"\"\n Edit the attributes of a plan. Attributes of a plan are the name and/or\n description.\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n if request.method != 'POST':\n return HttpResponseNotAllowed(['POST'])\n new_name = request.POST.get('name', None)\n new_description = request.POST.get('description', '')\n\n if not planid or not (new_name or new_description):\n return HttpResponseBadRequest(\n _('Must declare planId, name and description'))\n\n plan = Plan.objects.filter(pk=planid,owner=request.user)\n if plan.count() == 1:\n plan = plan[0]\n if not new_name is None:\n plan.name = new_name\n\n plan.description = new_description\n try:\n plan.save()\n\n status['success'] = True\n status['message'] = _('Updated plan attributes')\n except Exception, ex:\n status['message'] = _('Failed to save the changes to your plan')\n status['exception'] = ex\n logger.warn('Could not save changes to plan.')\n logger.debug('Reason: %s', ex)\n else:\n status['message'] = _(\"Cannot edit a plan you don't own.\")\n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.editplanattributes", "header": "['module', '___EOS___']", "index": 2184 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef deleteplan(request, planid):\n \"\"\"\n Delete a plan\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n if request.method != 'POST':\n return HttpResponseNotAllowed(['POST'])\n\n if not planid:\n return HttpResponseBadRequest(_('Must declare planId'))\n\n plan = Plan.objects.filter(pk=planid,owner=request.user)\n if plan.count() == 1:\n plan = plan[0]\n try:\n plan.delete()\n status['success'] = True\n status['message'] = _('Deleted plan')\n except Exception, ex:\n status['message'] = _('Failed to delete plan')\n status['exception'] = ex\n logger.warn('Could not delete plan.')\n logger.debug('Reason: %s', ex)\n else:\n status['message'] = _(\"Cannot delete a plan you don't own.\")\n \n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.deleteplan", "header": "['module', '___EOS___']", "index": 2224 }, { "content": "@login_required\n@unique_session_or_json_redirect\ndef reaggregateplan(request, planid):\n \"\"\"\n Reaggregate a plan\n \"\"\"\n note_session_activity(request)\n\n status = { 'success': False }\n if request.method != 'POST':\n return HttpResponseNotAllowed(['POST'])\n\n if not planid:\n return HttpResponseBadRequest(_('Must declare planId'))\n\n plan = Plan.objects.filter(pk=planid,owner=request.user)\n if plan.count() == 1:\n plan = plan[0]\n try:\n reaggregate_plan.delay(plan.id)\n\n # Set the reaggregating flag\n # (needed for the state to display on immediate refresh)\n plan.processing_state = ProcessingState.REAGGREGATING\n plan.save()\n \n status['success'] = True\n status['message'] = _('Reaggregating plan')\n except Exception, ex:\n status['message'] = _('Failed to reaggregate plan')\n status['exception'] = ex\n logger.warn('Could not reaggregate plan.')\n logger.debug('Reason: %s', ex)\n else:\n status['message'] = _(\"Cannot reaggregate a plan you don't own.\")\n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.reaggregateplan", "header": "['module', '___EOS___']", "index": 2256 }, { "content": "def get_health(request):\n def num_users(minutes):\n users = 0\n for session in Session.objects.all():\n try:\n decoded = session.get_decoded()\n except:\n #There's a problem with this session, remove it\n session.delete()\n continue\n \n if 'activity_time' in decoded:\n activity_delta = decoded['activity_time'] - timedelta(0,0,0,0,settings.SESSION_TIMEOUT)\n if activity_delta > (datetime.now() - timedelta(0,0,0,0,minutes)):\n users += 1\n return users\n\n try:\n result = _('Health retrieved at %(time)s\\n') % {'time': datetime.now()}\n result += _('%(plan_count)d plans in database\\n') % \\\n {'plan_count': Plan.objects.all().count()}\n result += _('%(session_count)d sessions in use out of %(session_limit)s\\n') % \\\n {'session_count': Session.objects.all().count(),\n 'session_limit': settings.CONCURRENT_SESSIONS}\n result += _('%(num_users)d active users over the last 10 minutes\\n') % \\\n {'num_users': num_users(10)}\n space = os.statvfs('/projects/PublicMapping')\n result += _('%(mb_free)s MB of disk space free\\n') % \\\n {'mb_free': ((space.f_bsize * space.f_bavail) / (1024*1024))}\n result += _('Memory Usage:\\n%(mem_free)s\\n') % \\\n {'mem_free': commands.getoutput('free -m')}\n return HttpResponse(result, mimetype='text/plain')\n except:\n return HttpResponse(_(\"ERROR! Couldn't get health:\\n%s\") % traceback.format_exc())", "metadata": "root.get_health", "header": "['module', '___EOS___']", "index": 2293 }, { "content": "def statistics_sets(request, planid):\n result = { 'success': False }\n\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 0:\n result['message'] = _('No plan with that ID exists.')\n return HttpResponse(json.dumps(result),mimetype='application/json')\n else:\n plan = plan[0]\n\n if request.method == 'GET':\n sets = []\n scorefunctions = []\n \n # Get the functions available for the users\n user_functions = ScoreFunction.objects.filter(selectable_bodies=plan.legislative_body).order_by('name')\n for f in user_functions:\n if 'report' not in f.name.lower() and 'comments' not in f.name.lower():\n scorefunctions.append({ 'id': f.id, 'name': force_escape(f.get_label()) })\n result['functions'] = scorefunctions\n\n \n admin_display_names = [\n \"%s_sidebar_demo\" % plan.legislative_body.name,\n ]\n\n if plan.legislative_body.is_community:\n admin_display_names.append(\"%s_sidebar_comments\" %\n plan.legislative_body.name)\n else:\n admin_display_names.append(\"%s_sidebar_basic\" %\n plan.legislative_body.name)\n # Get the admin displays\n admin_displays = ScoreDisplay.objects.filter(\n owner__is_superuser=True,\n legislative_body=plan.legislative_body,\n name__in=admin_display_names\n )\n\n for admin_display in admin_displays:\n sets.append({ \n 'id': admin_display.id,\n 'name': force_escape(admin_display.get_label()),\n 'functions': [],\n 'mine':False\n })\n\n try:\n user_displays = ScoreDisplay.objects.filter(\n owner=request.user, \n legislative_body=plan.legislative_body,\n is_page=False).order_by('title')\n result['displays_count'] = len(user_displays)\n for display in user_displays:\n functions = []\n for panel in display.scorepanel_set.all():\n if panel.type == 'district':\n functions = map(lambda x: x.id, panel.score_functions.all())\n if len(functions) == 0:\n result['message'] = _(\"No functions for %(panel)s\") % \\\n {'panel_name': panel}\n sets.append({ 'id': display.id, 'name': force_escape(display.__unicode__()), 'functions': functions, 'mine': display.owner==request.user })\n except Exception, ex:\n result['message'] = _('No user displays for %(user)s') % \\\n {'user': request.user}\n logger.warn('Error fetching ScoreDisplays for user')\n logger.debug('Reason: %s', ex)\n\n result['sets'] = sets\n result['success'] = True\n # Delete the requested ScoreDisplay to make some room\n elif request.method == 'POST' and 'delete' in request.POST:\n try:\n display = ScoreDisplay.objects.get(pk=request.REQUEST.get('id', -1))\n result['set'] = {'name':force_escape(display.__unicode__()), 'id':display.id}\n qset = display.scorepanel_set.all()\n for panel in qset:\n if panel.displays.count() == 1:\n panel.delete()\n display.delete()\n result['success'] = True\n except Exception, ex:\n result['message'] = _(\"Couldn't delete personalized scoredisplay\")\n result['exception'] = traceback.format_exc()\n logger.warn(\"Couldn't delete personalized ScoreDisplay\")\n logger.debug('Reason: %s', ex)\n \n # If it's a post, edit or create the ScoreDisplay and return \n # the id and name as usual\n elif request.method == 'POST':\n # If we're adding a new display, we should make sure they only have 3\n def validate_num(user, limit=3):\n return ScoreDisplay.objects.filter(owner=user, legislative_body=plan.legislative_body, is_page=False).count() < limit\n\n if 'functions[]' in request.POST:\n functions = request.POST.getlist('functions[]')\n functions = map(lambda x: int(x), functions)\n try:\n display = ScoreDisplay.objects.get(title=request.POST.get('name'), owner=request.user)\n display = display.copy_from(display=display, functions=functions)\n except:\n limit = 3\n if validate_num(request.user, limit):\n demo = ScoreDisplay.objects.filter(\n owner__is_superuser=True,\n legislative_body=plan.legislative_body,\n is_page=False,\n\t\t\ttitle=\"Demographics\"\n )\n # DO NOT select the ScoreDisplay that contains\n # the comment calculator\n for disp in demo:\n has_comments = False\n for pnl in disp.scorepanel_set.all():\n for fn in pnl.score_functions.all():\n has_comments = has_comments or fn.calculator.endswith('.Comments')\n if not has_comments:\n demo = disp\n break\n\n display = ScoreDisplay()\n display = display.copy_from(display=demo, title=request.POST.get('name'), owner=request.user, functions=functions)\n result['newRecord'] = True\n else:\n result['message'] = _('Each user is limited to %(limit)d '\n 'statistics sets. Please delete one or edit '\n 'an existing set.') % { 'limit': limit }\n result['error'] = 'limit'\n return HttpResponse(json.dumps(result),mimetype='application/json')\n\n result['set'] = {'name':force_escape(display.__unicode__()), 'id':display.id, 'functions':functions, 'mine': display.owner==request.user}\n result['success'] = True\n\n else:\n result['message'] = _(\"Didn't get functions in POST parameter\")\n\n return HttpResponse(json.dumps(result),mimetype='application/json')", "metadata": "root.statistics_sets", "header": "['module', '___EOS___']", "index": 2329 }, { "content": "def purge_plan_clear_cache(district, version):\n \"\"\"\n This is a helper method that purges a plan after a version, and clears\n any pre-computed scores at the specified version.\n \"\"\"\n district.plan.purge(after=version)\n\n district.plan.version = version\n district.plan.save()\n\n cache = district.computeddistrictscore_set.filter(function__calculator__endswith='.Comments')\n cache.delete()", "metadata": "root.purge_plan_clear_cache", "header": "['module', '___EOS___']", "index": 2470 }, { "content": "@unique_session_or_json_redirect\ndef district_info(request, planid, district_id):\n \"\"\"\n Get the comments that are attached to a district.\n\n Parameters:\n request -- An HttpRequest\n planid -- The plan ID\n district_id -- The district ID, this is the district number in a plan, and NOT the id of a district.\n \"\"\"\n status = { 'success': False }\n plan = Plan.objects.filter(id=planid)\n if plan.count() == 0:\n status['message'] = _('No plan with that ID was found.')\n else:\n plan = plan[0]\n\n version = plan.version\n if 'version' in request.REQUEST:\n try:\n version = int(request.REQUEST['version'])\n version = min(plan.version, int(version))\n except:\n pass\n\n district_id = int(district_id)\n district = plan.get_districts_at_version(version, include_geom=False)\n district = filter(lambda d:d.district_id==district_id, district)\n\n if request.method == 'POST':\n district = plan.district_set.get(id=request.POST['object_pk'])\n district.short_label = request.POST['district_short'][0:10]\n district.long_label = request.POST['district_long'][0:256]\n\n\n if district.version < version:\n # The district version may lag behind the cursor \n # version if there were no edits for a while. If this \n # is the case the district must be copied to the \n # currently edited version.\n district_copy = copy.copy(district)\n district_copy.id = None\n district_copy.version = version\n\n district_copy.save()\n\n # clone the characteristics, comments, and tags from \n # the original district to the copy \n district_copy.clone_relations_from(district)\n district = district_copy\n else:\n # save the changes to the district -- maybe name change\n district.save()\n\n has_comment = 'comment' in request.POST and request.POST['comment'] != '' \n if has_comment:\n # Don't thread comments, keep only the latest and greatest\n ct = ContentType.objects.get(app_label='redistricting',model='district')\n Comment.objects.filter(object_pk = district.id, content_type=ct).delete()\n comment = Comment(\n object_pk=district.id, \n content_type=ct, \n site_id=Site.objects.get_current().id, \n user_name=request.user.username, \n user_email=request.user.email, \n comment=request.POST['comment'])\n comment.save()\n else:\n # save this if the label changed\n district.save()\n\n # Get the tags on this object of this type.\n tset = Tag.objects.get_for_object(district).filter(name__startswith='type')\n\n # Purge the tags of this same type off the object\n TaggedItem.objects.filter(tag__in=tset, object_id=district.id).delete()\n\n purge_plan_clear_cache(district, version)\n\n if len(request.REQUEST.getlist('type[]')) > 0:\n strtags = request.REQUEST.getlist('type[]')\n for strtag in strtags:\n if strtag == '':\n continue\n if strtag.count(' ') > 0:\n strtag = '\"type=%s\"' % strtag\n else:\n strtag = 'type=%s' % strtag\n Tag.objects.add_tag(district, strtag)\n\n status['version'] = version\n status['success'] = True\n\n return HttpResponse(json.dumps(status), mimetype='application/json')", "metadata": "root.district_info", "header": "['module', '___EOS___']", "index": 2483 }, { "content": "def plan_feed(request):\n feed = loader.get_template('plan_feed.xml')\n # MAP_SERVER = ''\n # MAP_SERVER_NS = 'pmp'\n plans = Plan.objects.all().order_by('-edited')[0:10]\n geolevel = plans[0].legislative_body.get_geolevels()[0]\n extent = geolevel.geounit_set.collect().extent\n if extent[2] - extent[0] > extent[3] - extent[1]:\n # wider maps\n width = 500\n height = int(500 * (extent[3]-extent[1]) / (extent[2]-extent[0]))\n else:\n # taller maps\n width = int(500 * (extent[2]-extent[0]) / (extent[3]-extent[1]))\n height = 500\n mapserver = settings.MAP_SERVER if settings.MAP_SERVER != '' else request.META['SERVER_NAME']\n context = {\n 'plans': plans,\n 'mapserver': mapserver,\n 'mapserver_ns': settings.MAP_SERVER_NS,\n 'extent': extent,\n 'width': width,\n 'height': height\n }\n xml = feed.render(DjangoContext(context))\n\n return HttpResponse(xml, mimetype='application/atom+xml')", "metadata": "root.plan_feed", "header": "['module', '___EOS___']", "index": 2578 }, { "content": "def share_feed(request):\n feed = loader.get_template('shared_feed.xml')\n # MAP_SERVER = ''\n # MAP_SERVER_NS = 'pmp'\n plans = Plan.objects.filter(is_shared=True).order_by('-edited')[0:10]\n if plans.count() < 0:\n geolevel = plans[0].legislative_body.get_geolevels()[0]\n extent = geolevel.geounit_set.collect().extent\n if extent[2] - extent[0] > extent[3] - extent[1]:\n # wider maps\n width = 500\n height = int(500 * (extent[3]-extent[1]) / (extent[2]-extent[0]))\n else:\n # taller maps\n width = int(500 * (extent[2]-extent[0]) / (extent[3]-extent[1]))\n height = 500\n else:\n extent = (0,0,0,0,)\n width = 1\n height = 1\n mapserver = settings.MAP_SERVER if settings.MAP_SERVER != '' else request.META['SERVER_NAME']\n context = {\n 'plans': plans,\n 'mapserver': mapserver,\n 'mapserver_ns': settings.MAP_SERVER_NS,\n 'extent': extent,\n 'width': width,\n 'height': height\n }\n xml = feed.render(DjangoContext(context))\n\n return HttpResponse(xml, mimetype='application/atom+xml')", "metadata": "root.share_feed", "header": "['module', '___EOS___']", "index": 2606 } ]
[ { "span": "from django.db import IntegrityError, connection, transaction", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 61 }, { "span": "from django.core.context_processors import csrf", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 47 }, { "span": "from django.contrib.comments.forms import CommentForm", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 53 }, { "span": "from django.contrib.gis.geos.collections import MultiPolygon", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 60 }, { "span": "from django.contrib.gis.gdal.libgdal import lgdal", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 49 }, { "span": "from django.contrib import humanize", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 35 }, { "span": "from django.template.defaultfilters import slugify, force_escape", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 64 }, { "span": "from tagging.utils import parse_tag_input", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 41 }, { "span": "import random, string, math, types, copy, time, threading, traceback, os", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 72 }, { "span": "import commands, sys, tempfile, csv, hashlib, inflect, logging", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 62 }, { "span": "from PIL import Image, ImageChops, ImageMath", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 44 }, { "span": "import urllib, urllib2", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Dj", "ang", "o", " ", "views", " ", "used", " ", "by", " ", "the", " ", "redis", "tric", "ting", " ", "applica", "tion", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "method", "s", " ", "in", " ", "redis", "tric", "ting", ".", "views", " ", "defin", "e", " ", "the", " ", "views", " ", "used", " ", "to", " ", "interact", " ", "with", "\\", "10", ";", "the", " ", "model", "s", " ", "in", " ", "the", " ", "redis", "tric", "ting", " ", "applica", "tion", ".", " ", "Ea", "ch", " ", "method", " ", "relate", "s", " ", "to", " ", "one", " ", "\\", "10", ";", "type", " ", "of", " ", "output", " ", "url", ".", " ", "There", " ", "are", " ", "views", " ", "tha", "t", " ", "return", " ", "Geo", "JSO", "N", ",", " ", "JSO", "N", ",", " ", "and", " ", "HTM", "L", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "The", " ", "Public", " ", "Map", "ping", " ", "Project", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "Public", "Map", "ping", "/", "\\", "10", ";", "\\", "10", ";", "License", ":", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "2010", "-", "2012", " ", "Mi", "ca", "h", " ", "Alt", "man", ",", " ", "Mich", "ael", " ", "Mc", "Dona", "ld", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", " ", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", ".", "\\", "10", ";", "\\", "10", ";", "Author", ":", " ", "\\", "10", ";", " ", " ", " ", " ", "Andre", "w", " ", "Jen", "ning", "s", ",", " ", "Dav", "id", " ", "Zw", "arg", ",", " ", "Ken", "ny", " ", "She", "par", "d", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", ",_", "Sus", "picio", "us", "Operation_", ",_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "Int", "egr", "it", "y", "Error_", ",_", "connection_", ",_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "context", "\\u", "processors_", "import_", "csrf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "comments_", "._", "models_", "import_", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "comments_", "._", "forms_", "import_", "Comme", "nt", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", ",_", "user", "\\u", "pass", "es", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sessions_", "._", "models_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sessions_", "._", "backends_", "._", "db_", "import_", "Sess", "ion", "Store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "geos", "_", "._", "collections_", "import_", "Multi", "Polygon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "geos", "_", "import_", "GEO", "SG", "eom", "etry", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "gdal_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "gdal_", "._", "libg", "dal", "_", "import_", "lg", "dal", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "humanize", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", ",_", "Context_", "as_", "Dj", "ang", "o", "Context_", ",_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", ",_", "translation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", ",_", "unge", "ttext", "_", "as_", "\\u", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "default", "filters_", "import_", "slugify_", ",_", "force", "\\u", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagging", "_", "._", "utils_", "import_", "parse", "\\u", "tag", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagging", "_", "._", "models_", "import_", "Tag_", ",_", "Tagg", "ed", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "time_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "redis", "tric", "ting_", "._", "calculator", "s_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "redis", "tric", "ting_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "redis", "tric", "ting_", "._", "tasks_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", ",_", "string_", ",_", "math_", ",_", "types_", ",_", "copy_", ",_", "time_", ",_", "threading_", ",_", "traceback_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "commands_", ",_", "sys_", ",_", "tempfile_", ",_", "csv_", ",_", "hashlib_", ",_", "infl", "ect_", ",_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Mode", "st", "Maps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", ",_", "Image", "Cho", "ps_", ",_", "Image", "Math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xh", "tml", "2p", "df_", "._", "pis", "a_", "import_", "Creat", "e", "PDF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\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_", "#", " ", "Thi", "s", " ", "constant", " ", "is", " ", "reus", "ed", " ", "in", " ", "multiple", " ", "place", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "UNA", "SSI", "GN", "ED", "\\u", "DISTRI", "CT", "\\u", "ID_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\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\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Comme", "nt", " ", "views_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "test", " ", "to", " ", "dete", "rmin", "e", " ", "if", " ", "the", " ", "user", " ", "of", " ", "the", " ", "applica", "tion", " ", "is", " ", "usi", "ng", " ", "a", " ", "unique", " ", "\\", "10", ";", " ", " ", " ", " ", "session", ".", " ", "Ea", "ch", " ", "user", " ", "is", " ", "permit", "ted", " ", "one", " ", "unique", " ", "session", " ", "(", "one", " ", "session", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "django", "\\u", "session", " ", "table", " ", "tha", "t", " ", "has", " ", "not", " ", "ye", "t", " ", "expir", "ed", ").", " ", "If", " ", "the", " ", "user", " ", "exceed", "s", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "quot", "a", ",", " ", "this", " ", "test", " ", "fail", "s", ",", " ", "and", " ", "the", " ", "user", " ", "will", " ", "get", " ", "bounce", "d", " ", "to", " ", "the", " ", "login", "\\", "10", ";", " ", " ", " ", " ", "url", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "u", " ", "-", " ", "The", " ", "user", ".", " ", "Ma", "y", " ", "be", " ", "anonym", "ous", " ", "or", " ", "register", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "-", " ", "the", " ", "user", " ", "is", " ", "an", " ", "Ano", "nym", "ous", "User", " ", "or", " ", "the", " ", "number", " ", "of", " ", "session", "s", " ", "open", "\\", "10", ";", " ", " ", " ", "by", " ", "the", " ", "user", " ", "is", " ", "only", " ", "1", " ", "(", "one", " ", "must", " ", "be", " ", "open", " ", "to", " ", "make", " ", "the", " ", "request", ")", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", " ", "-", " ", "the", " ", "user", " ", "is", " ", "register", "ed", " ", "and", " ", "has", " ", "more", " ", "than", " ", "one", " ", "open", " ", "session", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "u_", "._", "is", "\\u", "anonymous_", "(_", ")_", "or_", "u_", "._", "is", "\\u", "superuser_", ":_", "\\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_", "sessions_", "=_", "Session_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "session_", "in_", "sessions_", ":_", "\\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 ", " _", "decoded_", "=_", "session_", "._", "get", "\\u", "decoded_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "auth", "\\u", "user", "\\u", "id", "'_", "in_", "decoded_", "and_", "decoded_", "[_", "'\\u", "auth", "\\u", "user", "\\u", "id", "'_", "]_", "==_", "u_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "activit", "y", "\\u", "time", "'_", "in_", "decoded_", "and_", "decoded_", "[_", "'", "activit", "y", "\\u", "time", "'_", "]_", "<_", "datetime_", "._", "now_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "this", " ", "session", " ", "of", " ", "mine", ";", " ", "it", " ", "is", " ", "dor", "mant", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Session_", "._", "objects_", "._", "filter_", "(_", "session", "\\u", "key_", "=_", "session_", "._", "session", "\\u", "key_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sus", "picio", "us", "Operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Sus", "picio", "us", "Opera", "tion", " ", "cau", "ght", " ", "whi", "le", " ", "checking", " ", "the", " ", "number", " ", "of", " ", "session", "s", " ", "a", " ", "user", " ", "has", " ", "open", ".", " ", "Sess", "ion", " ", "key", ":", " ", "%", "s", "\"_", ",_", "session_", "._", "session", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "counti", "ng", " ", "all", " ", "the", " ", "open", " ", "and", " ", "active", " ", "session", "s", ",", " ", "go", " ", "back", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "session", " ", "list", " ", "and", " ", "assign", " ", "the", " ", "session", " ", "count", " ", "to", " ", "all", " ", "web", " ", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "this", " ", "user", ".", " ", "(", "do", " ", "this", " ", "for", " ", "inact", "ive", " ", "session", "s", ",", " ", "too", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "session_", "in_", "sessions_", ":_", "\\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 ", " _", "decoded_", "=_", "session_", "._", "get", "\\u", "decoded_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\u", "auth", "\\u", "user", "\\u", "id", "'_", "in_", "decoded_", "and_", "decoded_", "[_", "'\\u", "auth", "\\u", "user", "\\u", "id", "'_", "]_", "==_", "u_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webse", "ssion_", "=_", "Sess", "ion", "Store_", "(_", "session", "\\u", "key_", "=_", "session_", "._", "session", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webse", "ssion_", "[_", "'", "count", "'_", "]_", "=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "webse", "ssion_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sus", "picio", "us", "Operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Sus", "picio", "us", "Opera", "tion", " ", "cau", "ght", " ", "whi", "le", " ", "setti", "ng", " ", "the", " ", "session", " ", "count", " ", "on", " ", "all", " ", "user", " ", "session", "s", ".", " ", "Sess", "ion", " ", "key", ":", " ", "%", "s", "\"_", ",_", "session_", "._", "session", "\\u", "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_", "return_", "(_", "count_", "<=_", "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_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "decorat", "or", " ", "method", ".", " ", " ", "Any", " ", "method", " ", "tha", "t", " ", "accepts", " ", "this", " ", "decorat", "or", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "have", " ", "an", " ", "Http", "Request", " ", "as", " ", "a", " ", "parameter", " ", "call", "ed", " ", "\"", "request", "\".\\", "10", ";", " ", " ", " ", " ", "Tha", "t", " ", "request", " ", "will", " ", "be", " ", "checke", "d", " ", "for", " ", "a", " ", "unique", " ", "session", ".", " ", " ", "If", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "test", " ", "pass", "es", ",", " ", "the", " ", "original", " ", "method", " ", "is", " ", "return", "ed", ".", " ", " ", "If", " ", "the", " ", "session", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "not", " ", "unique", ",", " ", "then", " ", "a", " ", "JSO", "N", " ", "response", " ", "is", " ", "return", "ed", " ", "and", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "client", " ", "is", " ", "redirected", " ", "to", " ", "log", " ", "off", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorator_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "return", "\\u", "non", "unique", "\\u", "session", "\\u", "result_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "current", " ", "user", " ", "may", " ", "only", " ", "have", " ", "one", " ", "session", " ", "open", " ", "at", " ", "a", " ", "time", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "redirec", "t", "'_", "]_", "=_", "'/", "?", "msg", "=", "logo", "ff", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "return", "\\u", "non", "unique", "\\u", "session", "\\u", "result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "function_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wraps_", "(_", "function_", ")_", "(_", "decorator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "session", "\\u", "available_", "(_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "if", " ", "a", " ", "session", " ", "is", " ", "avail", "able", ".", " ", "Thi", "s", " ", "is", " ", "similar", " ", "to", " ", "a", " ", "user", " ", "test", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "require", "s", " ", "access", " ", "to", " ", "the", " ", "user", "'", "s", " ", "session", ",", " ", "so", " ", "it", " ", "cann", "ot", " ", "be", " ", "used", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", "\\u", "pass", "es", "\\u", "test", " ", "decorat", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "req", " ", "-", " ", "The", " ", "Http", "Request", " ", "object", ",", " ", "with", " ", "user", " ", "and", " ", "session", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "req_", "._", "user_", "._", "is", "\\u", "superuser_", "or_", "req_", "._", "user_", "._", "is", "\\u", "staff_", ":_", "\\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_", "sessions_", "=_", "Session_", "._", "objects_", "._", "filter_", "(_", "expir", "e\\u", "date", "\\u\\u", "gt_", "=_", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "session_", "in_", "sessions_", ":_", "\\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 ", " _", "decoded_", "=_", "session_", "._", "get", "\\u", "decoded_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "req_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ")_", "and_", "'", "activit", "y", "\\u", "time", "'_", "in_", "decoded_", "and_", "decoded_", "[_", "'", "activit", "y", "\\u", "time", "'_", "]_", ">_", "datetime_", "._", "now_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sus", "picio", "us", "Operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Sus", "picio", "us", "Opera", "tion", " ", "cau", "ght", " ", "whi", "le", " ", "checking", " ", "the", " ", "last", " ", "activit", "y", " ", "time", " ", "in", " ", "a", " ", "user", "'", "s", " ", "session", ".", " ", "Sess", "ion", " ", "key", ":", " ", "%", "s", "\"_", ",_", "session_", "._", "session", "\\u", "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_", "avail_", "=_", "count_", "<_", "settings_", "._", "CONC", "URRE", "NT", "\\u", "SES", "SION", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "session_", "[_", "'", "avail", "'_", "]_", "=_", "avail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "avail_", "\\u\\u\\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_", "note", "\\u", "session", "\\u", "activity_", "(_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "session", " ", "'", "timeo", "ut", "'", " ", "whe", "neve", "r", " ", "a", " ", "user", " ", "perform", "s", " ", "an", " ", "action", ".", " ", "Thi", "s", " ", "is", " ", "\\", "10", ";", " ", " ", " ", " ", "require", "d", " ", "to", " ", "keep", " ", "dor", "mant", " ", "(", "not", " ", "ye", "t", " ", "expir", "ed", ",", " ", "but", " ", "inact", "ive", ")", " ", "session", "s", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "maxi", "ng", " ", "out", " ", "the", " ", "concurrent", " ", "session", " ", "limit", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "req", " ", "-", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "a", " ", "session", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "timeo", "ut", " ", "in", " ", "this", " ", "timedelta", " ", "speci", "fie", "s", " ", "the", " ", "number", " ", "of", " ", "minute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "window_", "=_", "timedelta_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "settings_", "._", "SES", "SION", "\\u", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "session_", "[_", "'", "activit", "y", "\\u", "time", "'_", "]_", "=_", "datetime_", "._", "now_", "(_", ")_", "+_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unload", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Unlo", "ad", " ", "a", " ", "plan", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "view", " ", "is", " ", "call", "ed", " ", "anyt", "ime", " ", "a", " ", "plan", " ", "is", " ", "unload", "ed", ".", " ", "Exam", "ple", ":", " ", "navi", "gati", "ng", "\\", "10", ";", " ", " ", " ", " ", "awa", "y", " ", "from", " ", "the", " ", "page", ",", " ", "or", " ", "selecti", "ng", " ", "a", " ", "new", " ", "plan", ".", " ", "Thi", "s", " ", "method", " ", "allow", "s", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "any", " ", "require", "d", " ", "plan", " ", "clean", "up", " ", "suc", "h", " ", "as", " ", "pur", "ging", " ", "temporar", "y", " ", "version", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "The", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "unload", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "whi", "ch", " ", "include", "s", " ", "a", " ", "status", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ps_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ps_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "ps_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "%", "(", "user", ")", "s", " ", "doe", "sn", "'", "t", " ", "have", " ", "permissi", "on", " ", "to", " ", "unload", " ", "this", " ", "plan", "\"_", ")_", "%_", "{_", "'", "user", "'_", ":_", "request_", "._", "user_", "._", "username_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Purg", "e", " ", "temporar", "y", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "pur", "ge", "\\u", "be", "yon", "d\\u", "nth", "\\u", "step_", "(_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "copy", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Copy", " ", "a", " ", "plan", " ", "to", " ", "a", " ", "new", ",", " ", "edita", "ble", " ", "plan", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "view", " ", "is", " ", "call", "ed", " ", "by", " ", "the", " ", "plan", " ", "choose", "r", " ", "and", " ", "the", " ", "share", " ", "plan", " ", "tab", ".", " ", "The", "se", "\\", "10", ";", " ", " ", " ", " ", "action", "s", " ", "take", " ", "a", " ", "template", " ", "or", " ", "shared", " ", "plan", ",", " ", "and", " ", "copy", " ", "the", " ", "plan", " ", "with", "out", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "histo", "ry", " ", "int", "o", " ", "an", " ", "edita", "ble", " ", "plan", " ", "in", " ", "the", " ", "current", " ", "user", "'", "s", " ", "account", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "The", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "original", " ", "plan", " ", "to", " ", "copy", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "whi", "ch", " ", "include", "s", " ", "eit", "her", " ", "an", " ", "error", " ", "message", " ", "or", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "copie", "d", " ", "plan", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "plan", "\\u", "ready_", "(_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "plan", " ", "is", " ", "copy", "able", " ", "by", " ", "the", " ", "current", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "%", "(", "user", "name", ")", "s", " ", "doe", "sn", "'", "t", " ", "have", " ", "permissi", "on", " ", "to", " ", "\"_", "\"", "copy", " ", "this", " ", "model", "\"_", "%_", "{_", "'", "user", "name", "'_", ":_", "request_", "._", "user_", "._", "username_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "random", " ", "name", " ", "if", " ", "there", " ", "is", " ", "no", " ", "name", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newname_", "=_", "p_", "._", "name_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "random_", "._", "random_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newname_", "=_", "request_", "._", "POST_", "[_", "\"", "name", "\"_", "]_", "[_", "0_", ":_", "200_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shared_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "shared", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan", "\\u", "copy_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "name_", "=_", "newname_", ",_", "owner_", "=_", "request_", "._", "user_", ",_", "legislat", "ive", "\\u", "body_", "=_", "p_", "._", "legislat", "ive", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "plan", "'", "s", " ", "name", " ", "doe", "sn", "'", "t", " ", "alr", "ead", "y", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "plan", "\\u", "copy_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "You", " ", "alr", "ead", "y", " ", "have", " ", "a", " ", "plan", " ", "named", " ", "tha", "t", ".", " ", "\"_", "\"", "Ple", "ase", " ", "pick", " ", "a", " ", "unique", " ", "name", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan", "\\u", "copy_", "=_", "Plan_", "(_", "name_", "=_", "newname_", ",_", "owner_", "=_", "request_", "._", "user_", ",_", "is", "\\u", "shared_", "=_", "shared_", ",_", "legislat", "ive", "\\u", "body_", "=_", "p_", "._", "legislat", "ive", "\\u", "body_", ",_", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "READY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan", "\\u", "copy_", "._", "create", "\\u", "unassign", "ed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan", "\\u", "copy_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "the", " ", "district", "s", " ", "in", " ", "the", " ", "original", " ", "plan", " ", "at", " ", "the", " ", "most", " ", "recent", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "original", " ", "plan", "._", "\\u\\u\\uNL\\u\\u\\u_", "district", "s_", "=_", "p_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "p_", "._", "version_", ",_", "include", "\\u", "geom_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "copy_", "=_", "copy_", "._", "copy_", "(_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "district", "\\u", "copy_", "._", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "\\u", "copy_", "._", "version_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "\\u", "copy_", "._", "is", "\\u", "locked_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "\\u", "copy_", "._", "plan_", "=_", "plan", "\\u", "copy_", "\\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 ", " _", "district", "\\u", "copy_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "inst_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "\"", "message", "\"_", "]_", "=_", "\\u_", "(_", "\"", "Cou", "ld", " ", "not", " ", "save", " ", "district", " ", "copie", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "\"", "exception", "\"_", "]_", "=_", "inst_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clone", " ", "the", " ", "characteristics", ",", " ", "comment", "s", ",", " ", "and", " ", "tags", " ", "from", " ", "the", " ", "original", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "district", " ", "to", " ", "the", " ", "copy", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "\\u", "copy_", "._", "clone", "\\u", "relation", "s", "\\u", "from_", "(_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Seriali", "ze", " ", "the", " ", "plan", " ", "object", " ", "to", " ", "the", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "serializers_", "._", "serialize_", "(_", "\"", "json", "\"_", ",_", "[_", "plan", "\\u", "copy_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "data_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "score", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "a", " ", "plan", " ", "to", " ", "allow", " ", "for", " ", "it", " ", "to", " ", "be", " ", "shown", " ", "in", " ", "the", " ", "leader", "board", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "The", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "score", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "whi", "ch", " ", "include", "s", " ", "a", " ", "status", ",", " ", "and", " ", "if", " ", "applica", "ble", ",", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "reason", " ", "wh", "y", " ", "the", " ", "plan", " ", "coul", "dn", "'", "t", " ", "be", " ", "validat", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "criterion_", "=_", "Validat", "ion", "Criteria", "_", "._", "objects_", "._", "filter_", "(_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "criteria_", "in_", "criterion_", ":_", "\\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 ", " _", "score_", "=_", "Computed", "Plan", "Score_", "._", "compute_", "(_", "criteria_", "._", "function_", ",_", "plan_", ")_", "\\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_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "score_", "or_", "not_", "score_", "[_", "'", "value", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "'<", "p", ">", "%", "s", "</", "p", "><", "p", ">", "%", "s", "</", "p", ">'_", "%_", "(_", "criteria_", "._", "get", "\\u", "short", "\\u", "label_", "(_", ")_", ",_", "criteria_", "._", "get", "\\u", "long", "\\u", "description_", "(_", ")_", "or_", "criteria_", "._", "function_", "._", "get", "\\u", "long", "\\u", "description_", "(_", ")_", ")_", "\\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_", "status_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Validat", "ion", " ", "success", "ful", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "is", "\\u", "valid", " ", "status", " ", "on", " ", "the", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "._", "is", "\\u", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "user", "\\u", "info_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "extend", "ed", " ", "user", " ", "informati", "on", " ", "for", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "--", " ", "The", " ", "user", " ", "attache", "d", " ", "to", " ", "the", " ", "Http", "Request", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dict", " ", "with", " ", "user", " ", "informati", "on", ",", " ", "inclu", "ding", " ", "profile", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\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_", "profile_", "=_", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "user_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "user_", "._", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "\\u", "hin", "t", "'_", ":_", "profile_", "._", "pass", "\\u", "hint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "name", "'_", ":_", "user_", "._", "first", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "name", "'_", ":_", "user_", "._", "last", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "organization", "'_", ":_", "profile_", "._", "organization_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "user_", "._", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "common", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "common", " ", "method", " ", "tha", "t", " ", "gets", " ", "the", " ", "same", " ", "data", " ", "structure", "s", " ", "for", " ", "viewin", "g", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "editin", "g", ".", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "by", " ", "the", " ", "view", "plan", " ", "and", " ", "edit", "plan", " ", "\\", "10", ";", " ", " ", " ", " ", "views", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "to", " ", "fetch", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "python", " ", "dict", " ", "with", " ", "common", " ", "plan", " ", "attribute", "s", " ", "set", " ", "to", " ", "the", " ", "plan", "'", "s", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "._", "edited", "_", "=_", "getu", "tc_", "(_", "plan_", "._", "edited", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "levels_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "s_", "=_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "plan_", "._", "version_", ",_", "include", "\\u", "geom_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editable_", "=_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "demo_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "default", "\\u", "subject_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "dists_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "max", "\\u", "district", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "short", "\\u", "label_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "label_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "members_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "member", "s", "\\u", "label_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reporting", "\\u", "template_", "=_", "'", "bar", "d\\u", "%", "s", ".", "html", "'_", "%_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "name_", "if_", "not_", "plan_", "._", "is", "\\u", "community_", "(_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "._", "find_", "(_", "'%", "(", "district", "\\u", "id", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "=_", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "[_", "0_", ":_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "=_", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "._", "find_", "(_", "'%", "(", "district", "\\u", "id", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "=_", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "[_", "0_", ":_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "editable_", "and_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calculator", "\\u", "reports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tags_", "=_", "Tag_", "._", "objects_", "._", "filter_", "(_", "name", "\\u\\u", "startswith_", "=_", "'", "type", "='_", ")_", "._", "order", "\\u", "by_", "(_", "'", "id", "'_", ")_", "._", "values", "\\u", "list_", "(_", "'", "name", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "5_", ":_", "]_", ",_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Report", "s", " ", "defin", "ed", " ", "with", " ", "calculator", "s", " ", "(", "Score", " ", "Display", "s", ",", " ", "Pane", "ls", ",", " ", "and", " ", "Function", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "a", " ", "map", " ", "of", " ", "rele", "van", "t", " ", "panel", "s", " ", "to", " ", "score", " ", "function", "s", " ", "with", " ", "labels", " ", "and", " ", "ids", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "for", " ", "generat", "ing", " ", "group", "s", " ", "of", " ", "checkb", "oxe", "s", " ", "on", " ", "the", " ", "evaluate", " ", "tab", "._", "\\u\\u\\uNL\\u\\u\\u_", "calculator", "\\u", "reports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "REPORT", "S", "\\u", "ENABLED_", "==_", "'", "CAL", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "report", "\\u", "display", "s_", "=_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "name_", "=_", "\"%", "s", "\\u", "report", "s", "\"_", "%_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "report", "\\u", "display", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "calculator", "\\u", "reports_", "=_", "map_", "(_", "lambda_", "p_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "p_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "s", "'_", ":_", "map_", "(_", "lambda_", "f_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "f_", "._", "get", "\\u", "label_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "f_", "._", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "p_", "._", "score", "\\u", "functions_", "._", "all_", "(_", ")_", "._", "filter_", "(_", "selectable", "\\u", "bodies_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "report", "\\u", "display", "s_", "[_", "0_", "]_", "._", "score", "panel", "\\u", "set_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "position", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "sai", "d", " ", "plan", " ", "doe", "sn", "'", "t", " ", "exist", ",", " ", "use", " ", "an", " ", "empty", " ", "plan", " ", "&", " ", "district", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "levels_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "demo_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "dists_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "=_", "\\u_", "(_", "'", "Distr", "ict", "'_", ")_", "+_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "members_", "=_", "\\u", "n_", "(_", "'", "district", "'_", ",_", "'", "district", "s", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reporting", "\\u", "template_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calculator", "\\u", "reports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "demo", "s_", "=_", "Subject_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "sort", "\\u", "key", "'_", ")_", "[_", "0_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snap", "layers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "levels_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stud", "y", "\\u", "area", "\\u", "extent_", "=_", "list_", "(_", "levels_", "[_", "0_", "]_", "._", "geo", "unit", "\\u", "set_", "._", "extent_", "(_", "field", "\\u", "name_", "=_", "'", "simple", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "geo", "level", "s", " ", "with", " ", "higher", " ", "indexe", "s", " ", "are", " ", "large", "r", " ", "geogr", "aph", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cycle", " ", "through", " ", "legislat", "ive", " ", "bodi", "es", ",", " ", "sinc", "e", " ", "the", "y", " ", "may", " ", "be", " ", "in", " ", "different", " ", "regions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lb_", "in_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "big", "level_", "=_", "lb_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "big", "level_", "._", "geo", "unit", "\\u", "set_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stud", "y", "\\u", "area", "\\u", "extent_", "=_", "big", "level_", "._", "geo", "unit", "\\u", "set_", "._", "extent_", "(_", "field", "\\u", "name_", "=_", "'", "simple", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "level_", "in_", "levels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "i18n", "-", "ize", " ", "name", " ", "here", ",", " ", "not", " ", "in", " ", "js_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "snap", "layers_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geo", "level", "'_", ":_", "level_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "level_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "layer", "'_", ":_", "'", "simple", "\\u'_", "+_", "level_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "long", "\\u", "description", "'_", ":_", "level_", "._", "get", "\\u", "long", "\\u", "description_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "zoom", "'_", ":_", "level_", "._", "min", "\\u", "zoom_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default", "\\u", "selected_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "demo_", "in_", "demo", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "isd", "efa", "ult_", "=_", "str_", "(_", "(_", "not_", "default", "\\u", "demo_", "is_", "None_", ")_", "and_", "(_", "demo_", "._", "id_", "==_", "default", "\\u", "demo_", "._", "id_", ")_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isd", "efa", "ult_", "==_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "selected_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "i18n", "-", "ize", " ", "name", " ", "&", " ", "short", "\\u", "display", " ", "here", ",", " ", "not", " ", "in", " ", "js_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "layers_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "demo_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "demo_", "._", "get", "\\u", "short", "\\u", "label_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "demo_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "isd", "efa", "ult", "'_", ":_", "isd", "efa", "ult_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "isdi", "spla", "yed", "'_", ":_", "str_", "(_", "demo_", "._", "is", "\\u", "displayed_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "default", " ", "demo", " ", "was", " ", "not", " ", "selecte", "d", " ", "amo", "ng", " ", "the", " ", "first", " ", "three", ",", " ", "we", "'", "ll", " ", "still", " ", "need", " ", "it", " ", "for", " ", "the", " ", "dropdown", " ", "menus_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "default", "\\u", "demo_", "and_", "not_", "default", "\\u", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layers_", "._", "insert_", "(_", "0_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "default", "\\u", "demo_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "default", "\\u", "demo_", "._", "get", "\\u", "short", "\\u", "label_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "default", "\\u", "demo_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "isd", "efa", "ult", "'_", ":_", "str_", "(_", "True_", ")_", "._", "lower_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "isdi", "spla", "yed", "'_", ":_", "str_", "(_", "default", "\\u", "demo_", "._", "is", "\\u", "displayed_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "get", " ", "the", " ", "maps", "erver", " ", "protoc", "ol", " ", "from", " ", "the", " ", "settings", " ", "module", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "it", " ", "to", " ", "an", " ", "empty", " ", "string", " ", "if", " ", "the", " ", "setti", "ng", " ", "isn", "'", "t", " ", "defin", "ed", " ", "so", " ", "the", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "front", "-", "end", " ", "Javascript", " ", "will", " ", "set", " ", "a", " ", "reason", "able", " ", "default", " ", "(", "currentl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "protoc", "ol", " ", "as", " ", "the", " ", "request", " ", "to", " ", "the", " ", "webse", "rver", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "MAP", "\\u", "SERVER", "\\u", "PROTOCOL", "'_", "in_", "settings_", "._", "\\u\\u", "member", "s\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maps", "erver", "\\u", "protocol_", "=_", "settings_", "._", "MAP", "\\u", "SERVER", "\\u", "PROTOCOL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maps", "erver", "\\u", "protocol_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "short", "\\u", "label_", "=_", "body", "\\u", "member", "\\u", "short", "\\u", "label_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "\\u", "label_", "=_", "body", "\\u", "member", "\\u", "long", "\\u", "label_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "regions_", "=_", "Region_", "._", "objects_", "._", "all_", "(_", ")_", "._", "count_", "(_", ")_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bodies_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "region", "\\u\\u", "sort", "\\u", "key", "'_", ",_", "'", "sort", "\\u", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "bodies_", "=_", "[_", "b_", "for_", "b_", "in_", "bodies_", "if_", "b_", "in_", "[_", "sd_", "._", "legislat", "ive", "\\u", "body_", "for_", "sd_", "in_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "is", "\\u", "page_", "=_", "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 ", " _", "loader_", "._", "get", "\\u", "template_", "(_", "reporting", "\\u", "template_", ")_", "\\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 ", " _", "reporting", "\\u", "template_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Request", "Context_", "(_", "request_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bodi", "es", "'_", ":_", "bodies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "regions", "'_", ":_", "has", "\\u", "regions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leader", "board", "\\u", "bodi", "es", "'_", ":_", "l\\u", "bodies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plan", "'_", ":_", "plan_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "district", "s", "'_", ":_", "district", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "'_", ":_", "settings_", "._", "MAP", "\\u", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "\\u", "protoc", "ol", "'_", ":_", "maps", "erver", "\\u", "protocol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "basem", "aps", "'_", ":_", "settings_", "._", "BASE", "\\u", "MAP", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "'_", ":_", "settings_", "._", "MAP", "\\u", "SERVER", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ns", "\\u", "href", "'_", ":_", "settings_", "._", "MAP", "\\u", "SERVER", "\\u", "NS", "HRE", "F_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feature", "\\u", "limit", "'_", ":_", "settings_", "._", "FEATURE", "\\u", "LIMIT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "adjacency", "'_", ":_", "settings_", "._", "ADJ", "ACE", "NCY", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "convex", "chor", "opl", "eth", "'_", ":_", "settings_", "._", "CONVE", "X", "\\u", "CHO", "ROP", "LET", "H_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "demo", "graphic", "s", "'_", ":_", "layers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "snap", "layer", "s", "'_", ":_", "snap", "layers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unassign", "ed", "\\u", "id", "'_", ":_", "UNA", "SSI", "GN", "ED", "\\u", "DISTRI", "CT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "register", "ed", "'_", ":_", "request_", "._", "user_", "._", "username_", "!=_", "'", "anonym", "ous", "'_", "and_", "request_", "._", "user_", "._", "username_", "!=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "debugg", "ing", "\\u", "sta", "ff", "'_", ":_", "settings_", "._", "DEBUG_", "and_", "request_", "._", "user_", "._", "is", "\\u", "staff_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "userin", "fo", "'_", ":_", "get", "\\u", "user", "\\u", "info_", "(_", "request_", "._", "user_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "edita", "ble", "'_", ":_", "editable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "dists", "'_", ":_", "max", "\\u", "dists_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ga", "\\u", "account", "'_", ":_", "settings_", "._", "GA", "\\u", "ACCOUNT", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ga", "\\u", "domain", "'_", ":_", "settings_", "._", "GA", "\\u", "DOMAIN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "\\u", "member", "\\u", "short", "\\u", "label", "'_", ":_", "short", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "\\u", "member", "\\u", "long", "\\u", "label", "'_", ":_", "long", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "\\u", "member", "s", "'_", ":_", "body", "\\u", "members_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reporting", "\\u", "template", "'_", ":_", "reporting", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stud", "y", "\\u", "area", "\\u", "extent", "'_", ":_", "stud", "y", "\\u", "area", "\\u", "extent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "leader", "board", "'_", ":_", "len_", "(_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "is", "\\u", "page_", "=_", "True_", ")_", ")_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "calculator", "\\u", "report", "s", "'_", ":_", "json_", "._", "dumps_", "(_", "calculator", "\\u", "reports_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "\\u", "email", "\\u", "subm", "ission", "s", "'_", ":_", "(_", "'", "EMA", "IL", "\\u", "SUB", "MISSI", "ON", "'_", "in_", "settings_", "._", "\\u\\u", "member", "s\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "tags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plan", "\\u", "text", "'_", ":_", "\\u_", "(_", "\"", "communi", "ty", " ", "map", "\"_", ")_", "if_", "(_", "plan_", "and_", "plan_", "._", "is", "\\u", "community_", "(_", ")_", ")_", "else_", "\\u_", "(_", "\"", "plan", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "\\u", "code", "'_", ":_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LANGUAGE", "S", "'_", ":_", "settings_", "._", "LANGUAGES_", "#", " ", "need", "ed", " ", "(", "as", " ", "CAPS", ")", " ", "for", " ", "language", " ", "chooser_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "plan", "\\u", "ready_", "(_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", "s", " ", "if", " ", "a", " ", "plan", " ", "is", " ", "in", " ", "a", " ", "Read", "y", " ", "state", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan", "id_", "=_", "int_", "(_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "plan", "id_", "==_", "0_", "or_", "len_", "(_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ",_", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "READY", "_", ")_", ")_", ">_", "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_", "@_", "user", "\\u", "pass", "es", "\\u", "test_", "(_", "usi", "ng", "\\u", "unique", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "View", " ", "a", " ", "plan", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "template", " ", "has", " ", "no", " ", "editin", "g", " ", "capab", "ilit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "view", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "render", "ed", " ", "HTM", "L", " ", "page", " ", "for", " ", "viewin", "g", " ", "a", " ", "plan", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "session", "\\u", "available_", "(_", "request_", ")_", "or_", "not_", "is", "\\u", "plan", "\\u", "ready_", "(_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", "up", " ", "old", " ", "version", "s", " ", "for", " ", "logged", " ", "in", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", "and_", "(_", "int_", "(_", "plan", "id_", ")_", "==_", "0_", ")_", "and_", "(_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "Plan_", "._", "objects_", "._", "filter_", "(_", "owner_", "=_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "pur", "ge", "\\u", "be", "yon", "d\\u", "nth", "\\u", "step_", "(_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ")_", "\\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_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "view", "plan", ".", "html", "'_", ",_", "common", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "user", "\\u", "pass", "es", "\\u", "test_", "(_", "usi", "ng", "\\u", "unique", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "edit", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Edit", " ", "a", " ", "plan", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "template", " ", "enable", "s", " ", "editin", "g", " ", "tool", "s", " ", "and", " ", "functional", "it", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "edit", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "render", "ed", " ", "HTM", "L", " ", "page", " ", "for", " ", "editin", "g", " ", "a", " ", "plan", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", "or_", "not_", "is", "\\u", "session", "\\u", "available_", "(_", "request_", ")_", "or_", "not_", "is", "\\u", "plan", "\\u", "ready_", "(_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "common", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cfg_", "[_", "'", "is", "\\u", "edita", "ble", "'_", "]_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/", "district", "mapping", "/", "plan", "/", "%", "s", "/", "view", "/'_", "%_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "dists", "\\u", "maxe", "d", "'_", "]_", "=_", "len_", "(_", "cfg_", "[_", "'", "district", "s", "'_", "]_", ")_", ">_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "max", "\\u", "district", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "avail", "able", "\\u", "district", "s", "'_", "]_", "=_", "plan_", "._", "get", "\\u", "avail", "able", "\\u", "district", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", "up", " ", "old", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "._", "pur", "ge", "\\u", "be", "yon", "d\\u", "nth", "\\u", "step_", "(_", "settings_", "._", "MAX", "\\u", "UND", "OS", "\\u", "AFTER", "\\u", "EDIT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "edit", "plan", ".", "html", "'_", ",_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "user", "\\u", "pass", "es", "\\u", "test_", "(_", "usi", "ng", "\\u", "unique", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "print", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Print", " ", "a", " ", "static", " ", "map", " ", "of", " ", "a", " ", "plan", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "template", " ", "render", "s", " ", "a", " ", "static", " ", "HTM", "L", " ", "document", " ", "for", " ", "use", " ", "with", " ", "xh", "tml", "2p", "df", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "edit", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "render", "ed", " ", "HTM", "L", " ", "page", " ", "suit", "able", " ", "for", " ", "conve", "rsi", "on", " ", "to", " ", "a", " ", "PD", "F", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "session", "\\u", "available_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "common", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha_", "._", "update_", "(_", "str_", "(_", "plan", "id_", ")_", "+_", "str_", "(_", "datetime_", "._", "now_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "composi", "te", "'_", "]_", "=_", "'/", "report", "s", "/", "print", "-%", "s", ".", "jp", "g", "'_", "%_", "sha_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "prefix", "'_", "]_", "=_", "'", "http", "://", "%", "s", "'_", "%_", "request_", "._", "META_", "[_", "'", "SERVER", "\\u", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "'", "bbox", "'_", "in_", "request_", "._", "REQUEST_", "or_", "not_", "'", "geogr", "aph", "y", "\\u", "url", "'_", "in_", "request_", "._", "REQUEST_", "or_", "not_", "'", "geogr", "aph", "y", "\\u", "lyr", "'_", "in_", "request_", "._", "REQUEST_", "or_", "not_", "'", "district", "\\u", "url", "'_", "in_", "request_", "._", "REQUEST_", "or_", "not_", "'", "district", "\\u", "lyr", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "Missing", " ", "require", "d", " ", "\"", "bbox", "\",", " ", "\"", "geogr", "aph", "y", "\\u", "url", "\",", " ", "\"", "geogr", "aph", "y", "\\u", "lyr", "\",", " ", "\"", "district", "\\u", "url", "\",", " ", "or", " ", "\"", "district", "s", "\\u", "lyr", "\"", " ", "parameter", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'../", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "height_", "=_", "500_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "height", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "height_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "height", "'_", "]_", ")_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "width_", "=_", "1024_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "widt", "h", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "widt", "h", "'_", "]_", ")_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opacity_", "=_", "0.8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "opa", "city", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opacity_", "=_", "float_", "(_", "request_", "._", "REQUEST_", "[_", "'", "opa", "city", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "legend_", "=_", "json_", "._", "loads_", "(_", "request_", "._", "REQUEST_", "[_", "'", "legend", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "[_", "'", "geogr", "aph", "y", "\\u", "url", "'_", "]_", "=_", "request_", "._", "REQUEST_", "[_", "'", "geogr", "aph", "y", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "geogr", "aph", "y", "\\u", "lyr", "'_", "]_", "=_", "request_", "._", "REQUEST_", "[_", "'", "geogr", "aph", "y", "\\u", "lyr", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "district", "\\u", "url", "'_", "]_", "=_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "district", "\\u", "lyr", "'_", "]_", "=_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "lyr", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "geo", "\\u", "legend", "'_", "]_", "=_", "full", "\\u", "legend_", "[_", "'", "geo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "geo", "\\u", "legend", "\\u", "title", "'_", "]_", "=_", "full", "\\u", "legend_", "[_", "'", "geot", "itle", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "dist", "\\u", "legend", "'_", "]_", "=_", "full", "\\u", "legend_", "[_", "'", "dist", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "dist", "\\u", "legend", "\\u", "title", "'_", "]_", "=_", "full", "\\u", "legend_", "[_", "'", "dist", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "plan", "'_", "]_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "plan", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "[_", "'", "printed", "'_", "]_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "mode", "stm", "aps", " ", "to", " ", "get", " ", "the", " ", "basem", "ap_", "\\u\\u\\uNL\\u\\u\\u_", "bbox_", "=_", "request_", "._", "REQUEST_", "[_", "'", "bbox", "'_", "]_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt1_", "=_", "Point_", "(_", "float_", "(_", "bbox_", "[_", "0_", "]_", ")_", ",_", "float_", "(_", "bbox_", "[_", "1_", "]_", ")_", ",_", "srid_", "=_", "378", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt1_", "._", "transform_", "(_", "Spa", "tial", "Reference_", "(_", "'", "EPS", "G", ":", "432", "6", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "=_", "Mode", "st", "Maps_", "._", "Geo", "_", "._", "Location_", "(_", "pt1_", "._", "y_", ",_", "pt1_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt2_", "=_", "Point_", "(_", "float_", "(_", "bbox_", "[_", "2_", "]_", ")_", ",_", "float_", "(_", "bbox_", "[_", "3_", "]_", ")_", ",_", "srid_", "=_", "378", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt2_", "._", "transform_", "(_", "Spa", "tial", "Reference_", "(_", "'", "EPS", "G", ":", "432", "6", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ur_", "=_", "Mode", "st", "Maps_", "._", "Geo", "_", "._", "Location_", "(_", "pt2_", "._", "y_", ",_", "pt2_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dims_", "=_", "Mode", "st", "Maps_", "._", "Core_", "._", "Point_", "(_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provider_", "=_", "Mode", "st", "Maps_", "._", "Open", "Stre", "et", "Map_", "._", "Provider_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basem", "ap_", "=_", "Mode", "st", "Maps_", "._", "map", "By", "Extent_", "(_", "provider_", ",_", "ll_", ",_", "ur_", ",_", "dims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "basem", "ap", " ", "for", " ", "composi", "ting_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Img_", "=_", "basem", "ap_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "geogr", "aph", "y", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "provider_", "=_", "Mode", "st", "Maps_", "._", "WM", "S_", "._", "Provider_", "(_", "cfg_", "[_", "'", "geogr", "aph", "y", "\\u", "url", "'_", "]_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LAYERS", "'_", ":_", "cfg_", "[_", "'", "geogr", "aph", "y", "\\u", "lyr", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRANSP", "ARE", "NT", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SR", "S", "'_", ":_", "'", "EPS", "G", ":", "378", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HE", "IGHT", "'_", ":_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WID", "TH", "'_", ":_", "512_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overlay", "Img_", "=_", "Mode", "st", "Maps_", "._", "map", "By", "Extent_", "(_", "provider_", ",_", "ll_", ",_", "ur_", ",_", "dims_", ")_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "an", " ", "invert", " ", "mask", " ", "of", " ", "the", " ", "geogr", "aph", "y_", "\\u\\u\\uNL\\u\\u\\u_", "mask", "Img_", "=_", "Image", "Cho", "ps_", "._", "invert_", "(_", "overlay", "Img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "district", " ", "fill", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "provider_", "=_", "Mode", "st", "Maps_", "._", "WM", "S_", "._", "Provider_", "(_", "cfg_", "[_", "'", "district", "\\u", "url", "'_", "]_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LAYERS", "'_", ":_", "cfg_", "[_", "'", "district", "\\u", "lyr", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRANSP", "ARE", "NT", "'_", ":_", "'", "fal", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SR", "S", "'_", ":_", "'", "EPS", "G", ":", "378", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SL", "D", "\\u", "BODY", "'_", ":_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "sld", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HE", "IGHT", "'_", ":_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WID", "TH", "'_", ":_", "512_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overlay", "Img_", "=_", "Image_", "._", "blend", "_", "(_", "overlay", "Img_", ",_", "Mode", "st", "Maps_", "._", "map", "By", "Extent_", "(_", "provider_", ",_", "ll_", ",_", "ur_", ",_", "dims_", ")_", "._", "draw_", "(_", ")_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "composi", "te", " ", "the", " ", "overlay", " ", "onto", " ", "the", " ", "base", ",", " ", "usi", "ng", " ", "the", " ", "mask", " ", "(", "from", " ", "geogr", "aph", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Img_", "=_", "Image_", "._", "composite_", "(_", "full", "Img_", ",_", "Image_", "._", "blend", "_", "(_", "full", "Img_", ",_", "overlay", "Img_", ",_", "opacity_", ")_", ",_", "mask", "Img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "district", " ", "line", " ", "&", " ", "label", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "provider_", "=_", "Mode", "st", "Maps_", "._", "WM", "S_", "._", "Provider_", "(_", "cfg_", "[_", "'", "district", "\\u", "url", "'_", "]_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LAYERS", "'_", ":_", "cfg_", "[_", "'", "district", "\\u", "lyr", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRANSP", "ARE", "NT", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SR", "S", "'_", ":_", "'", "EPS", "G", ":", "378", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SL", "D", "\\u", "BODY", "'_", ":_", "request_", "._", "REQUEST_", "[_", "'", "label", "\\u", "sld", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HE", "IGHT", "'_", ":_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WID", "TH", "'_", ":_", "512_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overlay", "Img_", "=_", "Mode", "st", "Maps_", "._", "map", "By", "Extent_", "(_", "provider_", ",_", "ll_", ",_", "ur_", ",_", "dims_", ")_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "an", " ", "invert", " ", "mask", " ", "of", " ", "the", " ", "labels", " ", "&", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "mask", "Img_", "=_", "Image", "Cho", "ps_", "._", "invert_", "(_", "overlay", "Img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "composi", "te", " ", "the", " ", "district", " ", "labels", " ", "on", " ", "top", " ", "of", " ", "the", " ", "composi", "ted", " ", "basem", "ap", ",", " ", "geogr", "aph", "y", " ", "&", " ", "district", " ", "areas_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Img_", "=_", "Image_", "._", "composite_", "(_", "full", "Img_", ",_", "Image_", "._", "blend", "_", "(_", "full", "Img_", ",_", "overlay", "Img_", ",_", "opacity_", ")_", ",_", "mask", "Img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Img_", "._", "save_", "(_", "settings_", "._", "WEB", "\\u", "TEMP", "_", "+_", "(_", "'/", "print", "-%", "s", ".", "jp", "g", "'_", "%_", "sha_", "._", "hexdigest_", "(_", ")_", ")_", ",_", "'", "jpeg", "'_", ",_", "quality_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", " ", "pg", " ", "to", " ", "a", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "print", "plan", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "t_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "cfg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setti", "ng", " ", "encoding", "='", "UT", "F", "-", "8", "'", " ", "caus", "es", " ", "an", " ", "exception", ".", " ", "remo", "ving", " ", "this", " ", "for", " ", "now", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "allow", "ing", " ", "the", " ", "method", " ", "to", " ", "set", " ", "an", " ", "encoding", " ", "its", "elf", " ", "fixes", " ", "the", " ", "problem", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "may", " ", "need", " ", "to", " ", "find", " ", "an", " ", "alternat", "e", " ", "strat", "eg", "y", " ", "if", " ", "it", " ", "find", "s", " ", "encoding", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "isn", "'", "t", " ", "able", " ", "to", " ", "deci", "pher", "._", "\\u\\u\\uNL\\u\\u\\u_", "Creat", "e", "PDF_", "(_", "page_", ",_", "result_", ",_", "show", "\\u", "error", "\\u", "as", "\\u", "pdf_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "result_", "._", "getvalue_", "(_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "pdf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=", "plan", ".", "pdf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "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 ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'../", "view", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "plan_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "plan", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "plan", " ", "from", " ", "a", " ", "POST", " ", "request", ".", " ", "Thi", "s", " ", "plan", " ", "will", " ", "be", " ", "'", "blank", "',", " ", "and", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "contain", " ", "only", " ", "the", " ", "Una", "ssi", "gned", " ", "district", " ", "initially", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "whi", "ch", " ", "contain", "s", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", ",", " ", "inclu", "ding", " ", "the", " ", "new", " ", "plan", "'", "s", " ", "informati", "on", ",", " ", "or", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "error", " ", "descri", "bing", " ", "wh", "y", " ", "the", " ", "plan", " ", "coul", "d", " ", "not", " ", "be", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "request_", "._", "POST_", "[_", "'", "name", "'_", "]_", "[_", "0_", ":_", "200_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "legislat", "ive", "Bod", "y", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "(_", "name_", "=_", "name_", ",_", "owner_", "=_", "request_", "._", "user_", ",_", "legislat", "ive", "\\u", "body_", "=_", "body_", ",_", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "READY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "serializers_", "._", "serialize_", "(_", "\"", "json", "\"_", ",_", "[_", "plan_", "]_", ")_", "\\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 ", " _", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", ",_", "'", "message", "'_", ":_", "\\u_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "save", " ", "new", " ", "plan", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "upload", "file_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Accept", " ", "a", " ", "block", " ", "equivale", "nc", "y", " ", "file", ",", " ", "and", " ", "create", " ", "a", " ", "plan", " ", "based", " ", "on", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "a", " ", "file", " ", "upload", " ", "and", " ", "plan", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "plan", " ", "view", ",", " ", "with", " ", "addition", "al", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "upload", " ", "status", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "user", " ", "is", " ", "logged", " ", "off", " ", "from", " ", "anot", "her", " ", "location", ",", " ", "the", "y", " ", "will", " ", "appear", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "an", " ", "anonym", "ous", " ", "user", ".", " ", "Redirect", " ", "them", " ", "to", " ", "the", " ", "front", " ", "page", ".", " ", "Sa", "dl", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "will", " ", "not", " ", "get", " ", "a", " ", "notice", " ", "tha", "t", " ", "the", "y", " ", "wer", "e", " ", "logged", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "common", "plan_", "(_", "request_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "file_", "=_", "request_", "._", "FILES_", "._", "get_", "(_", "'", "index", "File", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "index", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "view", "plan", ".", "html", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "index", "\\u", "file_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "index", "\\u", "file_", "._", "size_", ">_", "settings_", "._", "MAX", "\\u", "UPLOAD", "\\u", "SIZE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "File", " ", "size", " ", "exceed", "s", " ", "allow", "able", " ", "size", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "view", "plan", ".", "html", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filename_", "._", "endswith_", "(_", "(_", "'.", "csv", "'_", ",_", "'.", "zip", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Upload", "ed", " ", "file", " ", "must", " ", "be", " ", "\".", "csv", "\"", " ", "or", " ", "\".", "zip", "\".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "POST_", "[_", "'", "user", "Ema", "il", "'_", "]_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "No", " ", "email", " ", "provided", " ", "for", " ", "user", " ", "notification", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "mode_", "=_", "'", "wb", "+'_", ",_", "delete_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chunk_", "in_", "request_", "._", "FILES_", "[_", "'", "index", "File", "'_", "]_", "._", "chunks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "._", "write_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "FILES_", "[_", "'", "index", "File", "'_", "]_", "._", "name_", "._", "endswith_", "(_", "'.", "zip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rename_", "(_", "dest_", "._", "name_", ",_", "'%", "s", "%", "s", "'_", "%_", "(_", "dest_", "._", "name_", ",_", "'.", "zip", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'%", "s", "%", "s", "'_", "%_", "(_", "dest_", "._", "name_", ",_", "'.", "zip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "dest_", "._", "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_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Cou", "ld", " ", "not", " ", "save", " ", "uploade", "d", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "upload", "\\u", "status", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "view", "plan", ".", "html", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "in", " ", "a", " ", "celery", " ", "task", " ", "to", " ", "create", " ", "the", " ", "plan", " ", "and", " ", "email", " ", "user", " ", "on", " ", "completion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Distr", "ict", "Index", "File_", "._", "index", "2p", "lan", "_", "._", "delay_", "(_", "request_", "._", "POST_", "[_", "'", "txt", "New", "Name", "'_", "]_", ",_", "request_", "._", "POST_", "[_", "'", "legislat", "ive", "Bod", "y", "'_", "]_", ",_", "filename_", ",_", "owner_", "=_", "request_", "._", "user_", ",_", "template_", "=_", "False_", ",_", "purge_", "=_", "True_", ",_", "email_", "=_", "request_", "._", "POST_", "[_", "'", "user", "Ema", "il", "'_", "]_", ",_", "language_", "=_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "view", "plan", ".", "html", "'_", ",_", "status_", ")_", "\\u\\u\\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_", "generat", "e\\u", "report", "\\u", "hash_", "(_", "qd", "ict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "a", " ", "hash", " ", "based", " ", "on", " ", "the", " ", "query", " ", "items", " ", "pass", "ed", " ", "to", " ", "this", " ", "report", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "qd", "ict_", "._", "get_", "(_", "'", "pop", "Var", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "pop", "Var", "Extra", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "ratio", "Var", "s", "[]'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "split", "Var", "s", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "block", "Label", "Var", "'_", ",_", "'", "CT", "ID", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "rep", "Compact", "ness", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "rep", "Compact", "ness", "Extra", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "rep", "Spa", "tial", "'_", ",_", "'", " ", "'_", ")_", "+_", "qd", "ict_", "._", "get_", "(_", "'", "rep", "Spa", "tial", "Extra", "'_", ",_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha_", "._", "update_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sha_", "._", "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_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "getre", "port_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "a", " ", "BAR", "D", " ", "report", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "view", " ", "will", " ", "write", " ", "out", " ", "an", " ", "HTM", "L", "-", "format", "ted", " ", "BAR", "D", " ", "report", " ", "to", " ", "the", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "in", " ", "the", " ", "settings", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "be", " ", "reporte", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "HTM", "L", " ", "for", " ", "use", " ", "as", " ", "a", " ", "previe", "w", " ", "in", " ", "the", " ", "web", " ", "applica", "tion", ",", " ", "along", " ", "with", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "web", " ", "address", " ", "of", " ", "the", " ", "BAR", "D", " ", "report", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "view", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "settings_", "._", "REPORT", "S", "\\u", "ENABLED_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Report", "s", " ", "functional", "it", "y", " ", "is", " ", "turn", "ed", " ", "off", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "variab", "les", " ", "from", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Information", " ", "for", " ", "report", " ", "was", "n", "'", "t", " ", "sent", " ", "via", " ", "POST", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stamp_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "stamp", "'_", ",_", "generat", "e\\u", "report", "\\u", "hash_", "(_", "request_", "._", "POST_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rpt", "status_", "=_", "Plan", "Report_", "._", "check", "report_", "(_", "plan", "id_", ",_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rpt", "status_", "==_", "'", "read", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "Plan", "Report_", "._", "getre", "port_", "(_", "plan", "id_", ",_", "stamp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Plan", " ", "report", " ", "is", " ", "read", "y", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rpt", "status_", "==_", "'", "bus", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "reverse_", "(_", "getre", "port_", ",_", "args_", "=_", "[_", "plan", "id_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Report", " ", "is", " ", "buildi", "ng", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rpt", "status_", "==_", "'", "free", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "reverse_", "(_", "getre", "port_", ",_", "args_", "=_", "[_", "plan", "id_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Report", " ", "generat", "ion", " ", "start", "ed", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pop", "Var", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "pop", "Var", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pop", "Var", "Extra", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "pop", "Var", "Extra", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ratio", "Var", "s", "[]'_", ":_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "ratio", "Var", "s", "[]'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "split", "Var", "s", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "split", "Var", "s", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "Label", "Var", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "block", "Label", "Var", "'_", ",_", "'", "CT", "ID", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rep", "Comp", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rep", "Compact", "ness", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rep", "Comp", "Extra", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rep", "Compact", "ness", "Extra", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rep", "Spa", "tial", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rep", "Spa", "tial", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rep", "Spa", "tial", "Extra", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rep", "Spa", "tial", "Extra", "'_", ",_", "''_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Plan", "Report_", "._", "mark", "pending_", "(_", "plan", "id_", ",_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Plan", "Report_", "._", "create", "report_", "._", "delay_", "(_", "plan", "id_", ",_", "stamp_", ",_", "req_", ",_", "language_", "=_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Unre", "cogni", "zed", " ", "status", " ", "whe", "n", " ", "checking", " ", "report", " ", "status", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "getc", "alc", "ulator", "report_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "a", " ", "report", " ", "whi", "ch", " ", "is", " ", "generat", "ed", " ", "by", " ", "usi", "ng", " ", "calculator", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "view", " ", "will", " ", "write", " ", "out", " ", "an", " ", "HTM", "L", "-", "format", "ted", " ", "report", " ", "to", " ", "the", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "in", " ", "the", " ", "settings", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "to", " ", "be", " ", "reporte", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "HTM", "L", " ", "for", " ", "use", " ", "as", " ", "a", " ", "previe", "w", " ", "in", " ", "the", " ", "web", " ", "applica", "tion", ",", " ", "along", " ", "with", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "web", " ", "address", " ", "of", " ", "the", " ", "report", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "view", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Information", " ", "for", " ", "report", " ", "was", "n", "'", "t", " ", "sent", " ", "via", " ", "POST", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "function", " ", "ids", " ", "from", " ", "the", " ", "POST_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function", "\\u", "ids_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "function", "Id", "s", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "a", " ", "hash", " ", "of", " ", "the", " ", "function", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "sha_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha_", "._", "update_", "(_", "function", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stamp_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "stamp", "'_", ",_", "sha_", "._", "hexdigest_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rpt", "status_", "=_", "Calculat", "or", "Report_", "._", "check", "report_", "(_", "plan", "id_", ",_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rpt", "status_", "==_", "'", "read", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "Calculat", "or", "Report_", "._", "getre", "port_", "(_", "plan", "id_", ",_", "stamp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Plan", " ", "report", " ", "is", " ", "read", "y", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rpt", "status_", "==_", "'", "bus", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "reverse_", "(_", "getc", "alc", "ulator", "report_", ",_", "args_", "=_", "[_", "plan", "id_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Report", " ", "is", " ", "buildi", "ng", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rpt", "status_", "==_", "'", "free", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "reverse_", "(_", "getc", "alc", "ulator", "report_", ",_", "args_", "=_", "[_", "plan", "id_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "retr", "y", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Report", " ", "generat", "ion", " ", "start", "ed", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stamp", "'_", ":_", "stamp_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "{_", "'", "function", "Id", "s", "'_", ":_", "function", "\\u", "ids_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Calculat", "or", "Report_", "._", "mark", "pending_", "(_", "plan", "id_", ",_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Calculat", "or", "Report_", "._", "create", "calculator", "report_", "._", "delay_", "(_", "plan", "id_", ",_", "stamp_", ",_", "req_", ",_", "language_", "=_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Unre", "cogni", "zed", " ", "status", " ", "whe", "n", " ", "checking", " ", "report", " ", "status", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "newdi", "strict_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "district", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "'", "geo", "level", "'", " ", "parameter", " ", "is", " ", "require", "d", " ", "to", " ", "create", " ", "a", " ", "new", " ", "district", ".", " ", "Geo", "unit", "s", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "be", " ", "adde", "d", " ", "to", " ", "this", " ", "new", " ", "district", " ", "by", " ", "setti", "ng", " ", "the", " ", "'", "geo", "unit", "s", "'", " ", "key", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "request", ".", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "-", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "-", " ", "The", " ", "plan", " ", "id", " ", "to", " ", "whi", "ch", " ", "the", " ", "district", " ", "shou", "ld", " ", "be", " ", "adde", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "new", " ", "Distr", "ict", "'", "s", " ", "name", " ", "and", " ", "district", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "REQUEST_", "._", "items_", "(_", ")_", ")_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "geo", "level", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "level_", "=_", "request_", "._", "REQUEST_", "[_", "'", "geo", "level", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "level_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "geo", "unit", "s", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "unit", "\\u", "ids_", "=_", "string_", "._", "split_", "(_", "request_", "._", "REQUEST_", "[_", "'", "geo", "unit", "s", "'_", "]_", ",_", "'|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "unit", "\\u", "ids_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "district", "\\u", "id", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "district", "\\u", "short", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "short_", "=_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "short", "'_", "]_", "[_", "0_", ":_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "district", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "short_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "short", "\\u", "label_", "(_", ")_", "%_", "{_", "'", "district", "\\u", "id", "'_", ":_", "district", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "short_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "district", "\\u", "long", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "long_", "=_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "long", "'_", "]_", "[_", "0_", ":_", "256_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "district", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "long_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "label_", "(_", ")_", "%_", "{_", "'", "district", "\\u", "id", "'_", ":_", "district", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "long_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "request_", "._", "REQUEST_", "[_", "'", "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 ", " _", "version_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "geo", "level_", "and_", "geo", "unit", "\\u", "ids_", "and_", "district", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "geo", "unit", "s", " ", "selecte", "d", " ", "to", " ", "this", " ", "district", " ", "--", " ", "this", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "new", " ", "district", " ", "w", "/", "1", " ", "version", " ", "higher", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fixed_", "=_", "plan_", "._", "add", "\\u", "geo", "units_", "(_", "(_", "district", "\\u", "id_", ",_", "district", "\\u", "short_", ",_", "district", "\\u", "long_", ",_", ")_", ",_", "geo", "unit", "\\u", "ids_", ",_", "geo", "level_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "are", " ", "comment", "s", ",", " ", "types", " ", "or", " ", "multiple", " ", "member", "s", ",", " ", "add", " ", "them", " ", "to", " ", "the", " ", "district_", "\\u\\u\\uNL\\u\\u\\u_", "district_", "=_", "plan_", "._", "district", "\\u", "set_", "._", "filter_", "(_", "district", "\\u", "id_", "=_", "district", "\\u", "id_", ",_", "short", "\\u", "label_", "=_", "district", "\\u", "short_", ",_", "long", "\\u", "label_", "=_", "district", "\\u", "long_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "multi", "\\u", "member", "s", "\\u", "allowed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "district_", "._", "num", "\\u", "members_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "min", "\\u", "multi", "\\u", "district", "\\u", "members_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "app", "\\u", "label_", "=_", "'", "redis", "tric", "ting", "'_", ",_", "model_", "=_", "'", "district", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "comment", "'_", "in_", "request_", "._", "POST_", "and_", "request_", "._", "POST_", "[_", "'", "comment", "'_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "comment_", "=_", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "pk_", "=_", "district_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "ct_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site", "\\u", "id_", "=_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "name_", "=_", "request_", "._", "user_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "email_", "=_", "request_", "._", "user_", "._", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "request_", "._", "POST_", "[_", "'", "comment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "type", "[]'_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "strt", "ags_", "=_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "type", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "strt", "ag_", "in_", "strt", "ags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "strt", "ag_", "==_", "''_", ":_", "\\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_", "strt", "ag_", "._", "count_", "(_", "'", " ", "'_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "strt", "ag_", "=_", "'\"", "type", "=", "%", "s", "\"'_", "%_", "strt", "ag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "strt", "ag_", "=_", "'", "type", "=", "%", "s", "'_", "%_", "strt", "ag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Tag_", "._", "objects_", "._", "add", "\\u", "tag_", "(_", "district_", ",_", "strt", "ag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Creat", "ed", " ", "1", " ", "new", " ", "district", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "edited", "'_", "]_", "=_", "getu", "tc_", "(_", "plan_", "._", "edited", "_", ")_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "district", "\\u", "id", "'_", "]_", "=_", "district", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Reach", "ed", " ", "Max", " ", "district", "s", " ", "alr", "ead", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "Error", " ", "saving", " ", "new", " ", "district", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "save", " ", "new", " ", "district", ".\"_", ")_", "\\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_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Mus", "t", " ", "speci", "fy", " ", "name", ",", " ", "geo", "level", ",", " ", "'_", "'", "and", " ", "geo", "unit", " ", "ids", " ", "for", " ", "new", " ", "district", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "transaction_", "._", "commit", "\\u", "manu", "ally", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "district", "s", "\\u", "to", "\\u", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "handler", " ", "is", " ", "used", " ", "to", " ", "paste", " ", "exist", "ing", " ", "district", "s", " ", "from", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "plan", " ", "int", "o", " ", "anot", "her", " ", "plan", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", " ", "object", " ", "inclu", "ding", " ", "a", " ", "list", " ", "of", " ", "district", "ids", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "version", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "int", "o", " ", "whi", "ch", " ", "to", " ", "paste", " ", "the", " ", "district", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "JSO", "N", " ", "explain", "ing", " ", "the", " ", "success", " ", "or", " ", "fail", "ure", " ", "of", " ", "the", " ", "paste", " ", "operati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "can", " ", "edit", " ", "the", " ", "give", "n", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "edit", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "district", "s", " ", "we", " ", "want", " ", "to", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "\\u", "list_", "=_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "district", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "district", "\\u", "list_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "No", " ", "district", "s", " ", "selecte", "d", " ", "to", " ", "add", " ", "to", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "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 ", " _", "district", "s_", "=_", "Distr", "ict_", "._", "objects_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "district", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Go", "ing", " ", "to", " ", "merge", " ", "%", "(", "number", "\\u", "of", "\\u", "merge", "d\\u", "district", "s", ")", "d", "'_", "'", " ", "district", "s", "'_", ")_", "%_", "{_", "'", "number", "\\u", "of", "\\u", "merge", "d\\u", "district", "s", "'_", ":_", "len_", "(_", "district", "s_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "have", " ", "eno", "ugh", " ", "room", " ", "to", " ", "add", " ", "these", " ", "district", "s", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "goi", "ng", " ", "over", " ", "MAX", "\\u", "DISTRI", "CT", "S", " ", "for", " ", "the", " ", "legislat", "ive", "\\u", "body_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "allow", "ed", "\\u", "district", "s_", "=_", "plan_", "._", "get", "\\u", "avail", "able", "\\u", "district", "s_", "(_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "district", "s_", ")_", ">_", "allow", "ed", "\\u", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Trie", "d", " ", "to", " ", "merge", " ", "too", " ", "many", " ", "district", "s", ";", " ", "'_", "'%", "(", "allow", "ed", "\\u", "district", "s", ")", "d", " ", "slot", "s", " ", "left", "'_", ")_", "%_", "{_", "'", "allow", "ed", "\\u", "district", "s", "'_", ":_", "allow", "ed", "\\u", "district", "s_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Every", "thing", " ", "checks", " ", "out", ",", " ", "let", "'", "s", " ", "paste", " ", "tho", "se", " ", "district", "s_", "\\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 ", " _", "results_", "=_", "plan_", "._", "paste", "\\u", "district", "s_", "(_", "district", "s_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Merged", " ", "%", "(", "num", "\\u", "merge", "d\\u", "district", "s", ")", "d", " ", "district", "s", "'_", ")_", "%_", "{_", "'", "num", "\\u", "merge", "d\\u", "district", "s", "'_", ":_", "len_", "(_", "results_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "plan_", "._", "version_", "\\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 ", " _", "transaction_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "str_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "transaction_", "._", "commit", "\\u", "manu", "ally", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "assign", "\\u", "district", "\\u", "members_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "handler", " ", "is", " ", "used", " ", "to", " ", "assign", " ", "member", "s", " ", "to", " ", "district", "s", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", " ", "object", " ", "inclu", "ding", " ", "a", " ", "version", ",", "\\", "10", ";", " ", "and", " ", "a", " ", "mapping", " ", "of", " ", "district", "ids", " ", "to", " ", "num", "\\u", "member", "s", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "int", "o", " ", "whi", "ch", " ", "to", " ", "assign", " ", "district", " ", "member", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "JSO", "N", " ", "explain", "ing", " ", "the", " ", "success", " ", "or", " ", "fail", "ure", " ", "of", " ", "the", " ", "paste", " ", "operati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "can", " ", "edit", " ", "the", " ", "give", "n", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "edit", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "this", " ", "district", " ", "allow", "s", " ", "multi", "-", "member", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "leg", "\\u", "bo", "d_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "leg", "\\u", "bo", "d_", "._", "multi", "\\u", "member", "s", "\\u", "allowed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Multi", "-", "member", "s", " ", "not", " ", "allow", "ed", " ", "for", " ", "this", " ", "legislat", "ive", " ", "body", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "district", "s", " ", "we", " ", "want", " ", "to", " ", "assign", " ", "member", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "s_", "=_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "district", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "=_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "count", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", " ", "the", " ", "district", " ", "member", "s", " ", "and", " ", "return", " ", "status_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "district", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "int_", "(_", "district", "s_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "int_", "(_", "counts_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "Distr", "ict_", "._", "objects_", "._", "filter_", "(_", "plan_", "=_", "plan_", ",_", "district", "\\u", "id_", "=_", "id_", ",_", "version", "\\u\\u", "lte_", "=_", "version_", ")_", "._", "order", "\\u", "by_", "(_", "'", "version", "'_", ")_", "._", "reverse_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "district_", "._", "num", "\\u", "members_", "!=_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "changed_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "at", " ", "leas", "t", " ", "one", " ", "change", ",", " ", "update", " ", "the", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "version_", "!=_", "plan_", "._", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plan_", "._", "purge_", "(_", "after_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "._", "version_", "=_", "plan_", "._", "version_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "._", "update", "\\u", "num", "\\u", "members_", "(_", "district_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "modifi", "ed", "'_", "]_", "=_", "changed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Modifie", "d", " ", "member", "s", " ", "for", " ", "%", "(", "num", "\\u", "district", "s", ")", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "district", "s", "'_", ")_", "%_", "{_", "'", "num", "\\u", "district", "s", "'_", ":_", "changed_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transaction_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "str_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "assign", " ", "district", " ", "member", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "combin", "e\\u", "district", "s_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tak", "e", " ", "the", " ", "content", "s", " ", "of", " ", "one", " ", "district", " ", "and", " ", "add", " ", "them", " ", "to", " ", "anot", "her", " ", "district", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "can", " ", "edit", " ", "the", " ", "give", "n", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "edit", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "district", "s", " ", "we", " ", "want", " ", "to", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "'_", ",_", "plan_", "._", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "from", "\\u", "district", "\\u", "id", "'_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "to", "\\u", "district", "\\u", "id", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "district", "s_", "=_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "version_", ",_", "include", "\\u", "geom_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "district", "s_", "=_", "filter_", "(_", "lambda_", "d_", ":_", "True_", "if_", "d_", "._", "district", "\\u", "id_", "==_", "from", "\\u", "id_", "else_", "False_", ",_", "all", "\\u", "district", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "district_", "=_", "filter_", "(_", "lambda_", "d_", ":_", "True_", "if_", "d_", "._", "district", "\\u", "id_", "==_", "to", "\\u", "id_", "else_", "False_", ",_", "all", "\\u", "district", "s_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locked_", "=_", "to", "\\u", "district_", "._", "is", "\\u", "locked_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "from", "\\u", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "district_", "._", "is", "\\u", "locked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locked_", "=_", "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_", "locked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Can", "'", "t", " ", "combin", "e", " ", "lock", "ed", " ", "district", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "plan_", "._", "combin", "e\\u", "district", "s_", "(_", "to", "\\u", "district_", ",_", "from", "\\u", "district", "s_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "[_", "0_", "]_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Success", "full", "y", " ", "combin", "ed", " ", "district", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "result_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Cou", "ld", " ", "not", " ", "combin", "e", " ", "district", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "combin", "e", " ", "district", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fix", "\\u", "unassign", "ed_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Assign", " ", "unassign", "ed", " ", "base", " ", "geo", "unit", "s", " ", "tha", "t", " ", "are", " ", "full", "y", " ", "contain", "ed", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "adjacent", " ", "to", " ", "anot", "her", " ", "district", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\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 ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "edit", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\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 ", " _", "version_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "'_", ",_", "plan_", "._", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "plan_", "._", "fix", "\\u", "unassign", "ed_", "(_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "result_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Cou", "ld", " ", "not", " ", "fix", " ", "unassign", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "fix", " ", "unassign", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "splits_", "(_", "request_", ",_", "plan", "id_", ",_", "other", "id_", ",_", "other", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "all", " ", "split", "s", " ", "bet", "ween", " ", "this", " ", "plan", " ", "and", " ", "anot", "her", " ", "plan", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", " ", "option", "ally", " ", "contain", "ing", " ", "version", " ", "and", "/", "or", " ", "other", "version", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", "other", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "or", " ", "geo", "level", " ", "ID", " ", "to", " ", "find", " ", "split", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "other", "type", " ", "--", " ", "One", " ", "of", ":", " ", "'", "plan", "'", " ", "or", " ", "'", "geo", "level", "'.", " ", "For", " ", "speci", "fy", "ing", " ", "other", "id", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "tha", "t", " ", "contain", "s", " ", "an", " ", "array", " ", "of", " ", "split", "s", ",", " ", "give", "n", " ", "as", " ", "arrays", ",", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "the", " ", "first", " ", "item", " ", "is", " ", "the", " ", "district", "\\u", "id", " ", "of", " ", "the", " ", "district", " ", "in", " ", "this", " ", "plan", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "caus", "es", " ", "the", " ", "split", ",", " ", "and", " ", "the", " ", "second", " ", "item", " ", "is", " ", "the", " ", "district", "\\u", "id", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "district", " ", "in", " ", "the", " ", "other", " ", "plan", " ", "or", " ", "geo", "level", ".", " ", "Whe", "n", " ", "a", " ", "geo", "level", " ", "is", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "portab", "le", "\\u", "id", " ", "will", " ", "be", " ", "used", ",", " ", "rat", "her", " ", "than", " ", "the", " ", "district", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "other", "id_", "=_", "int_", "(_", "other", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\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 ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "view", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", "else_", "plan_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other", "type_", "==_", "'", "plan", "'_", ":_", "\\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 ", " _", "other", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "other", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "other", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "other", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "User", " ", "can", "'", "t", " ", "view", " ", "the", " ", "give", "n", " ", "plan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "other", "version", "'_", "]_", "if_", "'", "other", "version", "'_", "in_", "request_", "._", "REQUEST_", "else_", "other", "plan_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splits_", "=_", "plan_", "._", "find", "\\u", "plan", "\\u", "splits_", "(_", "other", "plan_", ",_", "version_", ",_", "other", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other", "type_", "==_", "'", "geo", "level", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "splits_", "=_", "plan_", "._", "find", "\\u", "geo", "level", "\\u", "splits_", "(_", "other", "id_", ",_", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "other", "type", " ", "not", " ", "support", "ed", ":", " ", "%", "(", "other", ")", "s", "'_", ")_", "%_", "{_", "'", "other", "'_", ":_", "other", "type_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "split", "\\u", "word_", "=_", "\\u_", "(_", "'", "split", "'_", ")_", "if_", "len_", "(_", "splits_", ")_", "==_", "1_", "else_", "infl", "ect_", "._", "engine_", "(_", ")_", "._", "plural_", "(_", "\\u_", "(_", "'", "split", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Foun", "d", " ", "%", "(", "num", "\\u", "split", "s", ")", "d", " ", "%", "(", "split", "\\u", "word", ")", "s", "'_", ")_", "%_", "{_", "'", "num", "\\u", "split", "s", "'_", ":_", "len_", "(_", "splits_", ")_", ",_", "'", "split", "\\u", "word", "'_", ":_", "split", "\\u", "word_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "split", "s", "'_", "]_", "=_", "splits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "above", "\\u", "ids", "'_", "]_", "=_", "list_", "(_", "set_", "(_", "[_", "i_", "[_", "0_", "]_", "for_", "i_", "in_", "splits_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "belo", "w", "\\u", "ids", "'_", "]_", "=_", "list_", "(_", "set_", "(_", "[_", "i_", "[_", "1_", "]_", "for_", "i_", "in_", "splits_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Cou", "ld", " ", "not", " ", "query", " ", "for", " ", "split", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "query", " ", "for", " ", "split", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "process", "ing", "\\u", "status_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "process", "ing", " ", "status", " ", "for", " ", "a", " ", "list", " ", "of", " ", "plan", " ", "ids", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan", "\\u", "ids_", "=_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "plan", "Id", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "plan", "\\u", "ids_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", "Id", "s", " ", "provided", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "statuses_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "plan", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "statuses_", "[_", "str_", "(_", "p_", "._", "id_", ")_", "]_", "=_", "p_", "._", "get", "\\u", "process", "ing", "\\u", "state", "\\u", "display_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "statuses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "split", "s", "\\u", "report_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "render", "ed", " ", "split", "s", " ", "report", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\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 ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "return_", "Http", "Response_", "(_", "\\u_", "(_", "'", "Plan", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", "or_", "not_", "can", "\\u", "view_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", "else_", "plan_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inverse_", "=_", "request_", "._", "REQUEST_", "[_", "'", "inv", "erse", "'_", "]_", "==_", "'", "true", "'_", "if_", "'", "inv", "erse", "'_", "in_", "request_", "._", "REQUEST_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extended_", "=_", "request_", "._", "REQUEST_", "[_", "'", "extend", "ed", "'_", "]_", "==_", "'", "true", "'_", "if_", "'", "extend", "ed", "'_", "in_", "request_", "._", "REQUEST_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layers_", "=_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "layer", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "layers_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\\u_", "(_", "'", "No", " ", "layer", "s", " ", "wer", "e", " ", "provided", ".'_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\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 ", " _", "report_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "split", "\\u", "report", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "layer_", "in_", "layers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "context_", "=_", "{_", "'", "extend", "ed", "'_", ":_", "extended_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "context_", "._", "update_", "(_", "plan_", "._", "compute", "\\u", "splits_", "(_", "layer_", ",_", "version_", "=_", "version_", ",_", "inverse_", "=_", "inverse_", ",_", "extended_", "=_", "extended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "item_", "=_", "layer_", "is_", "layers_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "communi", "ty", "\\u", "info_", "=_", "plan_", "._", "get", "\\u", "communi", "ty", "\\u", "type", "\\u", "info_", "(_", "layer_", ",_", "version_", "=_", "version_", ",_", "inverse_", "=_", "inverse_", ",_", "include", "\\u", "counts_", "=_", "last", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "communi", "ty", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "context_", "._", "update_", "(_", "communi", "ty", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "calc", "\\u", "context_", "=_", "Dj", "ang", "o", "Context_", "(_", "my", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "+=_", "report_", "._", "render_", "(_", "calc", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "last", "\\u", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "+=_", "'<", "hr", " ", "/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "html_", ",_", "mimetype_", "=_", "'", "text", "/", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "produce", " ", "split", " ", "report", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "str_", "(_", "ex_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "addt", "odi", "strict_", "(_", "request_", ",_", "plan", "id_", ",_", "district", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "geo", "unit", "s", " ", "to", " ", "a", " ", "district", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "bot", "h", " ", "\"", "geo", "level", "\"", " ", "and", " ", "\"", "geo", "unit", "s", "\"", " ", "URL", " ", "parameter", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "geo", "level", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "geo", "level", " ", "name", " ", "and", " ", "the", " ", "geo", "unit", "s", " ", "parameter", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "a", " ", "pipe", "-", "separate", "d", " ", "list", " ", "of", " ", "geo", "unit", " ", "ids", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "the", " ", "current", " ", "user", ",", " ", "the", " ", "geo", "level", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "pipe", "-", "separate", "d", " ", "geo", "unit", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "district", ".", "\\", "10", ";", " ", " ", " ", " ", "district", "id", " ", "--", " ", "The", " ", "district", " ", "ID", " ", "to", " ", "whi", "ch", " ", "the", " ", "geo", "unit", "s", " ", "will", " ", "be", " ", "adde", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "number", " ", "of", " ", "district", "s", " ", "modifi", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "an", " ", "error", " ", "message", " ", "if", " ", "addin", "g", " ", "fail", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "REQUEST_", "._", "items_", "(_", ")_", ")_", ">=_", "2_", ":_", "\\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 ", " _", "geo", "level_", "=_", "request_", "._", "REQUEST_", "[_", "\"", "geo", "level", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "unit", "\\u", "ids_", "=_", "string_", "._", "split_", "(_", "request_", "._", "REQUEST_", "[_", "\"", "geo", "unit", "s", "\"_", "]_", ",_", "\"|\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\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 ", " _", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Cou", "ld", " ", "not", " ", "add", " ", "unit", "s", " ", "to", " ", "district", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "version", " ", "from", " ", "the", " ", "request", " ", "or", " ", "the", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "request_", "._", "REQUEST_", "[_", "'", "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 ", " _", "version_", "=_", "plan_", "._", "version_", "\\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 ", " _", "fixed_", "=_", "plan_", "._", "add", "\\u", "geo", "units_", "(_", "district", "id_", ",_", "geo", "unit", "\\u", "ids_", ",_", "geo", "level_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Update", "d", " ", "%", "(", "num", "\\u", "fixed", "\\u", "district", "s", ")", "d", " ", "district", "s", "'_", ")_", "%_", "{_", "'", "num", "\\u", "fixed", "\\u", "district", "s", "'_", ":_", "fixed_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "update", "d", "'_", "]_", "=_", "fixed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "edited", "'_", "]_", "=_", "getu", "tc_", "(_", "plan_", "._", "edited", "_", ")_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Cou", "ld", " ", "not", " ", "add", " ", "unit", "s", " ", "to", " ", "district", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "add", " ", "unit", "s", " ", "to", " ", "district", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Geo", "unit", "s", " ", "wer", "en", "'", "t", " ", "found", " ", "in", " ", "a", " ", "district", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setd", "istr", "ict", "lock_", "(_", "request_", ",_", "plan", "id_", ",_", "district", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "whe", "ther", " ", "this", " ", "district", " ", "is", " ", "lock", "ed", " ", "for", " ", "editin", "g", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "a", " ", "boolean", " ", "tha", "t", " ", "indicat", "es", " ", "whe", "ther", " ", "the", " ", "district", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "lock", "ed", " ", "or", " ", "unlocked", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "district", ".", "\\", "10", ";", " ", " ", " ", " ", "district", "\\u", "id", " ", "--", " ", "The", " ", "district", "\\u", "id", " ", "to", " ", "lock", " ", "or", " ", "unlock", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "JSO", "N", " ", "Http", "Respons", "e", " ", "tha", "t", " ", "contain", "s", " ", "a", " ", "boolean", " ", "of", " ", "whe", "ther", " ", "the", " ", "district", " ", "is", " ", "lock", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lock_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "lock", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lock_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Mus", "t", " ", "include", " ", "lock", " ", "parameter", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "version_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Mus", "t", " ", "include", " ", "version", " ", "parameter", ".'_", ")_", "\\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 ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "plan_", "._", "district", "\\u", "set_", "._", "filter_", "(_", "district", "\\u", "id_", "=_", "district", "\\u", "id_", ",_", "version", "\\u\\u", "lte_", "=_", "version_", ")_", "._", "order", "\\u", "by_", "(_", "'", "version", "'_", ")_", "._", "reverse_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Plan", " ", "or", " ", "district", " ", "doe", "s", " ", "not", " ", "exist", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "plan_", "._", "owner_", "!=_", "request_", "._", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district_", "._", "is", "\\u", "locked_", "=_", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Distr", "ict", " ", "success", "full", "y", " ", "%", "(", "lock", "ed", "\\u", "state", ")", "s", "'_", ")_", "%_", "{_", "'", "lock", "ed", "\\u", "state", "'_", ":_", "\\u_", "(_", "'", "lock", "ed", "'_", ")_", "if_", "lock_", "else_", "\\u_", "(_", "'", "unlocked", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "getd", "istr", "icts", "_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "district", "s", " ", "in", " ", "a", " ", "plan", " ", "at", " ", "a", " ", "specific", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "-", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "-", " ", "The", " ", "plan", " ", "id", " ", "to", " ", "query", " ", "for", " ", "the", " ", "district", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "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 ", " _", "version_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "s_", "=_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "version_", ",_", "include", "\\u", "geom_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "district", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sam", "e", " ", "calculati", "on", " ", "as", " ", "plan", ".", "get", "\\u", "avail", "able", "\\u", "district", "s", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "\\u", "a", "\\u", "d", " ", "fetches", " ", "district", "s", " ", "all", " ", "over", " ", "again", " ", "--", " ", "skip", " ", "tha", "t", " ", "overhead", "_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "avail", "able", "'_", "]_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "max", "\\u", "district", "s_", "-_", "len_", "(_", "district", "s_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "maxim", "um", " ", "version", " ", "in", " ", "the", " ", "return", "ed", " ", "district", "s_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "version_", "=_", "max_", "(_", "[_", "d_", "._", "version_", "for_", "d_", "in_", "district", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "allow", " ", "undo", " ", "if", " ", "the", " ", "max", " ", "version", " ", "bei", "ng", " ", "return", "ed", " ", "isn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equal", " ", "to", " ", "the", " ", "minim", "um", " ", "store", "d", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "undo_", "=_", "max", "\\u", "version_", ">_", "plan_", "._", "min", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "district", "s", "'_", "]_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "district_", "._", "district", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "short", "\\u", "label", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "map_", "(_", "\\u_", ",_", "district_", "._", "short", "\\u", "label_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "long", "\\u", "label", "'_", ":_", "'", " ", "'_", "._", "join_", "(_", "map_", "(_", "\\u_", ",_", "district_", "._", "long", "\\u", "label_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "district_", "._", "version_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "can", "Und", "o", "'_", "]_", "=_", "can", "\\u", "undo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "exist", "s", " ", "with", " ", "tha", "t", " ", "ID", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "simple", "\\u", "district", "\\u", "versioned", "_", "(_", "request_", ",_", "plan", "id_", ",_", "district", "\\u", "ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Emulat", "e", " ", "a", " ", "WF", "S", " ", "service", " ", "for", " ", "versioned", " ", "district", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "retrieve", "s", " ", "one", " ", "version", " ", "of", " ", "the", " ", "district", "s", " ", "in", " ", "a", " ", "plan", ",", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "value", " ", "of", " ", "the", " ", "subject", " ", "attache", "d", " ", "to", " ", "the", " ", "feature", ".", " ", "Thi", "s", " ", "function", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "necessar", "y", " ", "bec", "aus", "e", " ", "a", " ", "trad", "itional", " ", "view", " ", "coul", "d", " ", "not", " ", "be", " ", "used", " ", "to", " ", "get", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "district", "s", " ", "in", " ", "a", " ", "versioned", " ", "fas", "hio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "accepts", " ", "'", "version", "\\u\\u", "eq", "'", " ", "and", " ", "'", "subject", "s", "\\u\\u", "eq", "'", " ", "URL", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "accepts", " ", "an", " ", "option", "al", " ", "'", "district", "\\u", "ids", "\\u\\u", "eq", "'", " ", "parameter", ",", " ", "whi", "ch", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "comma", "-", "separate", "d", " ", "list", " ", "of", " ", "district", "\\u", "ids", " ", "to", " ", "filter", " ", "by", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "from", " ", "whi", "ch", " ", "to", " ", "get", " ", "the", " ", "district", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Geo", "JSO", "N", " ", "Http", "Respons", "e", ",", " ", "descri", "bing", " ", "the", " ", "district", "s", " ", "in", " ", "the", " ", "plan", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "type", "'_", ":_", "'", "Feature", "Collecti", "on", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "version", "\\u\\u", "eq", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "request_", "._", "REQUEST_", "[_", "'", "version", "\\u\\u", "eq", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "subject", "\\u\\u", "eq", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "id_", "=_", "request_", "._", "REQUEST_", "[_", "'", "subject", "\\u\\u", "eq", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "default", "\\u", "subject_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject", "\\u", "id_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "default", "\\u", "subject_", "(_", ")_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "geo", "level_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "[_", "0_", "]_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "level", "\\u\\u", "eq", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "level_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "level", "\\u\\u", "eq", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "district", "\\u", "ids", "\\u\\u", "eq", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "ids_", "=_", "request_", "._", "REQUEST_", "[_", "'", "district", "\\u", "ids", "\\u\\u", "eq", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "district", "\\u", "ids_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "ids_", "=_", "district", "\\u", "ids_", "._", "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 ", " _", "district", "\\u", "ids_", "=_", "[_", "]_", "\\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_", "subject", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "bbox", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "request_", "._", "REQUEST_", "[_", "'", "bbox", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", " ", "the", " ", "request", " ", "string", " ", "int", "o", " ", "a", " ", "tuple", " ", "full", " ", "of", " ", "floats_", "\\u\\u\\uNL\\u\\u\\u_", "bbox_", "=_", "tuple_", "(_", "map_", "(_", "lambda_", "x_", ":_", "float_", "(_", "x_", ")_", ",_", "bbox_", "._", "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 ", " _", "bbox_", "=_", "plan_", "._", "district", "\\u", "set_", "._", "all_", "(_", ")_", "._", "extent_", "(_", "field", "\\u", "name_", "=_", "'", "simple", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "features", "'_", "]_", "=_", "plan_", "._", "get", "\\u", "wfs", "\\u", "district", "s_", "(_", "version_", ",_", "subject", "\\u", "id_", ",_", "bbox_", ",_", "geo", "level_", ",_", "district", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "features", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Sub", "ject", " ", "for", " ", "district", "s", " ", "is", " ", "require", "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 ", " _", "status_", "[_", "'", "features", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Query", " ", "fail", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "unlocked", "\\u", "simple", "\\u", "geometries", "_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Emulat", "e", " ", "a", " ", "WF", "S", " ", "service", " ", "for", " ", "selecti", "ng", " ", "unlocked", " ", "geometries", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "retrieve", "s", " ", "all", " ", "unlocked", " ", "geometries", " ", "within", " ", "a", " ", "geo", "level", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "give", "n", " ", "plan", ".", " ", "Thi", "s", " ", "function", " ", "is", " ", "necessar", "y", " ", "bec", "aus", "e", " ", "a", " ", "trad", "itional", "\\", "10", ";", " ", " ", " ", " ", "view", " ", "coul", "d", " ", "not", " ", "be", " ", "used", " ", "to", " ", "obtain", " ", "the", " ", "geometries", " ", "in", " ", "a", " ", "versioned", " ", "fas", "hio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "accepts", " ", "'", "version", "\\u\\u", "eq", "',", " ", "'", "level", "\\u\\u", "eq", "',", " ", "and", " ", "'", "geom", "\\u\\u", "eq", "'", " ", "URL", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", ",", " ", "with", " ", "the", " ", "current", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", " ", "from", " ", "whi", "ch", " ", "to", " ", "get", " ", "the", " ", "district", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Geo", "JSO", "N", " ", "Http", "Respons", "e", ",", " ", "descri", "bing", " ", "the", " ", "unlocked", " ", "simplified", " ", "geometries", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "type", "'_", ":_", "'", "Feature", "Collecti", "on", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "version", "\\u\\u", "eq", "'_", ",_", "plan_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "level", "\\u\\u", "eq", "'_", ",_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "[_", "0_", "]_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geom_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "geom", "\\u\\u", "eq", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "geom_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wkt_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "geom", "\\u\\u", "eq", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geom_", "=_", "GEO", "SG", "eom", "etry", "_", "(_", "wkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "can", "'", "t", " ", "get", " ", "a", " ", "poly", ",", " ", "try", " ", "a", " ", "linest", "ring_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "GEO", "SE", "xcept", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wkt_", "=_", "request_", "._", "REQUEST_", "[_", "'", "geom", "\\u\\u", "eq", "'_", "]_", "._", "replace_", "(_", "'", "POLYGON", "'_", ",_", "'", "LINES", "TRING", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wkt_", "=_", "wkt_", "._", "replace_", "(_", "'((", "'_", ",_", "'('_", ")_", "._", "replace_", "(_", "'))", "'_", ",_", "')'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "geom_", "=_", "GEO", "SG", "eom", "etry", "_", "(_", "wkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "GEO", "SE", "xcept", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "line", " ", "doe", "sn", "'", "t", " ", "work", ",", " ", "just", " ", "don", "'", "t", " ", "return", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "geom_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Selecti", "on", " ", "is", " ", "the", " ", "geo", "unit", "s", " ", "tha", "t", " ", "intersect", "s", " ", "with", " ", "the", " ", "drawing", " ", "tool", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eit", "her", " ", "a", " ", "lass", "o", ",", " ", "a", " ", "rectangle", ",", " ", "or", " ", "a", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "selection_", "=_", "Q_", "(_", "geom", "\\u\\u", "intersect", "s_", "=_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "uni", "on", " ", "of", " ", "lock", "ed", " ", "geometries", "_", "\\u\\u\\uNL\\u\\u\\u_", "district", "s_", "=_", "[_", "d_", "._", "id_", "for_", "d_", "in_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "version_", ",_", "include", "\\u", "geom_", "=_", "True_", ")_", "if_", "d_", "._", "is", "\\u", "locked_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locked_", "=_", "Distr", "ict_", "._", "objects_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "district", "s_", ")_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "simplified", " ", "lock", "ed", " ", "bound", "ary", " ", "for", " ", "fast", ",", " ", "but", " ", "not", " ", "complete", "ly", " ", "accurate", " ", "lookups", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "the", " ", "preserve", " ", "topo", "log", "y", " ", "parameter", " ", "of", " ", "simplify", " ", "is", " ", "need", "ed", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "lock", "ed", "\\u", "buffered", "_", "=_", "locked_", "._", "simplify_", "(_", "100_", ",_", "True_", ")_", "._", "buffer_", "(_", "100_", ")_", "if_", "locked_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Filter", " ", "first", " ", "by", " ", "geo", "level", ",", " ", "then", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "filtered_", "=_", "Geo", "level_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "geo", "level_", ")_", "._", "geo", "unit", "\\u", "set_", "._", "filter_", "(_", "selection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assemble", " ", "the", " ", "matchi", "ng", " ", "features", " ", "int", "o", " ", "geojson_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "feature_", "in_", "filtered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "to", " ", "allow", " ", "for", " ", "the", " ", "selection", " ", "of", " ", "a", " ", "geom", "etry", " ", "tha", "t", " ", "is", " ", "partial", "ly", " ", "split_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "a", " ", "lock", "ed", " ", "district", ",", " ", "so", " ", "subtract", " ", "out", " ", "all", " ", "section", "s", " ", "tha", "t", " ", "are", " ", "locked_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geom_", "=_", "feature_", "._", "simple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "perform", " ", "addition", "al", " ", "tests", " ", "if", " ", "the", " ", "fast", ",", " ", "inn", "acu", "rate", " ", "look", "up", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "locked_", "and_", "geom_", "._", "intersect", "s_", "(_", "lock", "ed", "\\u", "buffered", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "geom", "etry", " ", "is", " ", "full", "y", " ", "lock", "ed", ",", " ", "don", "'", "t", " ", "add", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "feature_", "._", "geom_", "._", "within", "_", "(_", "locked_", ")_", ":_", "\\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_", "#", " ", "Overlap", "ping", " ", "geometries", " ", "are", " ", "the", " ", "ones", " ", "we", " ", "need", " ", "to", " ", "subtract", " ", "piece", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "feature_", "._", "geom_", "._", "overlaps_", "(_", "locked_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "this", " ", "is", " ", "just", " ", "for", " ", "display", ",", " ", "do", " ", "the", " ", "difference", " ", "on", " ", "the", " ", "simplified", " ", "geometries", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "geom_", "=_", "geom_", "._", "difference_", "(_", "lock", "ed", "\\u", "buffered", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Open", "Layer", "s", " ", "breaks", " ", "whe", "n", " ", "the", " ", "id", " ", "is", " ", "set", " ", "to", " ", "an", " ", "integ", "er", ",", " ", "or", " ", "even", " ", "an", " ", "integ", "er", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "id", " ", "ends", " ", "up", " ", "bei", "ng", " ", "treat", "ed", " ", "as", " ", "an", " ", "array", " ", "index", ",", " ", "rat", "her", " ", "than", " ", "a", " ", "property", " ", "list", " ", "key", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "are", " ", "some", " ", "biz", "arr", "e", " ", "consequ", "ences", ".", " ", "Tha", "t", "'", "s", " ", "wh", "y", " ", "the", " ", "underscore", " ", "is", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'\\u", "%", "d", "'_", "%_", "feature_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geom", "etry", "'_", ":_", "json_", "._", "loads_", "(_", "geom_", "._", "json_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "feature_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geo", "level", "\\u", "id", "'_", ":_", "geo", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "feature_", "._", "id_", "\\u\\u\\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_", "status_", "[_", "'", "features", "'_", "]_", "=_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\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 ", " _", "status_", "[_", "'", "features", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Geometr", "y", " ", "is", " ", "require", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "features", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Inva", "lid", " ", "plan", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "statistics_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", "n", "'", "t", " ", "get", " ", "geogr", "aph", "y", " ", "info", " ", "from", " ", "the", " ", "server", ".", " ", "No", " ", "plan", " ", "with", " ", "the", " ", "give", "n", " ", "id", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ",_", "status_", "=_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\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 ", " _", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "version", "'_", "]_", ")_", "\\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 ", " _", "version_", "=_", "plan_", "._", "version_", "\\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 ", " _", "version_", "=_", "plan_", "._", "version_", "\\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 ", " _", "display_", "=_", "Score", "Display_", "._", "objects_", "._", "get_", "(_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ",_", "name_", "=_", "\"%", "s", "\\u", "sidebar", "\\u", "demo", "\"_", "%_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Una", "ble", " ", "to", " ", "get", " ", "Demo", "graphic", "s", " ", "Score", "Display", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "display", "Id", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\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 ", " _", "display_", "=_", "Score", "Display_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "request_", "._", "POST_", "[_", "'", "display", "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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Una", "ble", " ", "to", " ", "get", " ", "Persona", "lize", "d", " ", "Score", "Display", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "No", " ", "display", "Id", " ", "in", " ", "request", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "str_", "(_", "request_", "._", "POST_", ")_", ")_", "\\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 ", " _", "html_", "=_", "display_", "._", "render_", "(_", "plan_", ",_", "request_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "html_", ",_", "mimetype_", "=_", "'", "text", "/", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "render", " ", "display", " ", "tab", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "render", " ", "display", " ", "tab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ",_", "status_", "=_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "getu", "tc_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "datetime", " ", "object", ",", " ", "translat", "e", " ", "to", " ", "a", " ", "datetime", " ", "object", " ", "for", " ", "UT", "C", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "tuple_", "=_", "t_", "._", "timetuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "seconds_", "=_", "time_", "._", "mktime_", "(_", "t", "\\u", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "t_", "._", "utc", "fromtimestamp_", "(_", "t", "\\u", "seconds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "getd", "istr", "ict", "filest", "atus", "_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "plan", " ", "id", ",", " ", "return", " ", "the", " ", "status", " ", "of", " ", "the", " ", "district", " ", "index", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\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 ", " _", "is", "\\u", "shape_", "=_", "'", "type", "'_", "in_", "request_", "._", "REQUEST_", "and_", "request_", "._", "REQUEST_", "[_", "'", "type", "'_", "]_", "==_", "'", "shape", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "status_", "=_", "Distr", "ict", "File_", "._", "get", "\\u", "file", "\\u", "status_", "(_", "plan_", ",_", "shape_", "=_", "is", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "status", "'_", "]_", "=_", "file", "\\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 ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Fail", "ed", " ", "to", " ", "get", " ", "file", " ", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "getd", "istr", "ict", "file_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "plan", " ", "id", ",", " ", "email", " ", "the", " ", "user", " ", "a", " ", "zipped", " ", "copy", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "district", " ", "index", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "district", "index", "file", " ", "and", " ", "create", " ", "a", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "shape_", "=_", "'", "type", "'_", "in_", "request_", "._", "REQUEST_", "and_", "request_", "._", "REQUEST_", "[_", "'", "type", "'_", "]_", "==_", "'", "shape", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "status_", "=_", "Distr", "ict", "File_", "._", "get", "\\u", "file", "\\u", "status_", "(_", "plan_", ",_", "shape_", "=_", "is", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "status_", "==_", "'", "don", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive_", "=_", "Distr", "ict", "Shape", "File_", "._", "plan", "2s", "hape_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive_", "=_", "Distr", "ict", "Index", "File_", "._", "plan", "2in", "dex_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "open_", "(_", "archive_", "._", "name_", ")_", "._", "read_", "(_", ")_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "zip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=\"", "%", "s", ".", "zip", "\"'_", "%_", "plan_", "._", "get", "\\u", "frie", "ndl", "y", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Put", " ", "in", " ", "a", " ", "celery", " ", "task", " ", "to", " ", "create", " ", "this", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Distr", "ict", "Shape", "File_", "._", "plan", "2s", "hape_", "._", "delay_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Distr", "ict", "Index", "File_", "._", "plan", "2in", "dex_", "._", "delay_", "(_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "Http", "Response_", "(_", "\\u_", "(_", "'", "File", " ", "is", " ", "not", " ", "ye", "t", " ", "read", "y", ".", " ", "Ple", "ase", " ", "try", " ", "again", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", " ", "few", " ", "minute", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "email", "district", "index", "file_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "plan", " ", "id", ",", " ", "email", " ", "a", " ", "zipped", " ", "copy", " ", "of", " ", "the", " ", "district", " ", "\\", "10", ";", " ", " ", " ", " ", "index", " ", "file", " ", "to", " ", "a", " ", "specified", " ", "address", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "in", " ", "a", " ", "celery", " ", "task", " ", "to", " ", "create", " ", "the", " ", "file", " ", "and", " ", "send", " ", "the", " ", "emails_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Distr", "ict", "Index", "File_", "._", "email", "file_", "._", "delay_", "(_", "plan_", ",_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ",_", "translation_", "._", "get", "\\u", "language_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\\u_", "(_", "'", "Task", " ", "submitted", "'_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getv", "alid", "plans", "_", "(_", "leg", "\\u", "body_", ",_", "owner_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "valid", " ", "plans", " ", "for", " ", "a", " ", "give", "n", " ", "legislat", "ive", " ", "body", " ", "and", " ", "owner", " ", "(", "option", "al", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pfi", "lter_", "=_", "Q_", "(_", "legislat", "ive", "\\u", "body_", "=_", "leg", "\\u", "body_", ")_", "&_", "Q_", "(_", "is", "\\u", "valid_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "owner_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pfi", "lter_", "=_", "pfi", "lter_", "&_", "Q_", "(_", "owner_", "=_", "owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "Plan_", "._", "objects_", "._", "filter_", "(_", "pfi", "lter_", ")_", ")_", "\\u\\u\\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_", "getl", "eader", "board", "display_", "(_", "leg", "\\u", "body_", ",_", "owner", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "leader", "board", " ", "Score", "Display", " ", "give", "n", " ", "a", " ", "legislat", "ive", " ", "body", " ", "and", " ", "owner", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Score", "Display_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "\"%", "s", "\\u", "leader", "\\u", "%", "s", "\"_", "%_", "(_", "leg", "\\u", "body_", "._", "name_", ",_", "owner", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "getl", "eader", "board_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "render", "ed", " ", "leader", "board", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "owner", "\\u", "filter_", "=_", "request_", "._", "REQUEST_", "[_", "'", "owner", "\\u", "filter", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "pk_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "legislat", "ive", "\\u", "body", "'_", "]_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leg", "\\u", "body_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "body", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "display_", "=_", "getl", "eader", "board", "display_", "(_", "leg", "\\u", "body_", ",_", "owner", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\\u_", "(_", "'", "No", " ", "display", " ", "configur", "ed", "'_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plans", "_", "=_", "getv", "alid", "plans", "_", "(_", "leg", "\\u", "body_", ",_", "request_", "._", "user_", "if_", "owner", "\\u", "filter_", "==_", "'", "mine", "'_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "=_", "display_", "._", "render_", "(_", "plans", "_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "html_", ",_", "mimetype_", "=_", "'", "text", "/", "html", ";", " ", "charset", "=", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "'", "Leader", "board", " ", "coul", "d", " ", "not", " ", "be", " ", "fetched", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "str_", "(_", "ex_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getl", "eader", "board", "csv_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "leader", "board", " ", "score", "s", " ", "in", " ", "csv", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "owner", "\\u", "filter_", "=_", "request_", "._", "REQUEST_", "[_", "'", "owner", "\\u", "filter", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "pk_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "legislat", "ive", "\\u", "body", "'_", "]_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leg", "\\u", "body_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "body", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plans", "_", "=_", "getv", "alid", "plans", "_", "(_", "leg", "\\u", "body_", ",_", "request_", "._", "user_", "if_", "owner", "\\u", "filter_", "==_", "'", "mine", "'_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "display_", "=_", "getl", "eader", "board", "display_", "(_", "leg", "\\u", "body_", ",_", "owner", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plans", "_", "=_", "getv", "alid", "plans", "_", "(_", "leg", "\\u", "body_", ",_", "request_", "._", "user_", "if_", "owner", "\\u", "filter_", "==_", "'", "mine", "'_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "panels_", "=_", "display_", "._", "score", "panel", "\\u", "set_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "position", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mark", " ", "the", " ", "response", " ", "as", " ", "csv", ",", " ", "and", " ", "create", " ", "the", " ", "csv", " ", "writer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Http", "Response_", "(_", "mimetype_", "=_", "'", "text", "/", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", "]_", "=_", "'", "attach", "ment", ";", " ", "filename", "=", "leader", "board", "\\u", "score", "s", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "=_", "csv_", "._", "writer_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "'", "Plan", " ", "ID", "'_", ",_", "'", "Plan", " ", "Name", "'_", ",_", "'", "User", " ", "Name", "'_", "]_", "+_", "[_", "p_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", "for_", "p_", "in_", "panels_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "row", " ", "for", " ", "each", " ", "plan_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "plan_", "in_", "plans", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "plan_", "._", "id_", ",_", "plan_", "._", "name_", ",_", "plan_", "._", "owner_", "._", "username_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "each", " ", "score_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "panel_", "in_", "panels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "=_", "panel_", "._", "score", "\\u", "functions_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "Computed", "Plan", "Score_", "._", "compute_", "(_", "function_", ",_", "plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "._", "append_", "(_", "score_", "[_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "the", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "generat", "e", " ", "CSV", " ", "of", " ", "leader", "board", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "str_", "(_", "ex_", ")_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getp", "lan", "s_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "plans", " ", "for", " ", "the", " ", "give", "n", " ", "user", " ", "and", " ", "return", " ", "the", " ", "data", " ", "in", " ", "a", " ", "format", " ", "reada", "ble", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "jq", "grid", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rows", "'_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sid", "x_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "sid", "x", "'_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sor", "d_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "sor", "d", "'_", ",_", "'", "asc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "owner", "\\u", "filter_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "owner", "\\u", "filter", "'_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "pk_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "legislat", "ive", "\\u", "body", "'_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "pk_", "=_", "int_", "(_", "body", "\\u", "pk_", ")_", "if_", "body", "\\u", "pk_", "else_", "body", "\\u", "pk_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'\\u", "search", "'_", ",_", "False_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "string_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "search", "String", "'_", ",_", "''_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "community_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "is", "\\u", "communi", "ty", "'_", ",_", "False_", ")_", "==_", "'", "true", "'_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end_", "=_", "page_", "*_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "end_", "-_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "owner", "\\u", "filter_", "==_", "'", "template", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "available_", "=_", "Q_", "(_", "is", "\\u", "template_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "owner", "\\u", "filter_", "==_", "'", "shared", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "available_", "=_", "Q_", "(_", "is", "\\u", "shared_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "owner", "\\u", "filter_", "==_", "'", "mine", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "available_", "=_", "Q_", "(_", "owner", "\\u\\u", "exact_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "owner", "\\u", "filter_", "==_", "'", "all", "\\u", "avail", "able", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "available_", "=_", "Q_", "(_", "is", "\\u", "template_", "=_", "True_", ")_", "|_", "Q_", "(_", "is", "\\u", "shared_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "anonymous_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "available_", "=_", "available_", "|_", "Q_", "(_", "owner", "\\u\\u", "exact_", "=_", "request_", "._", "user_", ")_", "\\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_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", "\\u_", "(_", "\"", "Un", "know", "n", " ", "filter", " ", "method", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "not", "\\u", "creati", "ng_", "=_", "~_", "Q_", "(_", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "CREATI", "NG_", ")_", "&_", "~_", "Q_", "(_", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "UNKNOWN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "the", " ", "order", "\\u", "by", " ", "parameter", " ", "from", " ", "sid", "x", " ", "and", " ", "sor", "d", " ", "in", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sid", "x_", "._", "startswith_", "(_", "'", "fields", ".'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "sid", "x_", "[_", "len_", "(_", "'", "fields", ".'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sid", "x_", "==_", "'", "owner", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "'", "owner", "\\u\\u", "user", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sid", "x_", "==_", "'", "plan", "\\u", "type", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "'", "legislat", "ive", "\\u", "body", "\\u\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sor", "d_", "==_", "'", "desc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sid", "x_", "=_", "'-'_", "+_", "sid", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "search_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "filter_", "=_", "Q_", "(_", "name", "\\u\\u", "icontains_", "=_", "search", "\\u", "string_", ")_", "|_", "Q_", "(_", "description", "\\u\\u", "icontains_", "=_", "search", "\\u", "string_", ")_", "|_", "Q_", "(_", "owner", "\\u\\u", "user", "name", "\\u\\u", "icontains_", "=_", "search", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "filter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "body", "\\u", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "filter_", "=_", "Q_", "(_", "legislat", "ive", "\\u", "body_", "=_", "body", "\\u", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "plans", "_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "available_", ",_", "not", "\\u", "creati", "ng_", ",_", "body", "\\u", "filter_", ",_", "search", "\\u", "filter_", ")_", "._", "order", "\\u", "by_", "(_", "sid", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "communi", "ty", "\\u", "filter_", "=_", "Q_", "(_", "legislat", "ive", "\\u", "body", "\\u\\u", "is", "\\u", "community_", "=_", "is", "\\u", "community_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "plans", "_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "available_", ",_", "not", "\\u", "creati", "ng_", ",_", "search", "\\u", "filter_", ",_", "communi", "ty", "\\u", "filter_", ")_", "._", "order", "\\u", "by_", "(_", "sid", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "all", "\\u", "plans", "_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "pages_", "=_", "math_", "._", "ceil_", "(_", "all", "\\u", "plans", "_", "._", "count_", "(_", ")_", "/_", "float_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "pages_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plans", "_", "=_", "all", "\\u", "plans", "_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "object", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "serialize", "d", " ", "for", " ", "presentation", " ", "in", " ", "the", " ", "plan", " ", "chooser_", "\\u\\u\\uNL\\u\\u\\u_", "plans", "\\u", "list_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "plan_", "in_", "plans", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plans", "\\u", "list_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "plan_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "plan_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "plan_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "edited", "'_", ":_", "time_", "._", "mktime_", "(_", "plan_", "._", "edited", "_", "._", "timetuple_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "template", "'_", ":_", "plan_", "._", "is", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "shared", "'_", ":_", "plan_", "._", "is", "\\u", "shared_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "plan_", "._", "owner_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "district", "Count", "'_", ":_", "'--'_", ",_", "#", " ", "load", " ", "dynami", "call", "y", " ", "--", " ", "this", " ", "is", " ", "a", " ", "big", " ", "perform", "anc", "e", " ", "hit_", "\\u\\u\\uNL\\u\\u\\u_", "'", "can", "\\u", "edit", "'_", ":_", "can", "\\u", "edit_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plan", "\\u", "type", "'_", ":_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "long", "\\u", "description_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "process", "ing", "\\u", "state", "'_", ":_", "plan_", "._", "get", "\\u", "process", "ing", "\\u", "state", "\\u", "display_", "(_", ")_", "\\u\\u\\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_", "json", "\\u", "response_", "=_", "\"{", " ", "\\\\\"", "total", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "page", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "record", "s", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "rows", "\\\\\":", "%", "s", " ", "}\"_", "%_", "(_", "total", "\\u", "pages_", ",_", "page_", ",_", "len_", "(_", "all", "\\u", "plans", "_", ")_", ",_", "json_", "._", "dumps_", "(_", "plans", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json", "\\u", "response_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "shared", "\\u", "district", "s_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "shared", " ", "district", "s", " ", "in", " ", "a", " ", "give", "n", " ", "plan", " ", "and", " ", "return", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "in", " ", "a", " ", "format", " ", "reada", "ble", " ", "by", " ", "the", " ", "jq", "grid", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "usi", "ng", "\\u", "unique", "\\u", "session_", "(_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "'", "rows", "'_", ",_", "10_", ")_", ")_", "\\u\\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_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end_", "=_", "page_", "*_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "end_", "-_", "rows_", "\\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 ", " _", "plan_", "=_", "Plan_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "can", "\\u", "copy_", "(_", "request_", "._", "user_", ",_", "plan_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Forbidden_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "district", "s_", "=_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "plan_", "._", "version_", ",_", "include", "\\u", "geom_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "district", "s_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "all", "\\u", "district", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "pages_", "=_", "math_", "._", "ceil_", "(_", "len_", "(_", "all", "\\u", "district", "s_", ")_", "/_", "float_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "pages_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "s_", "=_", "all", "\\u", "district", "s_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "object", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "serialize", "d", " ", "for", " ", "presentation", " ", "in", " ", "the", " ", "plan", " ", "chooser_", "\\u\\u\\uNL\\u\\u\\u_", "district", "s", "\\u", "list_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "district_", "._", "is", "\\u", "unassign", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "s", "\\u", "list_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "district_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "short", "\\u", "label", "'_", ":_", "district_", "._", "short", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "long", "\\u", "label", "'_", ":_", "district_", "._", "long", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "district", "\\u", "id", "'_", ":_", "district_", "._", "district", "\\u", "id_", ",_", "\\u\\u\\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_", "json", "\\u", "response_", "=_", "\"{", " ", "\\\\\"", "total", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "page", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "record", "s", "\\\\\":", "\\\\\"", "%", "d", "\\\\\",", " ", "\\\\\"", "rows", "\\\\\":", "%", "s", " ", "}\"_", "%_", "(_", "total", "\\u", "pages_", ",_", "page_", ",_", "len_", "(_", "all", "\\u", "district", "s_", ")_", ",_", "json_", "._", "dumps_", "(_", "district", "s", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json", "\\u", "response_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "edit", "plan", "attributes_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Edit", " ", "the", " ", "attribute", "s", " ", "of", " ", "a", " ", "plan", ".", " ", "Attribute", "s", " ", "of", " ", "a", " ", "plan", " ", "are", " ", "the", " ", "name", " ", "and", "/", "or", "\\", "10", ";", " ", " ", " ", " ", "description", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Not", "Allowed_", "(_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "name_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "description_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "description", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "plan", "id_", "or_", "not_", "(_", "new", "\\u", "name_", "or_", "new", "\\u", "description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Mus", "t", " ", "declar", "e", " ", "plan", "Id", ",", " ", "name", " ", "and", " ", "description", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "new", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "._", "name_", "=_", "new", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "._", "description_", "=_", "new", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Update", "d", " ", "plan", " ", "attribute", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Fail", "ed", " ", "to", " ", "save", " ", "the", " ", "change", "s", " ", "to", " ", "your", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "save", " ", "change", "s", " ", "to", " ", "plan", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\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_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cann", "ot", " ", "edit", " ", "a", " ", "plan", " ", "you", " ", "don", "'", "t", " ", "own", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "plan_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "a", " ", "plan", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Not", "Allowed_", "(_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "plan", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", "\\u_", "(_", "'", "Mus", "t", " ", "declar", "e", " ", "plan", "Id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Delete", "d", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Fail", "ed", " ", "to", " ", "delete", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "delete", " ", "plan", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\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_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cann", "ot", " ", "delete", " ", "a", " ", "plan", " ", "you", " ", "don", "'", "t", " ", "own", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rea", "gg", "rega", "tep", "lan", "_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rea", "gg", "rega", "te", " ", "a", " ", "plan", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note", "\\u", "session", "\\u", "activity_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "!=_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Not", "Allowed_", "(_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "plan", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", "\\u_", "(_", "'", "Mus", "t", " ", "declar", "e", " ", "plan", "Id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "pk_", "=_", "plan", "id_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rea", "gg", "rega", "te", "\\u", "plan_", "._", "delay_", "(_", "plan_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "rea", "gg", "rega", "ting", " ", "flag_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "need", "ed", " ", "for", " ", "the", " ", "state", " ", "to", " ", "display", " ", "on", " ", "immediate", " ", "refre", "sh", ")_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "._", "process", "ing", "\\u", "state_", "=_", "Process", "ing", "State_", "._", "REA", "GG", "REG", "ATI", "NG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Rea", "gg", "rega", "ting", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Fail", "ed", " ", "to", " ", "rea", "gg", "rega", "te", " ", "plan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "exception", "'_", "]_", "=_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Cou", "ld", " ", "not", " ", "rea", "gg", "rega", "te", " ", "plan", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\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_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cann", "ot", " ", "rea", "gg", "rega", "te", " ", "a", " ", "plan", " ", "you", " ", "don", "'", "t", " ", "own", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "health_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "num", "\\u", "users_", "(_", "minutes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "session_", "in_", "Session_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\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 ", " _", "decoded_", "=_", "session_", "._", "get", "\\u", "decoded_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "There", "'", "s", " ", "a", " ", "problem", " ", "with", " ", "this", " ", "session", ",", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "delete_", "(_", ")_", "\\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_", "if_", "'", "activit", "y", "\\u", "time", "'_", "in_", "decoded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "activit", "y", "\\u", "delta_", "=_", "decoded_", "[_", "'", "activit", "y", "\\u", "time", "'_", "]_", "-_", "timedelta_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "settings_", "._", "SES", "SION", "\\u", "TIMEOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "activit", "y", "\\u", "delta_", ">_", "(_", "datetime_", "._", "now_", "(_", ")_", "-_", "timedelta_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "minutes_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "users_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "users_", "\\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 ", " _", "result_", "=_", "\\u_", "(_", "'", "Health", " ", "retrieved", " ", "at", " ", "%", "(", "time", ")", "s", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "time", "'_", ":_", "datetime_", "._", "now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "\\u_", "(_", "'%", "(", "plan", "\\u", "count", ")", "d", " ", "plans", " ", "in", " ", "databa", "se", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "plan", "\\u", "count", "'_", ":_", "Plan_", "._", "objects_", "._", "all_", "(_", ")_", "._", "count_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "\\u_", "(_", "'%", "(", "session", "\\u", "count", ")", "d", " ", "session", "s", " ", "in", " ", "use", " ", "out", " ", "of", " ", "%", "(", "session", "\\u", "limit", ")", "s", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "session", "\\u", "count", "'_", ":_", "Session_", "._", "objects_", "._", "all_", "(_", ")_", "._", "count_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "limit", "'_", ":_", "settings_", "._", "CONC", "URRE", "NT", "\\u", "SES", "SION", "S_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "\\u_", "(_", "'%", "(", "num", "\\u", "users", ")", "d", " ", "active", " ", "users", " ", "over", " ", "the", " ", "last", " ", "10", " ", "minute", "s", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "num", "\\u", "users", "'_", ":_", "num", "\\u", "users_", "(_", "10_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "=_", "os_", "._", "stat", "vfs_", "(_", "'/", "project", "s", "/", "Public", "Map", "ping", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "\\u_", "(_", "'%", "(", "mb", "\\u", "free", ")", "s", " ", "MB", " ", "of", " ", "disk", " ", "space", " ", "free", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "mb", "\\u", "free", "'_", ":_", "(_", "(_", "space_", "._", "f", "\\u", "bsi", "ze_", "*_", "space_", "._", "f", "\\u", "ba", "vail", "_", ")_", "/_", "(_", "1024_", "*_", "1024_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "+=_", "\\u_", "(_", "'", "Memo", "ry", " ", "Us", "age", ":\\\\", "n", "%", "(", "mem", "\\u", "free", ")", "s", "\\\\", "n", "'_", ")_", "%_", "{_", "'", "mem", "\\u", "free", "'_", ":_", "commands_", "._", "getoutput_", "(_", "'", "free", " ", "-", "m", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "result_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\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_", "Http", "Response_", "(_", "\\u_", "(_", "\"", "ERROR", "!", " ", "Cou", "ld", "n", "'", "t", " ", "get", " ", "health", ":\\\\", "n", "%", "s", "\"_", ")_", "%_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "statistic", "s", "\\u", "sets_", "(_", "request_", ",_", "plan", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "tha", "t", " ", "ID", " ", "exist", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "result_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "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 ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score", "functions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "function", "s", " ", "avail", "able", " ", "for", " ", "the", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "functions_", "=_", "Score", "Function_", "._", "objects_", "._", "filter_", "(_", "selectable", "\\u", "bodies_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "user", "\\u", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "report", "'_", "not_", "in_", "f_", "._", "name_", "._", "lower_", "(_", ")_", "and_", "'", "comment", "s", "'_", "not_", "in_", "f_", "._", "name_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score", "functions_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "f_", "._", "id_", ",_", "'", "name", "'_", ":_", "force", "\\u", "escape_", "(_", "f_", "._", "get", "\\u", "label_", "(_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "function", "s", "'_", "]_", "=_", "score", "functions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "display", "\\u", "names_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "\\u", "sidebar", "\\u", "demo", "\"_", "%_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "is", "\\u", "community_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "\\u", "display", "\\u", "names_", "._", "append_", "(_", "\"%", "s", "\\u", "sidebar", "\\u", "comment", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "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 ", " _", "admin", "\\u", "display", "\\u", "names_", "._", "append_", "(_", "\"%", "s", "\\u", "sidebar", "\\u", "basic", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "._", "legislat", "ive", "\\u", "body_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "admin", " ", "display", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin", "\\u", "display", "s_", "=_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "owner", "\\u\\u", "is", "\\u", "superuser_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "\\u\\u", "in_", "=_", "admin", "\\u", "display", "\\u", "names_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "admin", "\\u", "display_", "in_", "admin", "\\u", "display", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sets_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "admin", "\\u", "display_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "force", "\\u", "escape_", "(_", "admin", "\\u", "display_", "._", "get", "\\u", "label_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mine", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "display", "s_", "=_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "page_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "display", "s", "\\u", "count", "'_", "]_", "=_", "len_", "(_", "user", "\\u", "display", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "display_", "in_", "user", "\\u", "display", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "functions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "panel_", "in_", "display_", "._", "score", "panel", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "panel_", "._", "type_", "==_", "'", "district", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "functions_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "._", "id_", ",_", "panel_", "._", "score", "\\u", "functions_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "functions_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "No", " ", "function", "s", " ", "for", " ", "%", "(", "panel", ")", "s", "\"_", ")_", "%_", "{_", "'", "panel", "\\u", "name", "'_", ":_", "panel_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sets_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "display_", "._", "id_", ",_", "'", "name", "'_", ":_", "force", "\\u", "escape_", "(_", "display_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", ")_", ",_", "'", "function", "s", "'_", ":_", "functions_", ",_", "'", "mine", "'_", ":_", "display_", "._", "owner_", "==_", "request_", "._", "user_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "user", " ", "display", "s", " ", "for", " ", "%", "(", "user", ")", "s", "'_", ")_", "%_", "{_", "'", "user", "'_", ":_", "request_", "._", "user_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "'", "Error", " ", "fetch", "ing", " ", "Score", "Display", "s", " ", "for", " ", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "sets", "'_", "]_", "=_", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "the", " ", "request", "ed", " ", "Score", "Display", " ", "to", " ", "make", " ", "some", " ", "room_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", "and_", "'", "delete", "'_", "in_", "request_", "._", "POST_", ":_", "\\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 ", " _", "display_", "=_", "Score", "Display_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "id", "'_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "set", "'_", "]_", "=_", "{_", "'", "name", "'_", ":_", "force", "\\u", "escape_", "(_", "display_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", ")_", ",_", "'", "id", "'_", ":_", "display_", "._", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qse", "t_", "=_", "display_", "._", "score", "panel", "\\u", "set_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "panel_", "in_", "qse", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "panel_", "._", "display", "s_", "._", "count_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "panel_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "display_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "delete", " ", "personali", "zed", " ", "scored", "isp", "lay", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "exception", "'_", "]_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warn_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "delete", " ", "personali", "zed", " ", "Score", "Display", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Rea", "son", ":", " ", "%", "s", "'_", ",_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", "'", "s", " ", "a", " ", "post", ",", " ", "edit", " ", "or", " ", "create", " ", "the", " ", "Score", "Display", " ", "and", " ", "return", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "id", " ", "and", " ", "name", " ", "as", " ", "usual", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", "'", "re", " ", "addin", "g", " ", "a", " ", "new", " ", "display", ",", " ", "we", " ", "shou", "ld", " ", "make", " ", "sure", " ", "the", "y", " ", "only", " ", "have", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "validat", "e\\u", "num_", "(_", "user_", ",_", "limit_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "owner_", "=_", "user_", ",_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ",_", "is", "\\u", "page_", "=_", "False_", ")_", "._", "count_", "(_", ")_", "<_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "function", "s", "[]'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "functions_", "=_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "function", "s", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "functions_", "=_", "map_", "(_", "lambda_", "x_", ":_", "int_", "(_", "x_", ")_", ",_", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display_", "=_", "Score", "Display_", "._", "objects_", "._", "get_", "(_", "title_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "owner_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "display_", "._", "copy", "\\u", "from_", "(_", "display_", "=_", "display_", ",_", "functions_", "=_", "functions_", ")_", "\\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 ", " _", "limit_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "validat", "e\\u", "num_", "(_", "request_", "._", "user_", ",_", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "demo_", "=_", "Score", "Display_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "owner", "\\u\\u", "is", "\\u", "superuser_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "plan_", "._", "legislat", "ive", "\\u", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "page_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "\"", "Demo", "graphic", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "select", " ", "the", " ", "Score", "Display", " ", "tha", "t", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "comment", " ", "calculator_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "disp_", "in_", "demo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "has", "\\u", "comments_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pnl_", "in_", "disp_", "._", "score", "panel", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "fn_", "in_", "pnl_", "._", "score", "\\u", "functions_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "has", "\\u", "comments_", "=_", "has", "\\u", "comments_", "or_", "fn_", "._", "calculator_", "._", "endswith_", "(_", "'.", "Comme", "nts", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "has", "\\u", "comments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "demo_", "=_", "disp_", "\\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_", "display_", "=_", "Score", "Display_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "display_", "._", "copy", "\\u", "from_", "(_", "display_", "=_", "demo_", ",_", "title_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "owner_", "=_", "request_", "._", "user_", ",_", "functions_", "=_", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "new", "Record", "'_", "]_", "=_", "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 ", " ", "_", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "Ea", "ch", " ", "user", " ", "is", " ", "limited", " ", "to", " ", "%", "(", "limit", ")", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "statistic", "s", " ", "sets", ".", " ", "Ple", "ase", " ", "delete", " ", "one", " ", "or", " ", "edit", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "an", " ", "exist", "ing", " ", "set", ".'_", ")_", "%_", "{_", "'", "limit", "'_", ":_", "limit_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "error", "'_", "]_", "=_", "'", "limit", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "result_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "set", "'_", "]_", "=_", "{_", "'", "name", "'_", ":_", "force", "\\u", "escape_", "(_", "display_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", ")_", ",_", "'", "id", "'_", ":_", "display_", "._", "id_", ",_", "'", "function", "s", "'_", ":_", "functions_", ",_", "'", "mine", "'_", ":_", "display_", "._", "owner_", "==_", "request_", "._", "user_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "\"", "Di", "dn", "'", "t", " ", "get", " ", "function", "s", " ", "in", " ", "POST", " ", "parameter", "\"_", ")_", "\\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_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "result_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pur", "ge", "\\u", "plan", "\\u", "clear", "\\u", "cache_", "(_", "district_", ",_", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "help", "er", " ", "method", " ", "tha", "t", " ", "pur", "ges", " ", "a", " ", "plan", " ", "after", " ", "a", " ", "version", ",", " ", "and", " ", "clear", "s", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "pre", "-", "compute", "d", " ", "score", "s", " ", "at", " ", "the", " ", "specified", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "plan_", "._", "purge_", "(_", "after_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "district_", "._", "plan_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "plan_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "district_", "._", "compute", "ddi", "strict", "score", "\\u", "set_", "._", "filter_", "(_", "function", "\\u\\u", "calculator", "\\u\\u", "endswith_", "=_", "'.", "Comme", "nts", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unique", "\\u", "session", "\\u", "or", "\\u", "json", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "district", "\\u", "info_", "(_", "request_", ",_", "plan", "id_", ",_", "district", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "comment", "s", " ", "tha", "t", " ", "are", " ", "attache", "d", " ", "to", " ", "a", " ", "district", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", " ", "--", " ", "An", " ", "Http", "Request", "\\", "10", ";", " ", " ", " ", " ", "plan", "id", " ", "--", " ", "The", " ", "plan", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", "district", "\\u", "id", " ", "--", " ", "The", " ", "district", " ", "ID", ",", " ", "this", " ", "is", " ", "the", " ", "district", " ", "number", " ", "in", " ", "a", " ", "plan", ",", " ", "and", " ", "NOT", " ", "the", " ", "id", " ", "of", " ", "a", " ", "district", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "{_", "'", "success", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plan_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "id_", "=_", "plan", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plan_", "._", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "[_", "'", "message", "'_", "]_", "=_", "\\u_", "(_", "'", "No", " ", "plan", " ", "with", " ", "tha", "t", " ", "ID", " ", "was", " ", "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 ", " _", "plan_", "=_", "plan_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "request_", "._", "REQUEST_", ":_", "\\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 ", " _", "version_", "=_", "int_", "(_", "request_", "._", "REQUEST_", "[_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "min_", "(_", "plan_", "._", "version_", ",_", "int_", "(_", "version_", ")_", ")_", "\\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_", "district", "\\u", "id_", "=_", "int_", "(_", "district", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "plan_", "._", "get", "\\u", "district", "s", "\\u", "at", "\\u", "version_", "(_", "version_", ",_", "include", "\\u", "geom_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "filter_", "(_", "lambda_", "d_", ":_", "d_", "._", "district", "\\u", "id_", "==_", "district", "\\u", "id_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district_", "=_", "plan_", "._", "district", "\\u", "set_", "._", "get_", "(_", "id_", "=_", "request_", "._", "POST_", "[_", "'", "object\\u", "pk", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "short", "\\u", "label_", "=_", "request_", "._", "POST_", "[_", "'", "district", "\\u", "short", "'_", "]_", "[_", "0_", ":_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "._", "long", "\\u", "label_", "=_", "request_", "._", "POST_", "[_", "'", "district", "\\u", "long", "'_", "]_", "[_", "0_", ":_", "256_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "district_", "._", "version_", "<_", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "district", " ", "version", " ", "may", " ", "lag", " ", "beh", "ind", " ", "the", " ", "cursor", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", "if", " ", "there", " ", "wer", "e", " ", "no", " ", "edits", " ", "for", " ", "a", " ", "whi", "le", ".", " ", "If", " ", "this", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "case", " ", "the", " ", "district", " ", "must", " ", "be", " ", "copie", "d", " ", "to", " ", "the", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "currentl", "y", " ", "edited", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "\\u", "copy_", "=_", "copy_", "._", "copy_", "(_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "\\u", "copy_", "._", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "\\u", "copy_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "district", "\\u", "copy_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clone", " ", "the", " ", "characteristics", ",", " ", "comment", "s", ",", " ", "and", " ", "tags", " ", "from", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "original", " ", "district", " ", "to", " ", "the", " ", "copy", " _", "\\u\\u\\uNL\\u\\u\\u_", "district", "\\u", "copy_", "._", "clone", "\\u", "relation", "s", "\\u", "from_", "(_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "district", "\\u", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "the", " ", "change", "s", " ", "to", " ", "the", " ", "district", " ", "--", " ", "may", "be", " ", "name", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "has", "\\u", "comment_", "=_", "'", "comment", "'_", "in_", "request_", "._", "POST_", "and_", "request_", "._", "POST_", "[_", "'", "comment", "'_", "]_", "!=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "comment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "thread", " ", "comment", "s", ",", " ", "keep", " ", "only", " ", "the", " ", "late", "st", " ", "and", " ", "great", "est_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "app", "\\u", "label_", "=_", "'", "redis", "tric", "ting", "'_", ",_", "model_", "=_", "'", "district", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Comment_", "._", "objects_", "._", "filter_", "(_", "object\\u", "pk_", "=_", "district_", "._", "id_", ",_", "content", "\\u", "type_", "=_", "ct_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "pk_", "=_", "district_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "ct_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site", "\\u", "id_", "=_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "name_", "=_", "request_", "._", "user_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "email_", "=_", "request_", "._", "user_", "._", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "request_", "._", "POST_", "[_", "'", "comment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "this", " ", "if", " ", "the", " ", "label", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tags", " ", "on", " ", "this", " ", "object", " ", "of", " ", "this", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tse", "t_", "=_", "Tag_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "object_", "(_", "district_", ")_", "._", "filter_", "(_", "name", "\\u\\u", "startswith_", "=_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Purg", "e", " ", "the", " ", "tags", " ", "of", " ", "this", " ", "same", " ", "type", " ", "off", " ", "the", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "Tagg", "ed", "Item_", "._", "objects_", "._", "filter_", "(_", "tag", "\\u\\u", "in_", "=_", "tse", "t_", ",_", "object\\u", "id_", "=_", "district_", "._", "id_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pur", "ge", "\\u", "plan", "\\u", "clear", "\\u", "cache_", "(_", "district_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "type", "[]'_", ")_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strt", "ags_", "=_", "request_", "._", "REQUEST_", "._", "getlist_", "(_", "'", "type", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "strt", "ag_", "in_", "strt", "ags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "strt", "ag_", "==_", "''_", ":_", "\\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_", "strt", "ag_", "._", "count_", "(_", "'", " ", "'_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "strt", "ag_", "=_", "'\"", "type", "=", "%", "s", "\"'_", "%_", "strt", "ag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "strt", "ag_", "=_", "'", "type", "=", "%", "s", "'_", "%_", "strt", "ag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Tag_", "._", "objects_", "._", "add", "\\u", "tag_", "(_", "district_", ",_", "strt", "ag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "[_", "'", "version", "'_", "]_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "[_", "'", "success", "'_", "]_", "=_", "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_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "status_", ")_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plan", "\\u", "feed_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "plan", "\\u", "feed", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "MAP", "\\u", "SERVER", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MAP", "\\u", "SERVER", "\\u", "NS", " ", "=", " ", "'", "pm", "p", "'_", "\\u\\u\\uNL\\u\\u\\u_", "plans", "_", "=_", "Plan_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "edited", "'_", ")_", "[_", "0_", ":_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo", "level_", "=_", "plans", "_", "[_", "0_", "]_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extent_", "=_", "geo", "level_", "._", "geo", "unit", "\\u", "set_", "._", "collect_", "(_", ")_", "._", "extent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ">_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wide", "r", " ", "maps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "int_", "(_", "500_", "*_", "(_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ")_", "/_", "(_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tall", "er", " ", "maps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "int_", "(_", "500_", "*_", "(_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ")_", "/_", "(_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maps", "erver_", "=_", "settings_", "._", "MAP", "\\u", "SERVER_", "if_", "settings_", "._", "MAP", "\\u", "SERVER_", "!=_", "''_", "else_", "request_", "._", "META_", "[_", "'", "SERVER", "\\u", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plans", "'_", ":_", "plans", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "'_", ":_", "maps", "erver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "\\u", "ns", "'_", ":_", "settings_", "._", "MAP", "\\u", "SERVER", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extent", "'_", ":_", "extent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widt", "h", "'_", ":_", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "'_", ":_", "height_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "feed_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "xml_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "atom", "+", "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_", "def_", "share", "\\u", "feed_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "'", "shared", "\\u", "feed", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "MAP", "\\u", "SERVER", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MAP", "\\u", "SERVER", "\\u", "NS", " ", "=", " ", "'", "pm", "p", "'_", "\\u\\u\\uNL\\u\\u\\u_", "plans", "_", "=_", "Plan_", "._", "objects_", "._", "filter_", "(_", "is", "\\u", "shared_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "edited", "'_", ")_", "[_", "0_", ":_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "plans", "_", "._", "count_", "(_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geo", "level_", "=_", "plans", "_", "[_", "0_", "]_", "._", "legislat", "ive", "\\u", "body_", "._", "get", "\\u", "geo", "levels_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extent_", "=_", "geo", "level_", "._", "geo", "unit", "\\u", "set_", "._", "collect_", "(_", ")_", "._", "extent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ">_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wide", "r", " ", "maps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "int_", "(_", "500_", "*_", "(_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ")_", "/_", "(_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "tall", "er", " ", "maps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "int_", "(_", "500_", "*_", "(_", "extent_", "[_", "2_", "]_", "-_", "extent_", "[_", "0_", "]_", ")_", "/_", "(_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "500_", "\\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 ", " _", "extent_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maps", "erver_", "=_", "settings_", "._", "MAP", "\\u", "SERVER_", "if_", "settings_", "._", "MAP", "\\u", "SERVER_", "!=_", "''_", "else_", "request_", "._", "META_", "[_", "'", "SERVER", "\\u", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plans", "'_", ":_", "plans", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "'_", ":_", "maps", "erver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "maps", "erver", "\\u", "ns", "'_", ":_", "settings_", "._", "MAP", "\\u", "SERVER", "\\u", "NS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extent", "'_", ":_", "extent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widt", "h", "'_", ":_", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "'_", ":_", "height_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "feed_", "._", "render_", "(_", "Dj", "ang", "o", "Context_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "xml_", ",_", "mimetype_", "=_", "'", "applica", "tion", "/", "atom", "+", "xml", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Non-standard exception raised in special method
Exa-Networks/exabgp/lib/exabgp/bgp/message/update/nlri/nlri.py
[ { "content": "\tdef __lt__ (self, other):\n\t\traise RuntimeError('comparing NLRI for ordering does not make sense')", "metadata": "root.NLRI.__lt__", "header": "['class', 'NLRI', '(', 'Family', ')', ':', '___EOS___']", "index": 50 }, { "content": "\tdef __le__ (self, other):\n\t\traise RuntimeError('comparing NRLI for ordering does not make sense')", "metadata": "root.NLRI.__le__", "header": "['class', 'NLRI', '(', 'Family', ')', ':', '___EOS___']", "index": 53 }, { "content": "\tdef __gt__ (self, other):\n\t\traise RuntimeError('comparing NLRI for ordering does not make sense')", "metadata": "root.NLRI.__gt__", "header": "['class', 'NLRI', '(', 'Family', ')', ':', '___EOS___']", "index": 56 }, { "content": "\tdef __ge__ (self, other):\n\t\traise RuntimeError('comparing NLRI for ordering does not make sense')", "metadata": "root.NLRI.__ge__", "header": "['class', 'NLRI', '(', 'Family', ')', ':', '___EOS___']", "index": 59 } ]
[ { "span": "def __lt__ (self, other):", "start_line": 50, "start_column": 1, "end_line": 50, "end_column": 26 }, { "span": "def __le__ (self, other):", "start_line": 53, "start_column": 1, "end_line": 53, "end_column": 26 }, { "span": "def __gt__ (self, other):", "start_line": 56, "start_column": 1, "end_line": 56, "end_column": 26 }, { "span": "def __ge__ (self, other):", "start_line": 59, "start_column": 1, "end_line": 59, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "NL", "RI", "_", "(_", "Family_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "'", "compa", "ring", " ", "NL", "RI", " ", "for", " ", "orderi", "ng", " ", "doe", "s", " ", "not", " ", "make", " ", "sense", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NL", "RI", "_", "(_", "Family_", ")_", ":_", "\\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\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "'", "compa", "ring", " ", "NR", "LI", " ", "for", " ", "orderi", "ng", " ", "doe", "s", " ", "not", " ", "make", " ", "sense", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NL", "RI", "_", "(_", "Family_", ")_", ":_", "\\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\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "'", "compa", "ring", " ", "NL", "RI", " ", "for", " ", "orderi", "ng", " ", "doe", "s", " ", "not", " ", "make", " ", "sense", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NL", "RI", "_", "(_", "Family_", ")_", ":_", "\\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\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "'", "compa", "ring", " ", "NL", "RI", " ", "for", " ", "orderi", "ng", " ", "doe", "s", " ", "not", " ", "make", " ", "sense", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
'import *' may pollute namespace
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/moves/tkinter/font.py
[ { "content": "from __future__ import absolute_import\n\nfrom future.utils import PY3\n\nif PY3:\n from tkinter.font import *\nelse:\n try:\n from tkFont import *\n except ImportError:\n raise ImportError('The tkFont module is missing. Does your Py2 '\n 'installation include tkinter?')\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from tkinter.font import *", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "future_", "._", "utils_", "import_", "PY", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "tkinter_", "._", "font_", "import_", "*_", "\\u\\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 ", " _", "from_", "tk", "Font_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Import", "Error_", "(_", "'", "The", " ", "tk", "Font", " ", "module", " ", "is", " ", "missi", "ng", ".", " ", "Do", "es", " ", "your", " ", "Py", "2", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installation", " ", "include", " ", "tkin", "ter", "?'_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
conan-io/conan/conans/model/config_dict.py
[ { "content": " @classmethod\n def loads(cls, text):\n name = cls.__name__.lower()\n if name == \"packageoptions\":\n name = \"options\"\n return cls(yaml.load(text) or {})", "metadata": "root.ConfigDict.loads", "header": "['class', 'ConfigDict', '(', 'object', ')', ':', '___EOS___']", "index": 178 } ]
[ { "span": "name ", "start_line": 182, "start_column": 12, "end_line": 182, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Config", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "loads_", "(_", "cls_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "cls_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "\"", "package", "options", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "options", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "yaml_", "._", "load_", "(_", "text_", ")_", "or_", "{_", "}_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/lxml-3.3.6/src/lxml/tests/test_schematron.py
[ { "content": "# -*- coding: utf-8 -*-\n\n\"\"\"\nTest cases related to Schematron parsing and validation\n\"\"\"\n\nimport unittest, sys, os.path\n\nthis_dir = os.path.dirname(__file__)\nif this_dir not in sys.path:\n sys.path.insert(0, this_dir) # needed for Py3\n\nfrom common_imports import etree, HelperTestCase, fileInTestDir\nfrom common_imports import doctest, make_doctest\n\n\n\n\nif __name__ == '__main__':\n print('to test use test.py %s' % __file__)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ETreeSchematronTestCase(HelperTestCase):\n\n\n\n", "metadata": "root.ETreeSchematronTestCase", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def test_schematron(self):\n tree_valid = self.parse('<AAA><BBB/><CCC/></AAA>')\n tree_invalid = self.parse('<AAA><BBB/><CCC/><DDD/></AAA>')\n schema = self.parse('''\\\n<schema xmlns=\"http://purl.oclc.org/dsdl/schematron\" >\n <pattern name=\"Open model\">\n <rule context=\"AAA\">\n <assert test=\"BBB\"> BBB element is not present</assert>\n <assert test=\"CCC\"> CCC element is not present</assert>\n </rule>\n </pattern>\n <pattern name=\"Closed model\">\n <rule context=\"AAA\">\n <assert test=\"BBB\"> BBB element is not present</assert>\n <assert test=\"CCC\"> CCC element is not present</assert>\n <assert test=\"count(BBB|CCC) = count (*)\">There is an extra element</assert>\n </rule>\n </pattern>\n</schema>\n''')\n schema = etree.Schematron(schema)\n self.assertTrue(schema.validate(tree_valid))\n self.assertFalse(schema.error_log.filter_from_errors())\n\n self.assertFalse(schema.validate(tree_invalid))\n self.assertTrue(schema.error_log.filter_from_errors())\n\n self.assertTrue(schema.validate(tree_valid)) # repeat valid\n self.assertFalse(schema.error_log.filter_from_errors()) # repeat valid", "metadata": "root.ETreeSchematronTestCase.test_schematron", "header": "['class', 'ETreeSchematronTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_schematron_elementtree_error(self):\n self.assertRaises(ValueError, etree.Schematron, etree.ElementTree())", "metadata": "root.ETreeSchematronTestCase.test_schematron_elementtree_error", "header": "['class', 'ETreeSchematronTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_schematron_invalid_schema(self):\n schema = self.parse('''\\\n<schema xmlns=\"http://purl.oclc.org/dsdl/schematron\" >\n <pattern name=\"Open model\">\n </pattern>\n</schema>\n''')\n self.assertRaises(etree.SchematronParseError,\n etree.Schematron, schema)", "metadata": "root.ETreeSchematronTestCase.test_schematron_invalid_schema", "header": "['class', 'ETreeSchematronTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_schematron_invalid_schema_empty(self):\n schema = self.parse('''\\\n<schema xmlns=\"http://purl.oclc.org/dsdl/schematron\" />\n''')\n self.assertRaises(etree.SchematronParseError,\n etree.Schematron, schema)", "metadata": "root.ETreeSchematronTestCase.test_schematron_invalid_schema_empty", "header": "['class', 'ETreeSchematronTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_schematron_invalid_schema_namespace(self):\n # segfault\n schema = self.parse('''\\\n<schema xmlns=\"mynamespace\" />\n''')\n self.assertRaises(etree.SchematronParseError,\n etree.Schematron, schema)", "metadata": "root.ETreeSchematronTestCase.test_schematron_invalid_schema_namespace", "header": "['class', 'ETreeSchematronTestCase', '(', 'HelperTestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": "def test_suite():\n suite = unittest.TestSuite()\n suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)])\n suite.addTests(\n [make_doctest('../../../doc/validation.txt')])\n return suite", "metadata": "root.test_suite", "header": "['module', '___EOS___']", "index": 75 } ]
[ { "span": "from common_imports import etree, HelperTestCase, fileInTestDir", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 63 }, { "span": "from common_imports import doctest, make_doctest", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 48 } ]
[]
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_", "\"\"\"", "\\", "10", ";", "Test", " ", "case", "s", " ", "relate", "d", " ", "to", " ", "Schema", "tron", " ", "pars", "ing", " ", "and", " ", "validation", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", ",_", "sys_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "this", "\\u", "dir_", "not_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "this", "\\u", "dir_", ")_", "#", " ", "need", "ed", " ", "for", " ", "Py", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "common", "\\u", "imports_", "import_", "etree_", ",_", "Help", "er", "Test", "Case_", ",_", "file", "In", "Test", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common", "\\u", "imports_", "import_", "doctest_", ",_", "make", "\\u", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "to", " ", "test", " ", "use", " ", "test", ".", "py", " ", "%", "s", "'_", "%_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "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_", "[SEP]_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "schema", "tron", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree", "\\u", "valid_", "=_", "self_", "._", "parse_", "(_", "'<", "AAA", "><", "BBB", "/>", "<", "CCC", "/>", "</", "AAA", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree", "\\u", "invalid_", "=_", "self_", "._", "parse_", "(_", "'<", "AAA", "><", "BBB", "/>", "<", "CCC", "/>", "<", "DDD", "/>", "</", "AAA", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "self_", "._", "parse_", "(_", "'''", "\\\\", "\\", "10", ";<", "schema", " ", "xml", "ns", "=\"", "http", "://", "pur", "l", ".", "ocl", "c", ".", "org", "/", "dsd", "l", "/", "schema", "tron", "\"", " ", ">", "\\", "10", ";", " ", "<", "pattern", " ", "name", "=\"", "Open", " ", "model", "\">", "\\", "10", ";", " ", " ", "<", "rule", " ", "context", "=\"", "AAA", "\">", "\\", "10", ";", " ", " ", " ", "<", "assert", " ", "test", "=\"", "BBB", "\">", " ", "BBB", " ", "element", " ", "is", " ", "not", " ", "presen", "t", "</", "assert", ">", "\\", "10", ";", " ", " ", " ", "<", "assert", " ", "test", "=\"", "CCC", "\">", " ", "CCC", " ", "element", " ", "is", " ", "not", " ", "presen", "t", "</", "assert", ">", "\\", "10", ";", " ", " ", "</", "rule", ">", "\\", "10", ";", " ", "</", "pattern", ">", "\\", "10", ";", " ", "<", "pattern", " ", "name", "=\"", "Clos", "ed", " ", "model", "\">", "\\", "10", ";", " ", " ", "<", "rule", " ", "context", "=\"", "AAA", "\">", "\\", "10", ";", " ", " ", " ", "<", "assert", " ", "test", "=\"", "BBB", "\">", " ", "BBB", " ", "element", " ", "is", " ", "not", " ", "presen", "t", "</", "assert", ">", "\\", "10", ";", " ", " ", " ", "<", "assert", " ", "test", "=\"", "CCC", "\">", " ", "CCC", " ", "element", " ", "is", " ", "not", " ", "presen", "t", "</", "assert", ">", "\\", "10", ";", " ", " ", " ", "<", "assert", " ", "test", "=\"", "count", "(", "BBB", "|", "CCC", ")", " ", "=", " ", "count", " ", "(*", ")\"", ">", "There", " ", "is", " ", "an", " ", "extra", " ", "element", "</", "assert", ">", "\\", "10", ";", " ", " ", "</", "rule", ">", "\\", "10", ";", " ", "</", "pattern", ">", "\\", "10", ";<", "/", "schema", ">", "\\", "10", ";'", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "etree_", "._", "Schema", "tron", "_", "(_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "schema_", "._", "validate_", "(_", "tree", "\\u", "valid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "schema_", "._", "error", "\\u", "log_", "._", "filter", "\\u", "from", "\\u", "errors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "schema_", "._", "validate_", "(_", "tree", "\\u", "invalid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "schema_", "._", "error", "\\u", "log_", "._", "filter", "\\u", "from", "\\u", "errors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "schema_", "._", "validate_", "(_", "tree", "\\u", "valid_", ")_", ")_", "#", " ", "repeat", " ", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "schema_", "._", "error", "\\u", "log_", "._", "filter", "\\u", "from", "\\u", "errors_", "(_", ")_", ")_", "#", " ", "repeat", " ", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "tron", "\\u", "element", "tree", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "etree_", "._", "Schema", "tron", "_", ",_", "etree_", "._", "Element", "Tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "tron", "\\u", "invalid", "\\u", "schema_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema_", "=_", "self_", "._", "parse_", "(_", "'''", "\\\\", "\\", "10", ";<", "schema", " ", "xml", "ns", "=\"", "http", "://", "pur", "l", ".", "ocl", "c", ".", "org", "/", "dsd", "l", "/", "schema", "tron", "\"", " ", ">", "\\", "10", ";", " ", "<", "pattern", " ", "name", "=\"", "Open", " ", "model", "\">", "\\", "10", ";", " ", "</", "pattern", ">", "\\", "10", ";<", "/", "schema", ">", "\\", "10", ";'", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "etree_", "._", "Schema", "tron", "Pars", "e", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Schema", "tron", "_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "tron", "\\u", "invalid", "\\u", "schema", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema_", "=_", "self_", "._", "parse_", "(_", "'''", "\\\\", "\\", "10", ";<", "schema", " ", "xml", "ns", "=\"", "http", "://", "pur", "l", ".", "ocl", "c", ".", "org", "/", "dsd", "l", "/", "schema", "tron", "\"", " ", "/>", "\\", "10", ";'", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "etree_", "._", "Schema", "tron", "Pars", "e", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Schema", "tron", "_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ET", "ree", "Schema", "tron", "Test", "Case_", "(_", "Help", "er", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "tron", "\\u", "invalid", "\\u", "schema", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "seg", "fault_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema_", "=_", "self_", "._", "parse_", "(_", "'''", "\\\\", "\\", "10", ";<", "schema", " ", "xml", "ns", "=\"", "myn", "ames", "pace", "\"", " ", "/>", "\\", "10", ";'", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "etree_", "._", "Schema", "tron", "Pars", "e", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "etree_", "._", "Schema", "tron", "_", ",_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Tests_", "(_", "[_", "unittest_", "._", "make", "Suite_", "(_", "ET", "ree", "Schema", "tron", "Test", "Case_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Tests_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "make", "\\u", "doctest_", "(_", "'../../", "..", "/", "doc", "/", "validation", ".", "txt", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "suite_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
lebedov/scikit-cuda/demos/dot_demo.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"\nDemonstrates multiplication of two matrices on the GPU.\n\"\"\"\nfrom __future__ import print_function\n\nimport pycuda.autoinit\nimport pycuda.gpuarray as gpuarray\nimport pycuda.driver as drv\nimport numpy as np\n\nimport skcuda.linalg as culinalg\nimport skcuda.misc as cumisc\nculinalg.init()\n\n# Double precision is only supported by devices with compute\n# capability >= 1.3:\nimport string\ndemo_types = [np.float32, np.complex64]\nif cumisc.get_compute_capability(pycuda.autoinit.device) >= 1.3:\n demo_types.extend([np.float64, np.complex128])\n\nfor t in demo_types:\n print('Testing matrix multiplication for type ' + str(np.dtype(t)))\n if np.iscomplexobj(t()):\n a = np.asarray(np.random.rand(10, 5) + 1j * np.random.rand(10, 5), t)\n b = np.asarray(np.random.rand(5, 5) + 1j * np.random.rand(5, 5), t)\n c = np.asarray(np.random.rand(5, 5) + 1j * np.random.rand(5, 5), t)\n else:\n a = np.asarray(np.random.rand(10, 5), t)\n b = np.asarray(np.random.rand(5, 5), t)\n c = np.asarray(np.random.rand(5, 5), t)\n\n a_gpu = gpuarray.to_gpu(a)\n b_gpu = gpuarray.to_gpu(b)\n c_gpu = gpuarray.to_gpu(c)\n\n temp_gpu = culinalg.dot(a_gpu, b_gpu)\n d_gpu = culinalg.dot(temp_gpu, c_gpu)\n temp_gpu.gpudata.free()\n del(temp_gpu)\n print('Success status: ', np.allclose(np.dot(np.dot(a, b), c), d_gpu.get()))\n\n print('Testing vector multiplication for type ' + str(np.dtype(t)))\n if np.iscomplexobj(t()):\n d = np.asarray(np.random.rand(5) + 1j * np.random.rand(5), t)\n e = np.asarray(np.random.rand(5) + 1j * np.random.rand(5), t)\n else:\n d = np.asarray(np.random.rand(5), t)\n e = np.asarray(np.random.rand(5), t)\n\n d_gpu = gpuarray.to_gpu(d)\n e_gpu = gpuarray.to_gpu(e)\n\n temp = culinalg.dot(d_gpu, e_gpu)\n print('Success status: ', np.allclose(np.dot(d, e), temp))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import pycuda.driver as drv", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 27 }, { "span": "import string", "start_line": 18, "start_column": 0, "end_line": 18, "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_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Demo", "nstr", "ates", " ", "multiplication", " ", "of", " ", "two", " ", "matric", "es", " ", "on", " ", "the", " ", "GPU", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "autoi", "nit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "gpu", "array_", "as_", "gpu", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "driver_", "as_", "drv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sk", "cuda_", "._", "linalg_", "as_", "cul", "inal", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sk", "cuda_", "._", "misc_", "as_", "cum", "isc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cul", "inal", "g_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Doub", "le", " ", "preci", "sion", " ", "is", " ", "only", " ", "support", "ed", " ", "by", " ", "device", "s", " ", "with", " ", "compute_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "capab", "ilit", "y", " ", ">=", " ", "1.3", ":_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "demo", "\\u", "types_", "=_", "[_", "np_", "._", "float32_", ",_", "np_", "._", "complex", "64_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cum", "isc", "_", "._", "get", "\\u", "compute", "\\u", "capability_", "(_", "pyc", "uda", "_", "._", "autoi", "nit_", "._", "device_", ")_", ">=_", "1.3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "demo", "\\u", "types_", "._", "extend_", "(_", "[_", "np_", "._", "float64_", ",_", "np_", "._", "complex", "128_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "demo", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Test", "ing", " ", "matrix", " ", "multiplication", " ", "for", " ", "type", " ", "'_", "+_", "str_", "(_", "np_", "._", "dtype_", "(_", "t_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "isco", "mple", "xo", "bj_", "(_", "t_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "5_", ")_", "+_", "1j_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "+_", "1j_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "+_", "1j_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a", "\\u", "gpu_", "=_", "gpu", "array_", "._", "to", "\\u", "gpu_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "gpu_", "=_", "gpu", "array_", "._", "to", "\\u", "gpu_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "gpu_", "=_", "gpu", "array_", "._", "to", "\\u", "gpu_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "gpu_", "=_", "cul", "inal", "g_", "._", "dot_", "(_", "a", "\\u", "gpu_", ",_", "b", "\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "gpu_", "=_", "cul", "inal", "g_", "._", "dot_", "(_", "temp", "\\u", "gpu_", ",_", "c\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "gpu_", "._", "gpu", "data_", "._", "free_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "(_", "temp", "\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Success", " ", "status", ":", " ", "'_", ",_", "np_", "._", "allclose_", "(_", "np_", "._", "dot_", "(_", "np_", "._", "dot_", "(_", "a_", ",_", "b_", ")_", ",_", "c_", ")_", ",_", "d\\u", "gpu_", "._", "get_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Test", "ing", " ", "vector", " ", "multiplication", " ", "for", " ", "type", " ", "'_", "+_", "str_", "(_", "np_", "._", "dtype_", "(_", "t_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "isco", "mple", "xo", "bj_", "(_", "t_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", "+_", "1j_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", "+_", "1j_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "np_", "._", "asarray_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d\\u", "gpu_", "=_", "gpu", "array_", "._", "to", "\\u", "gpu_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "gpu_", "=_", "gpu", "array_", "._", "to", "\\u", "gpu_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "cul", "inal", "g_", "._", "dot_", "(_", "d\\u", "gpu_", ",_", "e\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Success", " ", "status", ":", " ", "'_", ",_", "np_", "._", "allclose_", "(_", "np_", "._", "dot_", "(_", "d_", ",_", "e_", ")_", ",_", "temp_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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 ]
Testing equality to None
Microsoft/ivy/src/ivy/ivy_unitres.py
[ { "content": "def find_term(term):\n if equational_theory == None:\n return term\n return equational_theory.find(term)", "metadata": "root.find_term", "header": "['module', '___EOS___']", "index": 144 }, { "content": "def ground_match(term,index):\n if equational_theory == None:\n yield term.rep\n else:\n trep = equational_theory.find(term)\n for t2 in index:\n if equational_theory.find_by_name(t2) is trep:\n yield t2", "metadata": "root.ground_match", "header": "['module', '___EOS___']", "index": 149 }, { "content": "def lit_rep(lit):\n if equational_theory == None:\n return lit\n terms = [(a if isinstance(a,Variable) else equational_theory.find(a)) for a in lit.atom.args]\n return Literal(lit.polarity,Atom(lit.atom.relname,terms))", "metadata": "root.lit_rep", "header": "['module', '___EOS___']", "index": 215 }, { "content": "def clause_rep(clause):\n if equational_theory == None:\n return clause\n return [lit_rep(l) for l in clause]", "metadata": "root.clause_rep", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def propagate_lit(self,lit,gen=0,specs = None):\n \"\"\"\n Perform unit resolution using a literal.\n\n >>> r = UnitRes(to_clauses(\"[[a(),b()]]\"))\n >>> r.propagate_lit(to_literal('~a()'))\n >>> r.unit_queue\n [b()]\n >>> r.watching\n [{}, {'a': [], 'b': []}]\n >>> r.subsumed\n [0]\n >>> r.clauses\n [[a(), b()]]\n \"\"\"\n\n# print self.index\n if self.equational_theory != None and is_ground_equality_lit(lit):\n self.propagate_equality(lit,gen)\n return\n# if lit.atom.relname == '=' and lit.polarity == 0:\n# return\n lits = [lit,Literal(lit.polarity,Atom('=',[lit.atom.args[1],lit.atom.args[0]]))] if lit.atom.relname == '=' else [lit]\n for lit in lits:\n keep = keep_lit(lit)\n indices = list(find_unifying(self.index,Literal(1 - lit.polarity,lit.atom))) # save this in cas index changes\n lit = lit_rep(canonize_literal_unique(lit))\n for index in indices:\n wl = index[1]\n # print \"%s -- %s\" % (lit,wl)\n for i,j in list(wl): # copy the list in case we modify it\n cl = self.clauses[i]\n # print \"cl: %s lit: %s\" % (cl,lit)\n lit2 = lit_rep(cl[j])\n if lit2.polarity != 1-lit.polarity or lit2.atom.relname != lit.atom.relname:\n print \"!!! %s %s %s %s %s\" % (i,j,lit,lit2,cl)\n exit(1)\n if is_equality_lit(lit2) and all(isinstance(t,Variable) for t in lit2.atom.args):\n continue\n match, subs, eqs = mgu_eq(lit.atom, lit2.atom)\n # print \"lit: %s\" % lit\n if match and self.allow_eqs(lit,eqs,False,cl):\n if atom_subsume(lit.atom,lit2.atom):\n self.deindex(i)\n self.subsumed.append(i)\n # print \"lit: %s\" % lit\n new_cl = [substitute_lit(lit1, subs) for k,lit1 in enumerate(cl) if k != j] + [Literal(0,eq) for eq in eqs]\n if not new_specialization and not (specs == None):\n if verbose():\n print \"using specs: %s\" % specs\n new_cl = substitute_constants_clause(new_cl,specs)\n new_cl = simplify_clause(new_cl)\n if not is_tautology(new_cl) and not self.subsumed_by_used_lit(lit,cl,new_cl):\n if verbose():\n print \"%s,%s -> %s\" % (lit,cl,new_cl)\n new_gen = max(gen+1,self.clauses_gen[i])\n self.add_clause(new_cl,new_gen)\n if self.unsat:\n return\n \n if keep:\n self.resolve_units(lit,index[0],gen,False) # have to unify against units too!\n if self.unsat:\n return\n # if we are not keeping this unit as a consequence,\n # resolve it against all of the the units that might match\n # under equality, so that we can infer disequalities\n if keep == False:\n others = [x for x in self.unit_term_index[lit.atom.relname] if self.unit_queue[x].polarity != lit.polarity]\n self.resolve_units(lit,others,gen,True) # \n if self.unsat:\n return", "metadata": "root.UnitRes.propagate_lit", "header": "['class', 'UnitRes', '(', 'object', ')', ':', '___EOS___']", "index": 410 } ]
[ { "span": "equational_theory == None:", "start_line": 145, "start_column": 7, "end_line": 145, "end_column": 32 }, { "span": "equational_theory == None:", "start_line": 150, "start_column": 7, "end_line": 150, "end_column": 32 }, { "span": "equational_theory == None:", "start_line": 216, "start_column": 7, "end_line": 216, "end_column": 32 }, { "span": "equational_theory == None:", "start_line": 222, "start_column": 7, "end_line": 222, "end_column": 32 }, { "span": "specs == None)", "start_line": 457, "start_column": 59, "end_line": 457, "end_column": 72 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "term_", "(_", "term_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "equation", "al", "\\u", "theory", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "term_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "equation", "al", "\\u", "theory", "_", "._", "find_", "(_", "term_", ")_", "\\u\\u\\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_", "ground", "\\u", "match_", "(_", "term_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "equation", "al", "\\u", "theory", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "term_", "._", "rep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tre", "p_", "=_", "equation", "al", "\\u", "theory", "_", "._", "find_", "(_", "term_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t2_", "in_", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "equation", "al", "\\u", "theory", "_", "._", "find", "\\u", "by", "\\u", "name_", "(_", "t2_", ")_", "is_", "tre", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "t2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lit", "\\u", "rep_", "(_", "lit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "equation", "al", "\\u", "theory", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "terms_", "=_", "[_", "(_", "a_", "if_", "isinstance_", "(_", "a_", ",_", "Variable_", ")_", "else_", "equation", "al", "\\u", "theory", "_", "._", "find_", "(_", "a_", ")_", ")_", "for_", "a_", "in_", "lit_", "._", "atom_", "._", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Literal_", "(_", "lit_", "._", "polarity", "_", ",_", "Atom_", "(_", "lit_", "._", "atom_", "._", "rel", "name_", ",_", "terms_", ")_", ")_", "\\u\\u\\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_", "clause", "\\u", "rep_", "(_", "clause_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "equation", "al", "\\u", "theory", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clause_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "lit", "\\u", "rep_", "(_", "l_", ")_", "for_", "l_", "in_", "clause_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unit", "Res_", "(_", "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_", "propagate", "\\u", "lit_", "(_", "self_", ",_", "lit_", ",_", "gen_", "=_", "0_", ",_", "specs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "unit", " ", "resolu", "tion", " ", "usi", "ng", " ", "a", " ", "literal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", " ", "=", " ", "Unit", "Res", "(", "to", "\\u", "clause", "s", "(\"", "[[", "a", "()", ",", "b", "()]", "]\"", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ".", "propagate", "\\u", "lit", "(", "to", "\\u", "literal", "('", "~", "a", "()'", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ".", "unit", "\\u", "queue", "\\", "10", ";", " ", " ", " ", " ", "[", "b", "()]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ".", "watch", "ing", "\\", "10", ";", " ", " ", " ", " ", "[{", "},", " ", "{", "'", "a", "':", " ", "[]", ",", " ", "'", "b", "':", " ", "[]", "}]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ".", "subsu", "med", "\\", "10", ";", " ", " ", " ", " ", "[", "0", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", ".", "clause", "s", "\\", "10", ";", " ", " ", " ", " ", "[[", "a", "()", ",", " ", "b", "()]", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "self", ".", "index_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "equation", "al", "\\u", "theory", "_", "!=_", "None_", "and_", "is", "\\u", "ground", "\\u", "equality", "\\u", "lit_", "(_", "lit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "propagate", "\\u", "equality", "_", "(_", "lit_", ",_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "lit", ".", "atom", ".", "rel", "name", " ", "==", " ", "'=", "'", " ", "and", " ", "lit", ".", "polarity", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lit", "s_", "=_", "[_", "lit_", ",_", "Literal_", "(_", "lit_", "._", "polarity", "_", ",_", "Atom_", "(_", "'='_", ",_", "[_", "lit_", "._", "atom_", "._", "args_", "[_", "1_", "]_", ",_", "lit_", "._", "atom_", "._", "args_", "[_", "0_", "]_", "]_", ")_", ")_", "]_", "if_", "lit_", "._", "atom_", "._", "rel", "name_", "==_", "'='_", "else_", "[_", "lit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lit_", "in_", "lit", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep_", "=_", "keep", "\\u", "lit_", "(_", "lit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "=_", "list_", "(_", "find", "\\u", "unify", "ing_", "(_", "self_", "._", "index_", ",_", "Literal_", "(_", "1_", "-_", "lit_", "._", "polarity", "_", ",_", "lit_", "._", "atom_", ")_", ")_", ")_", "#", " ", "save", " ", "this", " ", "in", " ", "cas", " ", "index", " ", "changes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lit_", "=_", "lit", "\\u", "rep_", "(_", "canon", "ize", "\\u", "literal", "\\u", "unique_", "(_", "lit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", "in_", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wl_", "=_", "index_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"%", "s", " ", "--", " ", "%", "s", "\"", " ", "%", " ", "(", "lit", ",", "wl", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "j_", "in_", "list_", "(_", "wl_", ")_", ":_", "#", " ", "copy", " ", "the", " ", "list", " ", "in", " ", "case", " ", "we", " ", "modif", "y", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cl_", "=_", "self_", "._", "clauses_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "cl", ":", " ", "%", "s", " ", "lit", ":", " ", "%", "s", "\"", " ", "%", " ", "(", "cl", ",", "lit", ")_", "\\u\\u\\uNL\\u\\u\\u_", "lit", "2_", "=_", "lit", "\\u", "rep_", "(_", "cl_", "[_", "j_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lit", "2_", "._", "polarity", "_", "!=_", "1_", "-_", "lit_", "._", "polarity", "_", "or_", "lit", "2_", "._", "atom_", "._", "rel", "name_", "!=_", "lit_", "._", "atom_", "._", "rel", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"!!", "!", " ", "%", "s", " ", "%", "s", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "i_", ",_", "j_", ",_", "lit_", ",_", "lit", "2_", ",_", "cl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "equality", "\\u", "lit_", "(_", "lit", "2_", ")_", "and_", "all_", "(_", "isinstance_", "(_", "t_", ",_", "Variable_", ")_", "for_", "t_", "in_", "lit", "2_", "._", "atom_", "._", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", ",_", "subs_", ",_", "eqs", "_", "=_", "mg", "u\\u", "eq_", "(_", "lit_", "._", "atom_", ",_", "lit", "2_", "._", "atom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "lit", ":", " ", "%", "s", "\"", " ", "%", " ", "lit_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "match_", "and_", "self_", "._", "allow", "\\u", "eqs", "_", "(_", "lit_", ",_", "eqs", "_", ",_", "False_", ",_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "atom", "\\u", "subsu", "me_", "(_", "lit_", "._", "atom_", ",_", "lit", "2_", "._", "atom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "dei", "ndex_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subsu", "med_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "lit", ":", " ", "%", "s", "\"", " ", "%", " ", "lit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "cl_", "=_", "[_", "substitute", "\\u", "lit_", "(_", "lit", "1_", ",_", "subs_", ")_", "for_", "k_", ",_", "lit", "1_", "in_", "enumerate_", "(_", "cl_", ")_", "if_", "k_", "!=_", "j_", "]_", "+_", "[_", "Literal_", "(_", "0_", ",_", "eq_", ")_", "for_", "eq_", "in_", "eqs", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "new", "\\u", "special", "ization_", "and_", "not_", "(_", "specs_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "usi", "ng", " ", "spec", "s", ":", " ", "%", "s", "\"_", "%_", "specs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "cl_", "=_", "substitute", "\\u", "constant", "s", "\\u", "clause_", "(_", "new", "\\u", "cl_", ",_", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "cl_", "=_", "simplify", "\\u", "clause_", "(_", "new", "\\u", "cl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "tau", "tol", "og", "y_", "(_", "new", "\\u", "cl_", ")_", "and_", "not_", "self_", "._", "subsu", "med", "\\u", "by", "\\u", "used", "\\u", "lit_", "(_", "lit_", ",_", "cl_", ",_", "new", "\\u", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"%", "s", ",%", "s", " ", "->", " ", "%", "s", "\"_", "%_", "(_", "lit_", ",_", "cl_", ",_", "new", "\\u", "cl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "gen_", "=_", "max_", "(_", "gen_", "+_", "1_", ",_", "self_", "._", "clause", "s", "\\u", "gen_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "clause_", "(_", "new", "\\u", "cl_", ",_", "new", "\\u", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "unsa", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "keep_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "resolve", "\\u", "units_", "(_", "lit_", ",_", "index_", "[_", "0_", "]_", ",_", "gen_", ",_", "False_", ")_", "#", " ", "have", " ", "to", " ", "unify", " ", "against", " ", "unit", "s", " ", "too", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "unsa", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "not", " ", "keep", "ing", " ", "this", " ", "unit", " ", "as", " ", "a", " ", "consequ", "ence", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resolve", " ", "it", " ", "against", " ", "all", " ", "of", " ", "the", " ", "the", " ", "unit", "s", " ", "tha", "t", " ", "mig", "ht", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "equality", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "infer", " ", "dis", "equal", "ities_", "\\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_", "keep_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "others_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "unit", "\\u", "term", "\\u", "index_", "[_", "lit_", "._", "atom_", "._", "rel", "name_", "]_", "if_", "self_", "._", "unit", "\\u", "queue_", "[_", "x_", "]_", "._", "polarity", "_", "!=_", "lit_", "._", "polarity", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolve", "\\u", "units_", "(_", "lit_", ",_", "others_", ",_", "gen_", ",_", "True_", ")_", "#", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "unsa", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2 ]
Unused import
zunzun/pyeq2/Services/SolverService.py
[ { "content": "from __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\n# pyeq2 is a collection of equations expressed as Python classes\n#\n# Copyright (C) 2013 James R. Phillips\n# 2548 Vera Cruz Drive\n# Birmingham, AL 35235 USA\n#\n# email: [email protected]\n#\n# License: BSD-style (see LICENSE.txt in main source directory)\n\nimport numpy, copy\ntry:\n import scipy.interpolate, scipy.optimize, scipy.odr.odrpack\nexcept:\n pass\nnumpy.seterr(all= 'ignore')\n\nimport pyeq2\nfrom . import diffev\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class custom_prng_for_diffev(numpy.random.mtrand.RandomState):\n \n\n ", "metadata": "root.custom_prng_for_diffev", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self):\n numpy.random.mtrand.RandomState.__init__(self)\n numpy.random.seed(3) # yield repeatable results\n self.max_index = 5000\n self.array = numpy.random.rand(self.max_index)\n self.index = 0", "metadata": "root.custom_prng_for_diffev.__init__", "header": "['class', 'custom_prng_for_diffev', '(', 'numpy', '.', 'random', '.', 'mtrand', '.', 'RandomState', ')', ':', '___EOS___']", "index": 26 }, { "content": " def rand(self, inSize):\n if self.index + inSize > self.max_index:\n self.index = 0\n return_val = self.array[self.index:self.index + inSize]\n self.index += inSize\n return return_val", "metadata": "root.custom_prng_for_diffev.rand", "header": "['class', 'custom_prng_for_diffev', '(', 'numpy', '.', 'random', '.', 'mtrand', '.', 'RandomState', ')', ':', '___EOS___']", "index": 34 }, { "content": "class SolverService(object):\n \n # these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\n # The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\n ListOfNonLinearSolverAlgorithmNames = ['Levenberg-Marquardt','NelderMead','Powell','CG','BFGS','Newton-CG','Anneal','COBYLA','SLSQP']\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # directly passing the distribution instance can yield \"can't pickle instancemethod\"\n # exceptions, so the distribution name is passed instead", "metadata": "root.SolverService", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self):\n self.fminIterationLimit = 2500\n self.fmin_xtol = 1.0E-16\n self.fmin_ftol = 1.0E-16\n self.fmin_FunctionLimit = 2500", "metadata": "root.SolverService.__init__", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 50 }, { "content": " def SolveUsingLinear(self, inModel):\n if (inModel.CanLinearSolverBeUsedForSSQABS()) == False and (inModel.fittingTarget == \"SSQABS\"):\n raise Exception('This equation cannot use a linear SSQ solver')\n inModel.solvedCoefficients = numpy.linalg.lstsq(inModel.dataCache.FindOrCreateAllDataCache(inModel).T, inModel.dataCache.allDataCacheDictionary['DependentData'])[0]\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingLinear", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 58 }, { "content": " def SolveUsingSimplex(self, inModel):\n inModel.dataCache.FindOrCreateAllDataCache(inModel)\n inModel.solvedCoefficients = scipy.optimize.fmin(inModel.CalculateAllDataFittingTarget, inModel.estimatedCoefficients, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, maxfun = len(inModel.estimatedCoefficients) * self.fmin_FunctionLimit, disp = 0, xtol=self.fmin_xtol, ftol=self.fmin_ftol)\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingSimplex", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 65 }, { "content": " def SolveUsingDE(self, inModel): # adapts to number of coefficients\n crossoverProbabilityForGA = 0.75\n diffScaleForGA = 0.25\n \n numberOfCoefficients = len(inModel.GetCoefficientDesignators())\n \n oneThirdOfPopulationSizeForGA = 500 * numberOfCoefficients\n if oneThirdOfPopulationSizeForGA > 1500:\n oneThirdOfPopulationSizeForGA = 1500 \n \n maxGenerationsForGA = 5 * numberOfCoefficients\n if maxGenerationsForGA > 25:\n maxGenerationsForGA = 25\n\n guessDivisorForGA = 10.0 * numberOfCoefficients\n if guessDivisorForGA > 50.0:\n guessDivisorForGA = 50.0\n\n inModel.dataCache.FindOrCreateReducedDataCache(inModel)\n \n numpy.random.seed(3) # yield repeatable results\n largeValuesArray = numpy.random.random(oneThirdOfPopulationSizeForGA * numberOfCoefficients) * 2000.0 - 1000.0\n smallValuesArray = numpy.random.random(oneThirdOfPopulationSizeForGA * numberOfCoefficients) * 2.0 - 1.0\n tinyValuesArray = numpy.random.random(oneThirdOfPopulationSizeForGA * numberOfCoefficients) * .002 - .001 \n pop0 = numpy.append(largeValuesArray, numpy.append(smallValuesArray, tinyValuesArray))\n numpy.random.shuffle(pop0)\n pop0 = pop0.reshape(oneThirdOfPopulationSizeForGA * 3, numberOfCoefficients)\n\n if inModel.estimatedCoefficients != []:\n pop0[0] = copy.deepcopy(inModel.estimatedCoefficients) # DE will overwrite these values, so use deepcopy\n \n depData = inModel.dataCache.reducedDataCacheDictionary['DependentData']\n sufficientSolution = (max(depData) - min(depData)) / guessDivisorForGA\n de = diffev.DiffEvolver(inModel.CalculateReducedDataFittingTarget, pop0, crossover_rate = crossoverProbabilityForGA, scale = diffScaleForGA, prng = custom_prng_for_diffev())\n de.solve(sufficientSolution, maxGenerationsForGA)\n \n inModel.solvedCoefficients = de.best_vector\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingDE", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 71 }, { "content": " def SolveUsingSelectedAlgorithm(self, inModel, inAlgorithmName):\n \n if inAlgorithmName not in self.ListOfNonLinearSolverAlgorithmNames:\n raise Exception('\"' + inAlgorithmName + '\" was not in the list of known non-linear solver algorithm names. Please see the SolverService class definition.')\n\n inModel.dataCache.FindOrCreateAllDataCache(inModel)\n inModel.dataCache.FindOrCreateReducedDataCache(inModel)\n\n results = []\n # try with initial coefficients equal to 1\n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], numpy.ones(len(inModel.GetCoefficientDesignators())), maxfev=1000000)\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, numpy.ones(len(inModel.GetCoefficientDesignators())), method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try with initial coefficients from DE\n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.deEstimatedCoefficients, maxfev=1000000) # initial coefficients are all equal to 1\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, inModel.deEstimatedCoefficients, method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try using estimated coefficients, if any\n if len(inModel.estimatedCoefficients) > 0:\n try:\n coeffs = inModel.estimatedCoefficients\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n try:\n if inAlgorithmName == 'Levenberg-Marquardt':\n coeffs, unused = scipy.optimize.curve_fit(inModel.WrapperForScipyCurveFit, None, inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.estimatedCoefficients, maxfev=1000000)\n else:\n coeffs = scipy.optimize.minimize(inModel.CalculateAllDataFittingTarget, inModel.estimatedCoefficients, method=inAlgorithmName, maxiter = len(inModel.estimatedCoefficients) * self.fminIterationLimit, disp = 0)\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n if results == []:\n return numpy.ones(len(inModel.GetCoefficientDesignators()))\n \n if len(results) > 1:\n results.sort(key=lambda item: item[0])\n \n inModel.solvedCoefficients = results[0][1]\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingSelectedAlgorithm", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 111 }, { "content": " def SolveUsingODR(self, inModel):\n\n data = inModel.dataCache.FindOrCreateAllDataCache(inModel)\n modelObject = scipy.odr.odrpack.Model(inModel.WrapperForODR)\n if len(inModel.dataCache.allDataCacheDictionary['Weights']):\n dataObject = scipy.odr.odrpack.Data(inModel.dataCache.allDataCacheDictionary['IndependentData'], inModel.dataCache.allDataCacheDictionary['DependentData'], inModel.dataCache.allDataCacheDictionary['Weights'])\n else:\n dataObject = scipy.odr.odrpack.Data(inModel.dataCache.allDataCacheDictionary['IndependentData'], inModel.dataCache.allDataCacheDictionary['DependentData'])\n \n results = []\n \n # try with initial coefficients equal to 1\n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=numpy.ones(len(inModel.GetCoefficientDesignators())), maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try with initial coefficients from DE\n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=inModel.deEstimatedCoefficients, maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n # try using estimated coefficients, if any\n if len(inModel.estimatedCoefficients) > 0:\n try:\n coeffs = inModel.estimatedCoefficients\n SSQ = inModel.CalculateAllDataFittingTarget(coeffs)\n results.append([SSQ, coeffs])\n except:\n pass\n \n try:\n myodr = scipy.odr.odrpack.ODR(dataObject, modelObject, beta0=inModel.estimatedCoefficients, maxit=len(inModel.GetCoefficientDesignators()) * self.fminIterationLimit)\n myodr.set_job(fit_type=0, deriv=0) # explicit ODR, faster forward-only finite differences for derivatives\n out = myodr.run()\n coeffs = out.beta\n SSQ = out.sum_square\n if not numpy.any(numpy.isnan(coeffs)):\n results.append([SSQ, coeffs])\n except:\n pass\n \n if results == []:\n return numpy.ones(len(inModel.GetCoefficientDesignators()))\n \n if len(results) > 1:\n results.sort(key=lambda item: item[0])\n \n inModel.solvedCoefficients = results[0][1]\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingODR", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 171 }, { "content": " def SolveUsingSpline(self, inModel):\n data = inModel.dataCache.FindOrCreateAllDataCache(inModel)\n if inModel.GetDimensionality() == 2:\n inModel.scipySpline = scipy.interpolate.fitpack2.UnivariateSpline(data[0], inModel.dataCache.allDataCacheDictionary['DependentData'], s=inModel.smoothingFactor, k=inModel.xOrder)\n inModel.solvedCoefficients = inModel.scipySpline._eval_args\n return inModel.solvedCoefficients\n else:\n inModel.scipySpline = scipy.interpolate.fitpack2.SmoothBivariateSpline(data[0], data[1], inModel.dataCache.allDataCacheDictionary['DependentData'], s=inModel.smoothingFactor, kx=inModel.xOrder, ky=inModel.yOrder)\n inModel.solvedCoefficients = inModel.scipySpline.tck\n return inModel.solvedCoefficients", "metadata": "root.SolverService.SolveUsingSpline", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 236 }, { "content": " def SolveStatisticalDistribution(self, distributionName, data, inCriteriaForUseInListSorting):\n \n criteriaList = ['AIC', 'AICc_BA', 'nnlf']\n if inCriteriaForUseInListSorting not in criteriaList:\n raise Exception('Criteria to calculate for use in sorting was not in', str(criteriaList))\n \n try:\n exec('distribution = scipy.stats.' + distributionName)\n except:\n return 0\n\n # only need to calculate these once\n eps = numpy.finfo(float).eps * 2.0\n data_min = data.min()\n data_max = data.max()\n data_mean = data.mean()\n data_range = data_max - data_min\n data_std_dev = numpy.std(data, dtype=numpy.float32) # note on precision http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html \n \n \n # Try different starting parameters\n best_nnlf = 1.0E300\n best_parameters = None\n \n if distribution.name in ['beta']:\n try:\n rangeData = (data - data_min) / data_range\n data_mean = rangeData.mean()\n data_var = rangeData.var()\n \n par_a = data_mean * ((data_mean * (1.0 - data_mean) / data_var) - 1.0)\n par_b = (1.0 - data_mean) * ((data_mean * (1.0 - data_mean) / data_var) - 1.0)\n par0 = (par_a, par_b, data_min - 0.001*data_min, data_range * 1.001)\n par_est = tuple(distribution.fit(data, *(par0[:-2]), loc = data_min - 0.01*data_min, scale = data_range * 1.01))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n if distribution.name in ['truncnorm','betaprime','reciprocal']:\n try:\n par0 = (data_mean-2.0*data_std_dev, data_mean+2.0*data_std_dev)\n par_est = tuple(distribution.fit(data, loc=data_mean, scale=data_std_dev, *par0))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=0.0, scale=1.0))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_mean, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_max+eps, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_min-eps, scale=data_std_dev))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_max+eps, scale=data_range))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n try:\n par_est = tuple(distribution.fit(data, loc=data_min-eps, scale=data_range))\n nnlf = distribution.nnlf(par_est, data)\n if numpy.isfinite(nnlf) and nnlf < best_nnlf:\n best_parameters = par_est\n best_nnlf = nnlf\n except:\n pass\n \n if (best_nnlf < 1.0E300) and (best_parameters is not None):\n try:\n k = len(best_parameters)\n AIC = 2.0*k + 2.0 * best_nnlf\n n = len(data)\n AICc_BA = AIC + ( (2.0 * k * (k+1.0)) / (n - k - 1.0))\n\n temp = {}\n temp['distributionName'] = distributionName\n temp['fittedParameters'] = best_parameters\n temp['nnlf'] = best_nnlf\n temp['AIC'] = AIC\n temp['AICc_BA'] = AICc_BA\n \n if inCriteriaForUseInListSorting == 'nnlf':\n return [best_nnlf, temp]\n elif inCriteriaForUseInListSorting == 'AIC':\n return [AIC, temp]\n else:\n return [AICc_BA, temp]\n except:\n return 0\n else:\n return 0", "metadata": "root.SolverService.SolveStatisticalDistribution", "header": "['class', 'SolverService', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', \"# these are taken from docs for scipy.optimize.minimize, except for 'Levenberg=Marquardt'.\", '___NL___', \"# The algorithms 'L-BFGS-B' and 'TNC' are not on the list as they are bounded versions of other algorithms listed here.\", '___NL___', '___EOS___']", "index": 250 } ]
[ { "span": "import pyeq2", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 12 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\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_", "#", " ", " ", " ", " ", "pye", "q2", " ", "is", " ", "a", " ", "collection", " ", "of", " ", "equation", "s", " ", "express", "ed", " ", "as", " ", "Pyth", "on", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Jam", "es", " ", "R", ".", " ", "Phil", "lip", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "254", "8", " ", "Ver", "a", " ", "Cru", "z", " ", "Drive", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Bir", "ming", "ham", ",", " ", "AL", " ", "352", "3", "5", " ", "USA", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "email", ":", " ", "zu", "nz", "un", "@", "zu", "nz", "un", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", ":", " ", "BS", "D", "-", "style", " ", "(", "see", " ", "LICENSE", ".", "txt", " ", "in", " ", "main", " ", "source", " ", "director", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", ",_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "scipy_", "._", "interpolate_", ",_", "scipy_", "._", "optimize_", ",_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "\\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_", "numpy_", "._", "sete", "rr_", "(_", "all_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pye", "q2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "diff", "ev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\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_", "custom", "\\u", "prn", "g", "\\u", "for", "\\u", "diff", "ev_", "(_", "numpy_", "._", "random_", "._", "mtr", "and_", "._", "Random", "State_", ")_", ":_", "\\u\\u\\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_", "custom", "\\u", "prn", "g", "\\u", "for", "\\u", "diff", "ev_", "(_", "numpy_", "._", "random_", "._", "mtr", "and_", "._", "Random", "State_", ")_", ":_", "\\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 ", " _", "numpy_", "._", "random_", "._", "mtr", "and_", "._", "Random", "State_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numpy_", "._", "random_", "._", "seed_", "(_", "3_", ")_", "#", " ", "yield", " ", "repeat", "able", " ", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "index_", "=_", "5000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "array_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "self_", "._", "max", "\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "custom", "\\u", "prn", "g", "\\u", "for", "\\u", "diff", "ev_", "(_", "numpy_", "._", "random_", "._", "mtr", "and_", "._", "Random", "State_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rand_", "(_", "self_", ",_", "in", "Size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "index_", "+_", "in", "Size_", ">_", "self_", "._", "max", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "val_", "=_", "self_", "._", "array_", "[_", "self_", "._", "index_", ":_", "self_", "._", "index_", "+_", "in", "Size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "index_", "+=_", "in", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "return", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "List", "Of", "Non", "Linea", "r", "Solve", "r", "Algorit", "hm", "Names_", "=_", "[_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ",_", "'", "Ne", "lder", "Mea", "d", "'_", ",_", "'", "Pow", "ell", "'_", ",_", "'", "CG", "'_", ",_", "'", "BF", "GS", "'_", ",_", "'", "New", "ton", "-", "CG", "'_", ",_", "'", "Ann", "eal", "'_", ",_", "'", "CO", "BY", "LA", "'_", ",_", "'", "SL", "SQ", "P", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "passi", "ng", " ", "the", " ", "distribu", "tion", " ", "instance", " ", "can", " ", "yield", " ", "\"", "can", "'", "t", " ", "pickle", " ", "instance", "method", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "s", ",", " ", "so", " ", "the", " ", "distribu", "tion", " ", "name", " ", "is", " ", "pass", "ed", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fmin", "Iterat", "ion", "Limit_", "=_", "2500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fmin", "\\u", "xt", "ol_", "=_", "1.0", "E-", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fmin", "\\u", "fto", "l_", "=_", "1.0", "E-", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fmin", "\\u", "Function", "Limit_", "=_", "2500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "Linear_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "in", "Model_", "._", "Can", "Linea", "r", "Solve", "r", "Be", "Us", "ed", "For", "SS", "QA", "BS", "_", "(_", ")_", ")_", "==_", "False_", "and_", "(_", "in", "Model_", "._", "fitting", "Target_", "==_", "\"", "SS", "QA", "BS", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Thi", "s", " ", "equation", " ", "cann", "ot", " ", "use", " ", "a", " ", "linear", " ", "SS", "Q", " ", "solve", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "numpy_", "._", "linalg_", "._", "lst", "sq_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "._", "T_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "Simple", "x_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "scipy_", "._", "optimize_", "._", "fmin", "_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "maxf", "un_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "\\u", "Function", "Limit_", ",_", "disp_", "=_", "0_", ",_", "xt", "ol_", "=_", "self_", "._", "fmin", "\\u", "xt", "ol_", ",_", "fto", "l_", "=_", "self_", "._", "fmin", "\\u", "fto", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "DE_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "#", " ", "adapt", "s", " ", "to", " ", "number", " ", "of", " ", "coefficients_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crossover", "Probabili", "ty", "For", "GA", "_", "=_", "0.75_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "Scale", "For", "GA", "_", "=_", "0.25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Coeff", "icient", "s_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "=_", "500_", "*_", "number", "Of", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", ">_", "1500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "=_", "1500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "Generat", "ion", "s", "For", "GA", "_", "=_", "5_", "*_", "number", "Of", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "Generat", "ion", "s", "For", "GA", "_", ">_", "25_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Generat", "ion", "s", "For", "GA", "_", "=_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "guess", "Divis", "or", "For", "GA", "_", "=_", "10.0_", "*_", "number", "Of", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "guess", "Divis", "or", "For", "GA", "_", ">_", "50.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "guess", "Divis", "or", "For", "GA", "_", "=_", "50.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "Reduce", "d", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "random_", "._", "seed_", "(_", "3_", ")_", "#", " ", "yield", " ", "repeat", "able", " ", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "Value", "s", "Array_", "=_", "numpy_", "._", "random_", "._", "random_", "(_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "*_", "number", "Of", "Coeff", "icient", "s_", ")_", "*_", "2000", ".0_", "-_", "1000.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "small", "Value", "s", "Array_", "=_", "numpy_", "._", "random_", "._", "random_", "(_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "*_", "number", "Of", "Coeff", "icient", "s_", ")_", "*_", "2.0_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tiny", "Value", "s", "Array_", "=_", "numpy_", "._", "random_", "._", "random_", "(_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "*_", "number", "Of", "Coeff", "icient", "s_", ")_", "*_", ".00", "2_", "-_", ".00", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "0_", "=_", "numpy_", "._", "append_", "(_", "large", "Value", "s", "Array_", ",_", "numpy_", "._", "append_", "(_", "small", "Value", "s", "Array_", ",_", "tiny", "Value", "s", "Array_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numpy_", "._", "random_", "._", "shuffle_", "(_", "pop", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pop", "0_", "=_", "pop", "0_", "._", "reshape_", "(_", "one", "Thi", "rd", "Of", "Popula", "tion", "Size", "For", "GA", "_", "*_", "3_", ",_", "number", "Of", "Coeff", "icient", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pop", "0_", "[_", "0_", "]_", "=_", "copy_", "._", "deepcopy_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "#", " ", "DE", " ", "will", " ", "overwrit", "e", " ", "these", " ", "values", ",", " ", "so", " ", "use", " ", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dep", "Data_", "=_", "in", "Model_", "._", "data", "Cache_", "._", "reduce", "d", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sufficient", "Solution_", "=_", "(_", "max_", "(_", "dep", "Data_", ")_", "-_", "min_", "(_", "dep", "Data_", ")_", ")_", "/_", "guess", "Divis", "or", "For", "GA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "de_", "=_", "diff", "ev_", "._", "Diff", "Evol", "ver_", "(_", "in", "Model_", "._", "Calculat", "e", "Reduce", "d", "Data", "Fitt", "ing", "Target_", ",_", "pop", "0_", ",_", "crossover", "\\u", "rate_", "=_", "crossover", "Probabili", "ty", "For", "GA", "_", ",_", "scale_", "=_", "diff", "Scale", "For", "GA", "_", ",_", "prn", "g_", "=_", "custom", "\\u", "prn", "g", "\\u", "for", "\\u", "diff", "ev_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "de_", "._", "solve_", "(_", "sufficient", "Solution_", ",_", "max", "Generat", "ion", "s", "For", "GA", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "de_", "._", "best", "\\u", "vector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "Select", "ed", "Algorithm_", "(_", "self_", ",_", "in", "Model_", ",_", "in", "Algorit", "hm", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "not_", "in_", "self_", "._", "List", "Of", "Non", "Linea", "r", "Solve", "r", "Algorit", "hm", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'\"'_", "+_", "in", "Algorit", "hm", "Name_", "+_", "'\"", " ", "was", " ", "not", " ", "in", " ", "the", " ", "list", " ", "of", " ", "know", "n", " ", "non", "-", "linear", " ", "solve", "r", " ", "algo", "rit", "hm", " ", "names", ".", " ", " ", "Ple", "ase", " ", "see", " ", "the", " ", "Solve", "r", "Service", " ", "class", " ", "definit", "ion", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "Reduce", "d", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "equal", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\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_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "from", " ", "DE_", "\\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_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "#", " ", "initial", " ", "coefficient", "s", " ", "are", " ", "all", " ", "equal", " ", "to", " ", "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 ", " _", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\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_", "#", " ", "try", " ", "usi", "ng", " ", "estimate", "d", " ", "coefficient", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "in", "Algorit", "hm", "Name_", "==_", "'", "Leve", "nbe", "rg", "-", "Mar", "quar", "dt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeffs_", ",_", "unused_", "=_", "scipy_", "._", "optimize_", "._", "curve", "\\u", "fit_", "(_", "in", "Model_", "._", "Wrapper", "For", "Sci", "py", "Curve", "Fit_", ",_", "None_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "maxf", "ev_", "=_", "1000000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeffs_", "=_", "scipy_", "._", "optimize_", "._", "minimize_", "(_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", ",_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "method_", "=_", "in", "Algorit", "hm", "Name_", ",_", "maxiter_", "=_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\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_", "results_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "OD", "R_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Model_", "(_", "in", "Model_", "._", "Wrapper", "For", "OD", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Weig", "hts", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Data_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Inde", "pend", "ent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Weig", "hts", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "Object_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "Data_", "(_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Inde", "pend", "ent", "Data", "'_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "equal", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "with", " ", "initial", " ", "coefficient", "s", " ", "from", " ", "DE_", "\\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 ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "in", "Model_", "._", "de", "Estimated", "Coeff", "icient", "s_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "usi", "ng", " ", "estimate", "d", " ", "coefficient", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "in", "Model_", "._", "Calculat", "e", "All", "Data", "Fitt", "ing", "Target_", "(_", "coeffs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myo", "dr_", "=_", "scipy_", "._", "od", "r_", "._", "od", "rpa", "ck_", "._", "OD", "R_", "(_", "data", "Object_", ",_", "model", "Object_", ",_", "beta", "0_", "=_", "in", "Model_", "._", "estimate", "d", "Coeff", "icient", "s_", ",_", "maxi", "t_", "=_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", "*_", "self_", "._", "fmin", "Iterat", "ion", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myo", "dr_", "._", "set\\u", "job_", "(_", "fit", "\\u", "type_", "=_", "0_", ",_", "deriv_", "=_", "0_", ")_", "#", " ", "explicit", " ", "OD", "R", ",", " ", "faste", "r", " ", "forward", "-", "only", " ", "finite", " ", "difference", "s", " ", "for", " ", "derivatives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "myo", "dr_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "out_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "Q_", "=_", "out_", "._", "sum", "\\u", "square_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "numpy_", "._", "any_", "(_", "numpy_", "._", "isnan_", "(_", "coeffs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "[_", "SS", "Q_", ",_", "coeffs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Model_", "._", "Get", "Coeff", "icient", "Designat", "ors_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "results_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Us", "ing", "Spline", "_", "(_", "self_", ",_", "in", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "in", "Model_", "._", "data", "Cache_", "._", "Fin", "d", "Or", "Creat", "e", "All", "Data", "Cache_", "(_", "in", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "Model_", "._", "Get", "Dimen", "sion", "ality", "_", "(_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Model_", "._", "sci", "py", "Spline", "_", "=_", "scipy_", "._", "interpolate_", "._", "fit", "pack", "2_", "._", "Uni", "varia", "te", "Spline", "_", "(_", "data_", "[_", "0_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "s_", "=_", "in", "Model_", "._", "smoothing", "Factor_", ",_", "k_", "=_", "in", "Model_", "._", "x", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "in", "Model_", "._", "sci", "py", "Spline", "_", "._", "\\u", "eval", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Model_", "._", "sci", "py", "Spline", "_", "=_", "scipy_", "._", "interpolate_", "._", "fit", "pack", "2_", "._", "Smooth", "Bi", "varia", "te", "Spline", "_", "(_", "data_", "[_", "0_", "]_", ",_", "data_", "[_", "1_", "]_", ",_", "in", "Model_", "._", "data", "Cache_", "._", "all", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ",_", "s_", "=_", "in", "Model_", "._", "smoothing", "Factor_", ",_", "kx", "_", "=_", "in", "Model_", "._", "x", "Order_", ",_", "ky_", "=_", "in", "Model_", "._", "y", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "=_", "in", "Model_", "._", "sci", "py", "Spline", "_", "._", "tc", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "in", "Model_", "._", "solved", "Coeff", "icient", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solve", "r", "Service_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "take", "n", " ", "from", " ", "docs", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", ",", " ", "except", " ", "for", " ", "'", "Leve", "nbe", "rg", "=", "Mar", "quar", "dt", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "algo", "rit", "hms", " ", "'", "L", "-", "BF", "GS", "-", "B", "'", " ", "and", " ", "'", "TN", "C", "'", " ", "are", " ", "not", " ", "on", " ", "the", " ", "list", " ", "as", " ", "the", "y", " ", "are", " ", "bounded", " ", "version", "s", " ", "of", " ", "other", " ", "algo", "rit", "hms", " ", "liste", "d", " ", "here", "._", "\\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_", "Solve", "Statistic", "al", "Distribution_", "(_", "self_", ",_", "distribu", "tion", "Name_", ",_", "data_", ",_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crite", "ria", "List_", "=_", "[_", "'", "AI", "C", "'_", ",_", "'", "AI", "Cc", "\\u", "BA", "'_", ",_", "'", "nn", "lf", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "not_", "in_", "crite", "ria", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Criteria", " ", "to", " ", "calcul", "ate", " ", "for", " ", "use", " ", "in", " ", "sorting", " ", "was", " ", "not", " ", "in", "'_", ",_", "str_", "(_", "crite", "ria", "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 ", " _", "exec_", "(_", "'", "distribu", "tion", " ", "=", " ", "sci", "py", ".", "stats", ".'_", "+_", "distribu", "tion", "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 ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "need", " ", "to", " ", "calcul", "ate", " ", "these", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eps_", "=_", "numpy_", "._", "finfo", "_", "(_", "float_", ")_", "._", "eps_", "*_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "min_", "=_", "data_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "max_", "=_", "data_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "mean_", "=_", "data_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "range_", "=_", "data\\u", "max_", "-_", "data\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "std", "\\u", "dev_", "=_", "numpy_", "._", "std_", "(_", "data_", ",_", "dtype_", "=_", "numpy_", "._", "float32_", ")_", "#", " ", "note", " ", "on", " ", "preci", "sion", " ", "http", "://", "docs", ".", "sci", "py", ".", "org", "/", "doc", "/", "nump", "y", "/", "reference", "/", "generat", "ed", "/", "nump", "y", ".", "std", ".", "html", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "different", " ", "startin", "g", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "parameters_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distribution_", "._", "name_", "in_", "[_", "'", "beta", "'_", "]_", ":_", "\\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 ", " _", "range", "Data_", "=_", "(_", "data_", "-_", "data\\u", "min_", ")_", "/_", "data\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "mean_", "=_", "range", "Data_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "var_", "=_", "range", "Data_", "._", "var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "par", "\\u", "a_", "=_", "data\\u", "mean_", "*_", "(_", "(_", "data\\u", "mean_", "*_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "/_", "data\\u", "var_", ")_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "b_", "=_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "*_", "(_", "(_", "data\\u", "mean_", "*_", "(_", "1.0_", "-_", "data\\u", "mean_", ")_", "/_", "data\\u", "var_", ")_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "0_", "=_", "(_", "par", "\\u", "a_", ",_", "par", "\\u", "b_", ",_", "data\\u", "min_", "-_", "0.001_", "*_", "data\\u", "min_", ",_", "data\\u", "range_", "*_", "1.00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "*_", "(_", "par", "0_", "[_", ":_", "-_", "2_", "]_", ")_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "0.01_", "*_", "data\\u", "min_", ",_", "scale_", "=_", "data\\u", "range_", "*_", "1.01", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distribution_", "._", "name_", "in_", "[_", "'", "trunc", "norm", "'_", ",_", "'", "beta", "prim", "e", "'_", ",_", "'", "reciproc", "al", "'_", "]_", ":_", "\\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 ", " _", "par", "0_", "=_", "(_", "data\\u", "mean_", "-_", "2.0_", "*_", "data\\u", "std", "\\u", "dev_", ",_", "data\\u", "mean_", "+_", "2.0_", "*_", "data\\u", "std", "\\u", "dev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "mean_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ",_", "*_", "par", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "0.0_", ",_", "scale_", "=_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "mean_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "max_", "+_", "eps_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "eps_", ",_", "scale_", "=_", "data\\u", "std", "\\u", "dev_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "max_", "+_", "eps_", ",_", "scale_", "=_", "data\\u", "range_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "par", "\\u", "est_", "=_", "tuple_", "(_", "distribution_", "._", "fit_", "(_", "data_", ",_", "loc_", "=_", "data\\u", "min_", "-_", "eps_", ",_", "scale_", "=_", "data\\u", "range_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nn", "lf_", "=_", "distribution_", "._", "nn", "lf_", "(_", "par", "\\u", "est_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numpy_", "._", "isfinite_", "(_", "nn", "lf_", ")_", "and_", "nn", "lf_", "<_", "best", "\\u", "nn", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "best", "\\u", "parameters_", "=_", "par", "\\u", "est_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "nn", "lf_", "=_", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "best", "\\u", "nn", "lf_", "<_", "1.0", "E3", "00_", ")_", "and_", "(_", "best", "\\u", "parameters_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "len_", "(_", "best", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AI", "C_", "=_", "2.0_", "*_", "k_", "+_", "2.0_", "*_", "best", "\\u", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AI", "Cc", "\\u", "BA", "_", "=_", "AI", "C_", "+_", "(_", "(_", "2.0_", "*_", "k_", "*_", "(_", "k_", "+_", "1.0_", ")_", ")_", "/_", "(_", "n_", "-_", "k_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "distribu", "tion", "Name", "'_", "]_", "=_", "distribu", "tion", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "fitted", "Parameter", "s", "'_", "]_", "=_", "best", "\\u", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "nn", "lf", "'_", "]_", "=_", "best", "\\u", "nn", "lf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "AI", "C", "'_", "]_", "=_", "AI", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "[_", "'", "AI", "Cc", "\\u", "BA", "'_", "]_", "=_", "AI", "Cc", "\\u", "BA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "==_", "'", "nn", "lf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "[_", "best", "\\u", "nn", "lf_", ",_", "temp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "Criteria", "For", "Us", "e", "In", "List", "Sort", "ing_", "==_", "'", "AI", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "[_", "AI", "C_", ",_", "temp_", "]_", "\\u\\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_", "[_", "AI", "Cc", "\\u", "BA", "_", ",_", "temp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\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 ]
Unused import
rvanlaar/easy-transifex/src/transifex/transifex/releases/views.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom django.core.urlresolvers import reverse\nfrom django.http import Http404, HttpResponseRedirect, HttpResponse\nfrom django.shortcuts import render_to_response, get_object_or_404\nfrom django.template import RequestContext\nfrom django.utils.translation import ugettext as _\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.db.models import F\n\nfrom actionlog.models import action_logging\nfrom transifex.languages.models import Language\nfrom transifex.projects.models import Project\nfrom transifex.projects.signals import post_release_save\nfrom transifex.projects.permissions import *\nfrom transifex.releases import RELEASE_ALL_DATA\nfrom transifex.releases.models import Release\nfrom transifex.releases.forms import ReleaseForm\nfrom transifex.resources.models import Resource, RLStats\n\n# Temporary\nfrom transifex.txcommon import notifications as txnotification\nfrom transifex.txcommon.decorators import one_perm_required_or_403\nfrom transifex.txcommon.log import logger\n\nfrom django.contrib.syndication.views import feed\nfrom transifex.projects.permissions import pr_project_private_perm\n\n\n\n\n\n\n\n\n# Feeds\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@login_required\n@one_perm_required_or_403(pr_release_add_change,\n (Project, 'slug__exact', 'project_slug'))\ndef release_create_update(request, project_slug, release_slug=None, *args, **kwargs):\n project = get_object_or_404(Project, slug__exact=project_slug)\n if release_slug:\n release = get_object_or_404(Release, slug=release_slug,\n project__slug=project_slug)\n else:\n release = None\n if request.method == 'POST':\n release_form = ReleaseForm(\n project, request.user, request.POST, instance=release\n )\n if release_form.is_valid():\n if release:\n nt = \"project_release_changed\"\n created = False\n else:\n nt = \"project_release_added\"\n created = True\n release = release_form.save()\n context = {'project': project,\n 'release': release,}\n object_list = [project, release]\n action_logging(request.user, object_list, nt, context=context)\n post_release_save.send(sender=None, instance=release,\n created=created, user=request.user)\n return HttpResponseRedirect(\n reverse('release_detail',\n args=[project_slug, release.slug]))\n else:\n release_form = ReleaseForm(project, request.user, instance=release)\n\n return render_to_response('projects/release_form.html', {\n 'form': release_form,\n 'project': project,\n 'release': release,\n }, context_instance=RequestContext(request))", "metadata": "root.release_create_update", "header": "['module', '___EOS___']", "index": 30 }, { "content": "@one_perm_required_or_403(pr_project_private_perm,\n (Project, 'slug__exact', 'project_slug'), anonymous_access=True)\ndef release_detail(request, project_slug, release_slug):\n release = get_object_or_404(Release, slug=release_slug,\n project__slug=project_slug)\n resources = Resource.objects.select_related('project',\n 'source_language').filter(releases=release, project__private=False\n ).order_by('project__name')\n source_languages = set()\n for resource in resources:\n source_languages.add(resource.source_language)\n if request.user in (None, AnonymousUser()):\n private_resources = []\n else:\n private_resources = Resource.objects.select_related('project',\n 'source_language').for_user(request.user).filter(\n releases=release, project__private=True\n ).order_by('project__name').distinct()\n if not len(source_languages) == 1:\n source_languages = ()\n\n statslist = RLStats.objects.select_related('language', 'last_committer'\n ).for_user(request.user).by_release_aggregated(release)\n\n return render_to_response('projects/release_detail.html', {\n 'release': release,\n 'alldata_slug': RELEASE_ALL_DATA['slug'],\n 'project': release.project,\n 'resources': resources,\n 'private_resources': private_resources,\n 'source_languages' : source_languages,\n 'statslist': statslist,\n }, context_instance=RequestContext(request))", "metadata": "root.release_detail", "header": "['module', '___EOS___']", "index": 71 }, { "content": "@one_perm_required_or_403(pr_project_private_perm,\n (Project, 'slug__exact', 'project_slug'), anonymous_access=True)\ndef release_language_detail(request, project_slug, release_slug, language_code):\n\n language = get_object_or_404(Language, code__iexact=language_code)\n project = get_object_or_404(Project, slug__exact=project_slug)\n release = get_object_or_404(Release, slug__exact=release_slug,\n project__id=project.pk)\n\n stats = RLStats.objects.select_related('resource',\n 'resource__project').public().by_release_and_language(release, language)\n\n private_stats = RLStats.objects.select_related('resource',\n 'resource__project', 'lock').for_user(request.user\n ).private().by_release_and_language(release, language)\n\n empty_rlstats = Resource.objects.filter(id__in=release.resources.all(),\n project__private=False).exclude(\n id__in=stats.values('resource'))\n\n empty_private_rlstats = Resource.objects.for_user(request.user).filter(\n id__in=release.resources.all(), project__private=True).exclude(\n id__in=private_stats.values('resource'))\n\n return render_to_response('projects/release_language_detail.html', {\n 'project': project,\n 'release': release,\n 'language': language,\n 'stats': stats,\n 'empty_rlstats': empty_rlstats,\n 'empty_private_rlstats': empty_private_rlstats,\n 'private_stats': private_stats,\n }, context_instance=RequestContext(request))", "metadata": "root.release_language_detail", "header": "['module', '___EOS___']", "index": 105 }, { "content": "@login_required\n@one_perm_required_or_403(pr_release_delete,\n (Project, 'slug__exact', 'project_slug'))\ndef release_delete(request, project_slug, release_slug):\n release = get_object_or_404(Release, slug=release_slug,\n project__slug=project_slug)\n if request.method == 'POST':\n import copy\n release_ = copy.copy(release)\n release.delete()\n messages.success(request,\n _(\"The release '%s' was deleted.\") % release.full_name)\n\n # ActionLog & Notification\n nt = 'project_release_deleted'\n context = {'release': release_}\n action_logging(request.user, [release_.project], nt, context=context)\n if settings.ENABLE_NOTICES:\n txnotification.send_observation_notices_for(release_.project,\n signal=nt, extra_context=context)\n\n return HttpResponseRedirect(reverse('project_detail',\n args=(project_slug,)))\n else:\n return render_to_response('projects/release_confirm_delete.html',\n {'release': release,},\n context_instance=RequestContext(request))", "metadata": "root.release_delete", "header": "['module', '___EOS___']", "index": 140 }, { "content": "@one_perm_required_or_403(pr_project_private_perm,\n (Project, 'slug__exact', 'project_slug'), anonymous_access=True)\ndef release_feed(request, project_slug, release_slug, slug=None, param='',\n feed_dict=None,):\n param = '%s/%s' % (project_slug, release_slug)\n if slug:\n url = \"%s/%s\" % (slug, param)\n else:\n url = param\n return feed(request, url, feed_dict)", "metadata": "root.release_feed", "header": "['module', '___EOS___']", "index": 170 }, { "content": "@one_perm_required_or_403(pr_project_private_perm,\n (Project, 'slug__exact', 'project_slug'), anonymous_access=True)\ndef release_language_feed(request, project_slug, release_slug, language_code,\n slug=None, param='', feed_dict=None,):\n param = '%s/%s/%s' % (project_slug, release_slug, language_code)\n if slug:\n url = \"%s/%s\" % (slug, param)\n else:\n url = param\n return feed(request, url, feed_dict)", "metadata": "root.release_language_feed", "header": "['module', '___EOS___']", "index": 182 } ]
[ { "span": "from django.http import Http404, HttpResponseRedirect, HttpResponse", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 67 }, { "span": "from django.db.models import F", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 30 }, { "span": "from transifex.txcommon.log import logger", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", ",_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", ",_", "get", "\\u", "object\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Ano", "nym", "ous", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "action", "log_", "._", "models_", "import_", "action", "\\u", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "languages_", "._", "models_", "import_", "Language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "models_", "import_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "signals_", "import_", "post", "\\u", "release", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "permissions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "releases_", "import_", "RELEASE", "\\u", "ALL", "\\u", "DATA_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "releases_", "._", "models_", "import_", "Release_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "releases_", "._", "forms_", "import_", "Release", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "resources_", "._", "models_", "import_", "Resource_", ",_", "RL", "Stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tempora", "ry_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "import_", "notifications_", "as_", "tx", "notification_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "._", "decorators_", "import_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "tx", "common_", "._", "log_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "syn", "dicat", "ion_", "._", "views_", "import_", "feed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trans", "ife", "x_", "._", "projects_", "._", "permissions_", "import_", "pr", "\\u", "project", "\\u", "private", "\\u", "perm_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Feed", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "release", "\\u", "add", "\\u", "change_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "create", "\\u", "update_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Project_", ",_", "slug", "\\u\\u", "exact_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "release", "\\u", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Release_", ",_", "slug_", "=_", "release", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "form_", "=_", "Release", "Form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", ",_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ",_", "instance_", "=_", "release_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "release", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nt_", "=_", "\"", "project", "\\u", "release", "\\u", "change", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "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 ", " _", "nt_", "=_", "\"", "project", "\\u", "release", "\\u", "adde", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "release_", "=_", "release", "\\u", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "'", "project", "'_", ":_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "'_", ":_", "release_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "[_", "project_", ",_", "release_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "logging_", "(_", "request_", "._", "user_", ",_", "object\\u", "list_", ",_", "nt_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "release", "\\u", "save_", "._", "send_", "(_", "sender_", "=_", "None_", ",_", "instance_", "=_", "release_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "created_", "=_", "created_", ",_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "release", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "project", "\\u", "slug_", ",_", "release_", "._", "slug_", "]_", ")_", ")_", "\\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 ", " _", "release", "\\u", "form_", "=_", "Release", "Form_", "(_", "project_", ",_", "request_", "._", "user_", ",_", "instance_", "=_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "project", "s", "/", "release", "\\u", "form", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "release", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "'_", ":_", "release_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "project", "\\u", "private", "\\u", "perm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ",_", "anonym", "ous", "\\u", "access_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "detail_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Release_", ",_", "slug_", "=_", "release", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "Resource_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "language", "'_", ")_", "._", "filter_", "(_", "releases_", "=_", "release_", ",_", "project", "\\u\\u", "private_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "order", "\\u", "by_", "(_", "'", "project", "\\u\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "languages_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "resource_", "in_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "languages_", "._", "add_", "(_", "resource_", "._", "source", "\\u", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "user_", "in_", "(_", "None_", ",_", "Ano", "nym", "ous", "User_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "private", "\\u", "resources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "private", "\\u", "resources_", "=_", "Resource_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "language", "'_", ")_", "._", "for", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "releases_", "=_", "release_", ",_", "project", "\\u\\u", "private_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "order", "\\u", "by_", "(_", "'", "project", "\\u\\u", "name", "'_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "source", "\\u", "languages_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "languages_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats", "list_", "=_", "RL", "Stats_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "language", "'_", ",_", "'", "last", "\\u", "committer", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "for", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "by", "\\u", "release", "\\u", "aggregated", "_", "(_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "project", "s", "/", "release", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "'_", ":_", "release_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alld", "ata", "\\u", "slug", "'_", ":_", "RELEASE", "\\u", "ALL", "\\u", "DATA_", "[_", "'", "slug", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "release_", "._", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "s", "'_", ":_", "resources_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "private", "\\u", "resource", "s", "'_", ":_", "private", "\\u", "resources_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "language", "s", "'_", ":_", "source", "\\u", "languages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stats", "list", "'_", ":_", "stats", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "project", "\\u", "private", "\\u", "perm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ",_", "anonym", "ous", "\\u", "access_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "language", "\\u", "detail_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ",_", "language", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "language_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Language_", ",_", "code", "\\u\\u", "iex", "act_", "=_", "language", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Project_", ",_", "slug", "\\u\\u", "exact_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Release_", ",_", "slug", "\\u\\u", "exact_", "=_", "release", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "id_", "=_", "project_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "RL", "Stats_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "resource", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u\\u", "project", "'_", ")_", "._", "public_", "(_", ")_", "._", "by", "\\u", "release", "\\u", "and", "\\u", "language_", "(_", "release_", ",_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "private", "\\u", "stats_", "=_", "RL", "Stats_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "resource", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resource", "\\u\\u", "project", "'_", ",_", "'", "lock", "'_", ")_", "._", "for", "\\u", "user_", "(_", "request_", "._", "user_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "private_", "(_", ")_", "._", "by", "\\u", "release", "\\u", "and", "\\u", "language_", "(_", "release_", ",_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "rls", "tats_", "=_", "Resource_", "._", "objects_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "release_", "._", "resources_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "private_", "=_", "False_", ")_", "._", "exclude_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "in_", "=_", "stats_", "._", "values_", "(_", "'", "resource", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "private", "\\u", "rls", "tats_", "=_", "Resource_", "._", "objects_", "._", "for", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "in_", "=_", "release_", "._", "resources_", "._", "all_", "(_", ")_", ",_", "project", "\\u\\u", "private_", "=_", "True_", ")_", "._", "exclude_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "in_", "=_", "private", "\\u", "stats_", "._", "values_", "(_", "'", "resource", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "project", "s", "/", "release", "\\u", "language", "\\u", "deta", "il", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "'_", ":_", "release_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stats", "'_", ":_", "stats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "\\u", "rls", "tats", "'_", ":_", "empty", "\\u", "rls", "tats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "\\u", "private", "\\u", "rls", "tats", "'_", ":_", "empty", "\\u", "private", "\\u", "rls", "tats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "private", "\\u", "stats", "'_", ":_", "private", "\\u", "stats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "release", "\\u", "delete_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "delete_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Release_", ",_", "slug_", "=_", "release", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u\\u", "slug_", "=_", "project", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release", "\\u_", "=_", "copy_", "._", "copy_", "(_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "The", " ", "release", " ", "'%", "s", "'", " ", "was", " ", "delete", "d", ".\"_", ")_", "%_", "release_", "._", "full", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Action", "Log", " ", "&", " ", "Notification_", "\\u\\u\\uNL\\u\\u\\u_", "nt_", "=_", "'", "project", "\\u", "release", "\\u", "delete", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "'", "release", "'_", ":_", "release", "\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "logging_", "(_", "request_", "._", "user_", ",_", "[_", "release", "\\u_", "._", "project_", "]_", ",_", "nt_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "ENABLE", "\\u", "NOTICE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "notification_", "._", "send", "\\u", "observa", "tion", "\\u", "notice", "s", "\\u", "for_", "(_", "release", "\\u_", "._", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signal_", "=_", "nt_", ",_", "extra", "\\u", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "'", "project", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "project", "\\u", "slug_", ",_", ")_", ")_", ")_", "\\u\\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_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "project", "s", "/", "release", "\\u", "confirm", "\\u", "delete", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "release", "'_", ":_", "release_", ",_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "project", "\\u", "private", "\\u", "perm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ",_", "anonym", "ous", "\\u", "access_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "feed_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ",_", "slug_", "=_", "None_", ",_", "param_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feed", "\\u", "dict_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "slug_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "feed_", "(_", "request_", ",_", "url_", ",_", "feed", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "one", "\\u", "perm", "\\u", "require", "d\\u", "or", "\\u", "403_", "(_", "pr", "\\u", "project", "\\u", "private", "\\u", "perm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Project_", ",_", "'", "slug", "\\u\\u", "exact", "'_", ",_", "'", "project", "\\u", "slug", "'_", ")_", ",_", "anonym", "ous", "\\u", "access_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "release", "\\u", "language", "\\u", "feed_", "(_", "request_", ",_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ",_", "language", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "None_", ",_", "param_", "=_", "''_", ",_", "feed", "\\u", "dict_", "=_", "None_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "project", "\\u", "slug_", ",_", "release", "\\u", "slug_", ",_", "language", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "slug_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "feed_", "(_", "request_", ",_", "url_", ",_", "feed", "\\u", "dict_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/cache.py
[ { "content": "def get(function, timeout, *args, **table):\n try:\n response = None\n\n f = repr(function)\n f = re.sub('.+\\smethod\\s|.+function\\s|\\sat\\s.+|\\sof\\s.+', '', f)\n\n a = hashlib.md5()\n for i in args: a.update(str(i))\n a = str(a.hexdigest())\n except:\n pass\n\n try:\n table = table['table']\n except:\n table = 'rel_list'\n\n try:\n control.makeFile(control.dataPath)\n dbcon = database.connect(control.cacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"SELECT * FROM %s WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n match = dbcur.fetchone()\n\n response = eval(match[2].encode('utf-8'))\n\n t1 = int(match[3])\n t2 = int(time.time())\n update = (abs(t2 - t1) / 3600) >= int(timeout)\n if update == False:\n return response\n except:\n pass\n\n try:\n r = function(*args)\n if (r == None or r == []) and not response == None:\n return response\n elif (r == None or r == []):\n return r\n except:\n return\n\n try:\n r = repr(r)\n t = int(time.time())\n dbcur.execute(\"CREATE TABLE IF NOT EXISTS %s (\"\"func TEXT, \"\"args TEXT, \"\"response TEXT, \"\"added TEXT, \"\"UNIQUE(func, args)\"\");\" % table)\n dbcur.execute(\"DELETE FROM %s WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n dbcur.execute(\"INSERT INTO %s Values (?, ?, ?, ?)\" % table, (f, a, r, t))\n dbcon.commit()\n except:\n pass\n\n try:\n return eval(r.encode('utf-8'))\n except:\n pass", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def clear(table=None):\n try:\n control.idle()\n\n if table == None: table = ['rel_list', 'rel_lib']\n elif not type(table) == list: table = [table]\n\n yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')\n if not yes: return\n\n dbcon = database.connect(control.cacheFile)\n dbcur = dbcon.cursor()\n\n for t in table:\n try:\n dbcur.execute(\"DROP TABLE IF EXISTS %s\" % t)\n dbcur.execute(\"VACUUM\")\n dbcon.commit()\n except:\n pass\n\n control.infoDialog(control.lang(30402).encode('utf-8'))\n except:\n pass", "metadata": "root.clear", "header": "['module', '___EOS___']", "index": 91 } ]
[ { "span": "r == None ", "start_line": 68, "start_column": 12, "end_line": 68, "end_column": 21 }, { "span": "response == None:", "start_line": 68, "start_column": 42, "end_line": 68, "end_column": 58 }, { "span": "r == None ", "start_line": 70, "start_column": 14, "end_line": 70, "end_column": 23 }, { "span": "table == None:", "start_line": 95, "start_column": 11, "end_line": 95, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "function_", ",_", "timeout_", ",_", "*_", "args_", ",_", "**_", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "repr_", "(_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "re_", "._", "sub_", "(_", "'.", "+\\\\", "sme", "thod", "\\\\", "s", "|.", "+", "function", "\\\\", "s", "|\\\\", "sat", "\\\\", "s", ".+", "|\\\\", "sof", "\\\\", "s", ".+", "'_", ",_", "''_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "args_", ":_", "a_", "._", "update_", "(_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "str_", "(_", "a_", "._", "hexdigest_", "(_", ")_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "table_", "[_", "'", "table", "'_", "]_", "\\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 ", " _", "table_", "=_", "'", "rel", "\\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 ", " _", "control_", "._", "make", "File_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "cache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"_", "%_", "(_", "table_", ",_", "f_", ",_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "eval_", "(_", "match_", "[_", "2_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "int_", "(_", "match_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update_", "=_", "(_", "abs_", "(_", "t2_", "-_", "t1_", ")_", "/_", "3600_", ")_", ">=_", "int_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "function_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "r_", "==_", "None_", "or_", "r_", "==_", "[_", "]_", ")_", "and_", "not_", "response_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "r_", "==_", "None_", "or_", "r_", "==_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "r_", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repr_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "%", "s", " ", "(\"_", "\"", "func", " ", "TEXT", ",", " ", "\"_", "\"", "args", " ", "TEXT", ",", " ", "\"_", "\"", "response", " ", "TEXT", ",", " ", "\"_", "\"", "adde", "d", " ", "TEXT", ",", " ", "\"_", "\"", "UNI", "QUE", "(", "func", ",", " ", "args", ")\"_", "\");", "\"_", "%_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "DELET", "E", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"_", "%_", "(_", "table_", ",_", "f_", ",_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "%", "s", " ", "Value", "s", " ", "(?", ",", " ", "?", ",", " ", "?", ",", " ", "?)\"_", "%_", "table_", ",_", "(_", "f_", ",_", "a_", ",_", "r_", ",_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "eval_", "(_", "r_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\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]_", "module_", "\\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_", "clear_", "(_", "table_", "=_", "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 ", " _", "control_", "._", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "table_", "==_", "None_", ":_", "table_", "=_", "[_", "'", "rel", "\\u", "list", "'_", ",_", "'", "rel", "\\u", "lib", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "not_", "type_", "(_", "table_", ")_", "==_", "list_", ":_", "table_", "=_", "[_", "table_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yes_", "=_", "control_", "._", "yesno", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "01_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yes_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "cache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbc", "ur_", "._", "execute_", "(_", "\"", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "%", "s", "\"_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "VA", "CU", "UM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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_", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "02_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
fredrik-johansson/mpmath/mpmath/libmp/libelefun.py
[ { "content": "def agm_fixed(a, b, prec):\n \"\"\"\n Fixed-point computation of agm(a,b), assuming\n a, b both close to unit magnitude.\n \"\"\"\n i = 0\n while 1:\n anew = (a+b)>>1\n if i > 4 and abs(a-anew) < 8:\n return a\n b = isqrt_fast(a*b)\n a = anew\n i += 1\n return a", "metadata": "root.agm_fixed", "header": "['module', '___EOS___']", "index": 537 } ]
[ { "span": "return a", "start_line": 550, "start_column": 4, "end_line": 550, "end_column": 12 } ]
[]
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_", "ag", "m", "\\u", "fixed_", "(_", "a_", ",_", "b_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fix", "ed", "-", "point", " ", "computation", " ", "of", " ", "ag", "m", "(", "a", ",", "b", "),", " ", "ass", "umi", "ng", "\\", "10", ";", " ", " ", " ", " ", "a", ",", " ", "b", " ", "bot", "h", " ", "close", " ", "to", " ", "unit", " ", "magnitude", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ane", "w_", "=_", "(_", "a_", "+_", "b_", ")_", ">>_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">_", "4_", "and_", "abs_", "(_", "a_", "-_", "ane", "w_", ")_", "<_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "=_", "is", "qr", "t", "\\u", "fast_", "(_", "a_", "*_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "ane", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "a_", "\\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, 0, 1, 1, 2 ]
Module is imported more than once
cwolfram/inge/lib/getwarranty.py
[ { "content": "#!/usr/bin/env python3\n\n# Version 2.1\n# Apple has again changed the warranty lookup method and now redirects to\n# a CAPTCHA protected page at https://checkcoverage.apple.com/\n# As such, no \"online\" warranty status is now possible. All warranty\n# information is now estimated.\n#\n# API changes:\n# .online_warranty and .offline_warranty are deprecated and both\n# now point to the replacement .warranty (which is offline only)\n\n# To use as a python module:\n# import getwarranty\n# results = getwarranty.warranty( ... one or more serials ... )\n\n\"\"\"Usage: getwarranty [OPTION ...] [SERIAL1 SERIAL2 ...]\n\nList warranty information for one or more Apple devices.\n\nIf no serial number is provided on the command-line, the script will\nassume it's running on an OS X machine and attempt to query the local\nserial number and provide information regarding it.\n\nDefault output is \"ATTRIBUTE: value\", per line. Use the options below\nfor alternate format output.\n\nOptions:\n-h, --help Display this message\n-f, --file FILE Read serial numbers from FILE (one per line)\n-o, --output Save output to specified file instead of stdout\n-c, --csv Output in comma-separated format\n-t, --tsv Output in tab-separated format\n\nExample usage:\nRead from file, save to csv: getwarranty -f serials.txt -o output.csv\nPrint local serial to stdout: getwarranty\nSeveral serials to stdout: getwarranty SERIAL1 SERIAL2 SERIAL3\n\"\"\"\n\nimport sys, subprocess, datetime, os.path, dateutil.parser\nimport re, types, time, getopt, csv, codecs\nfrom io import StringIO\nimport xml.etree.ElementTree as ET \n# import pickle --- no longer doing pickles, switch to json\ntry:\n import json\nexcept:\n import simplejson as json\n\ntry:\n import requests\nexcept:\n # My strange hack to use standard libs, if requests module isn't available\n # http://docs.python-requests.org/en/latest/index.html\n # Really, check it out - it's great\n import urllib, types\n import urllib2 as requests\n setattr(requests,'content','')\n requests.get = types.MethodType(get,requests)\n\nasd_db = {}\nmodel_db = {}\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Deprecated, see notes above\nonline_warranty_generator = warranty_generator\n\n# Deprecated, see notes above\nonline_warranty = warranty\n\n# Deprecated, see notes above\noffline_warranty_generator = warranty_generator\n\n# Deprecated, see notes above\noffline_warranty = warranty\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import urllib, types", "start_line": 56, "start_column": 4, "end_line": 56, "end_column": 24 } ]
[ { "span": "import re, types, time, getopt, csv, codecs", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 43 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "2.1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apple", " ", "has", " ", "again", " ", "change", "d", " ", "the", " ", "warr", "ant", "y", " ", "look", "up", " ", "method", " ", "and", " ", "now", " ", "redirec", "ts", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "CAPT", "CHA", " ", "protect", "ed", " ", "page", " ", "at", " ", "https", "://", "check", "covera", "ge", ".", "apple", ".", "com", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "suc", "h", ",", " ", "no", " ", "\"", "onli", "ne", "\"", " ", "warr", "ant", "y", " ", "status", " ", "is", " ", "now", " ", "possib", "le", ".", " ", "All", " ", "warr", "ant", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "on", " ", "is", " ", "now", " ", "estimate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", " ", "change", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "onli", "ne", "\\u", "warr", "ant", "y", " ", "and", " ", ".", "offline", "\\u", "warr", "ant", "y", " ", "are", " ", "depre", "cated", " ", "and", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "point", " ", "to", " ", "the", " ", "replace", "ment", " ", ".", "warr", "ant", "y", " ", "(", "whi", "ch", " ", "is", " ", "offline", " ", "only", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "use", " ", "as", " ", "a", " ", "python", " ", "module", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "getw", "arr", "ant", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", " ", "getw", "arr", "ant", "y", ".", "warr", "ant", "y", "(", " ", "...", " ", "one", " ", "or", " ", "more", " ", "serial", "s", " ", "...", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Us", "age", ":", " ", "getw", "arr", "ant", "y", " ", "[", "OPTION", " ", "...]", " ", "[", "SERIAL", "1", " ", "SERIAL", "2", " ", "...]", "\\", "10", ";", "\\", "10", ";", "List", " ", "warr", "ant", "y", " ", "informati", "on", " ", "for", " ", "one", " ", "or", " ", "more", " ", "Apple", " ", "device", "s", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "no", " ", "serial", " ", "number", " ", "is", " ", "provided", " ", "on", " ", "the", " ", "command", "-", "line", ",", " ", "the", " ", "script", " ", "will", "\\", "10", ";", "assume", " ", "it", "'", "s", " ", "runn", "ing", " ", "on", " ", "an", " ", "OS", " ", "X", " ", "machine", " ", "and", " ", "atte", "mpt", " ", "to", " ", "query", " ", "the", " ", "local", "\\", "10", ";", "serial", " ", "number", " ", "and", " ", "provide", " ", "informati", "on", " ", "regarding", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", "Default", " ", "output", " ", "is", " ", "\"", "ATTRIBUTE", ":", " ", "value", "\",", " ", "per", " ", "line", ".", " ", "Us", "e", " ", "the", " ", "options", " ", "belo", "w", "\\", "10", ";", "for", " ", "alternat", "e", " ", "format", " ", "output", ".", "\\", "10", ";", "\\", "10", ";", "Optio", "ns", ":", "\\", "10", ";", "-", "h", ",", " ", "--", "help", " ", " ", "Display", " ", "this", " ", "message", "\\", "10", ";", "-", "f", ",", " ", "--", "file", " ", "FILE", " ", "Read", " ", "serial", " ", "numbers", " ", "from", " ", "FILE", " ", "(", "one", " ", "per", " ", "line", ")", "\\", "10", ";", "-", "o", ",", " ", "--", "output", " ", " ", " ", " ", "Save", " ", "output", " ", "to", " ", "specified", " ", "file", " ", "inst", "ead", " ", "of", " ", "stdout", "\\", "10", ";", "-", "c", ",", " ", "--", "csv", " ", " ", " ", "Output", " ", "in", " ", "comma", "-", "separate", "d", " ", "format", "\\", "10", ";", "-", "t", ",", " ", "--", "tsv", " ", " ", " ", "Output", " ", "in", " ", "tab", "-", "separate", "d", " ", "format", "\\", "10", ";", "\\", "10", ";", "Exam", "ple", " ", "usage", ":", "\\", "10", ";", "Read", " ", "from", " ", "file", ",", " ", "save", " ", "to", " ", "csv", ":", " ", " ", " ", " ", "getw", "arr", "ant", "y", " ", "-", "f", " ", "serial", "s", ".", "txt", " ", "-", "o", " ", "output", ".", "csv", "\\", "10", ";", "Print", " ", "local", " ", "serial", " ", "to", " ", "stdout", ":", " ", " ", " ", "getw", "arr", "ant", "y", "\\", "10", ";", "Seve", "ral", " ", "serial", "s", " ", "to", " ", "stdout", ":", " ", " ", "getw", "arr", "ant", "y", " ", "SERIAL", "1", " ", "SERIAL", "2", " ", "SERIAL", "3", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "subprocess_", ",_", "datetime_", ",_", "os_", "._", "path_", ",_", "dateutil_", "._", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", ",_", "types_", ",_", "time_", ",_", "getopt_", ",_", "csv_", ",_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "import", " ", "pickle", " ", " ", " ", "---", " ", "no", " ", "long", "er", " ", "doi", "ng", " ", "pickle", "s", ",", " ", "switch", " ", "to", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\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_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "My", " ", "stran", "ge", " ", "hack", " ", "to", " ", "use", " ", "standard", " ", "libs", ",", " ", "if", " ", "request", "s", " ", "module", " ", "isn", "'", "t", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "docs", ".", "python", "-", "request", "s", ".", "org", "/", "en", "/", "late", "st", "/", "index", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Real", "ly", ",", " ", "check", " ", "it", " ", "out", " ", "-", " ", "it", "'", "s", " ", "great", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "urllib_", ",_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "as_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "requests_", ",_", "'", "content", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requests_", "._", "get_", "=_", "types_", "._", "Meth", "od", "Type_", "(_", "get_", ",_", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asd", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "db_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "onli", "ne", "\\u", "warr", "ant", "y", "\\u", "generator_", "=_", "warr", "ant", "y", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "onli", "ne", "\\u", "warr", "ant", "y_", "=_", "warr", "ant", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "offline", "\\u", "warr", "ant", "y", "\\u", "generator_", "=_", "warr", "ant", "y", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ",", " ", "see", " ", "note", "s", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "offline", "\\u", "warr", "ant", "y_", "=_", "warr", "ant", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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, 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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, 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, 2, 2, 2, 2, 2, 2, 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'
uwdata/termite-data-server/web2py/gluon/globals.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n| This file is part of the web2py Web Framework\n| Copyrighted by Massimo Di Pierro <[email protected]>\n| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nContains the classes for the global used variables:\n\n- Request\n- Response\n- Session\n\n\"\"\"\n\nfrom gluon.storage import Storage, List\nfrom gluon.streamer import streamer, stream_file_or_304_or_206, DEFAULT_CHUNK_SIZE\nfrom gluon.xmlrpc import handler\nfrom gluon.contenttype import contenttype\nfrom gluon.html import xmlescape, TABLE, TR, PRE, URL\nfrom gluon.http import HTTP, redirect\nfrom gluon.fileutils import up\nfrom gluon.serializers import json, custom_json\nimport gluon.settings as settings\nfrom gluon.utils import web2py_uuid, secure_dumps, secure_loads\nfrom gluon.settings import global_settings\nimport hashlib\nimport portalocker\nimport cPickle\nfrom pickle import Pickler, MARK, DICT, EMPTY_DICT\nfrom types import DictionaryType\nimport cStringIO\nimport datetime\nimport re\nimport Cookie\nimport os\nimport sys\nimport traceback\nimport threading\nimport cgi\nimport copy\nimport tempfile\nfrom gluon.cache import CacheInRam\nfrom gluon.fileutils import copystream\n\nFMT = '%a, %d-%b-%Y %H:%M:%S PST'\nPAST = 'Sat, 1-Jan-1971 00:00:00'\nFUTURE = 'Tue, 1-Dec-2999 23:59:59'\n\ntry:\n from gluon.contrib.minify import minify\n have_minify = True\nexcept ImportError:\n have_minify = False\n\ntry:\n import simplejson as sj #external installed library\nexcept:\n try:\n import json as sj #standard installed library\n except:\n import gluon.contrib.simplejson as sj #pure python library\n\nregex_session_id = re.compile('^([\\w\\-]+/)?[\\w\\-\\.]+$')\n\n__all__ = ['Request', 'Response', 'Session']\n\ncurrent = threading.local() # thread-local storage for request-scope globals\n\ncss_template = '<link href=\"%s\" rel=\"stylesheet\" type=\"text/css\" />'\njs_template = '<script src=\"%s\" type=\"text/javascript\"></script>'\ncoffee_template = '<script src=\"%s\" type=\"text/coffee\"></script>'\ntypescript_template = '<script src=\"%s\" type=\"text/typescript\"></script>'\nless_template = '<link href=\"%s\" rel=\"stylesheet/less\" type=\"text/css\" />'\ncss_inline = '<style type=\"text/css\">\\n%s\\n</style>'\njs_inline = '<script type=\"text/javascript\">\\n%s\\n</script>'\n\n# IMPORTANT:\n# this is required so that pickled dict(s) and class.__dict__\n# are sorted and web2py can detect without ambiguity when a session changes\n\nSortingPickler.dispatch = copy.copy(Pickler.dispatch)\nSortingPickler.dispatch[DictionaryType] = SortingPickler.save_dict\n\n# END #####################################################################\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def parse_post_vars(self):\n \"\"\"Takes the body of the request and unpacks it into\n post_vars. application/json is also automatically parsed\n \"\"\"\n env = self.env\n post_vars = self._post_vars = Storage()\n body = self.body\n #if content-type is application/json, we must read the body\n is_json = env.get('content_type', '')[:16] == 'application/json'\n\n if is_json:\n try:\n json_vars = sj.load(body)\n except:\n # incoherent request bodies can still be parsed \"ad-hoc\"\n json_vars = {}\n pass\n # update vars and get_vars with what was posted as json\n if isinstance(json_vars, dict):\n post_vars.update(json_vars)\n\n body.seek(0)\n\n # parse POST variables on POST, PUT, BOTH only in post_vars\n if (body and not is_json\n and env.request_method in ('POST', 'PUT', 'DELETE', 'BOTH')):\n query_string = env.pop('QUERY_STRING',None)\n dpost = cgi.FieldStorage(fp=body, environ=env, keep_blank_values=1)\n try:\n post_vars.update(dpost)\n except: pass\n if query_string is not None:\n env['QUERY_STRING'] = query_string\n # The same detection used by FieldStorage to detect multipart POSTs\n body.seek(0)\n\n def listify(a):\n return (not isinstance(a, list) and [a]) or a\n try:\n keys = sorted(dpost)\n except TypeError:\n keys = []\n for key in keys:\n if key is None:\n continue # not sure why cgi.FieldStorage returns None key\n dpk = dpost[key]\n # if an element is not a file replace it with\n # its value else leave it alone\n\n pvalue = listify([(_dpk if _dpk.filename else _dpk.value)\n for _dpk in dpk] \n if isinstance(dpk, list) else\n (dpk if dpk.filename else dpk.value))\n if len(pvalue):\n post_vars[key] = (len(pvalue) > 1 and pvalue) or pvalue[0]", "metadata": "root.Request.parse_post_vars", "header": "['class', 'Request', '(', 'Storage', ')', ':', '___EOS___']", "index": 197 }, { "content": " def connect(\n self,\n request=None,\n response=None,\n db=None,\n tablename='web2py_session',\n masterapp=None,\n migrate=True,\n separate=None,\n check_client=False,\n cookie_key=None,\n cookie_expires=None,\n compression_level=None\n ):\n \"\"\"\n Used in models, allows to customize Session handling\n\n Args:\n request: the request object\n response: the response object\n db: to store/retrieve sessions in db (a table is created)\n tablename(str): table name\n masterapp(str): points to another's app sessions. This enables a\n \"SSO\" environment among apps\n migrate: passed to the underlying db\n separate: with True, creates a folder with the 2 initials of the\n session id. Can also be a function, e.g. ::\n\n separate=lambda(session_name): session_name[-2:]\n\n check_client: if True, sessions can only come from the same ip\n cookie_key(str): secret for cookie encryption\n cookie_expires: sets the expiration of the cookie\n compression_level(int): 0-9, sets zlib compression on the data\n before the encryption\n \"\"\"\n request = request or current.request\n response = response or current.response\n masterapp = masterapp or request.application\n cookies = request.cookies\n\n self._unlock(response)\n\n response.session_masterapp = masterapp\n response.session_id_name = 'session_id_%s' % masterapp.lower()\n response.session_data_name = 'session_data_%s' % masterapp.lower()\n response.session_cookie_expires = cookie_expires\n response.session_client = str(request.client).replace(':', '.')\n response.session_cookie_key = cookie_key\n response.session_cookie_compression_level = compression_level\n\n # check if there is a session_id in cookies\n try:\n old_session_id = cookies[response.session_id_name].value\n except KeyError:\n old_session_id = None\n response.session_id = old_session_id\n\n # if we are supposed to use cookie based session data\n if cookie_key:\n response.session_storage_type = 'cookie'\n elif db:\n response.session_storage_type = 'db'\n else:\n response.session_storage_type = 'file'\n # why do we do this?\n # because connect may be called twice, by web2py and in models.\n # the first time there is no db yet so it should do nothing\n if (global_settings.db_sessions is True or\n masterapp in global_settings.db_sessions):\n return\n\n if response.session_storage_type == 'cookie':\n # check if there is session data in cookies\n if response.session_data_name in cookies:\n session_cookie_data = cookies[response.session_data_name].value\n else:\n session_cookie_data = None\n if session_cookie_data:\n data = secure_loads(session_cookie_data, cookie_key,\n compression_level=compression_level)\n if data:\n self.update(data)\n response.session_id = True\n\n # else if we are supposed to use file based sessions\n elif response.session_storage_type == 'file':\n response.session_new = False\n response.session_file = None\n # check if the session_id points to a valid sesion filename\n if response.session_id:\n if not regex_session_id.match(response.session_id):\n response.session_id = None\n else:\n response.session_filename = \\\n os.path.join(up(request.folder), masterapp,\n 'sessions', response.session_id)\n try:\n response.session_file = \\\n open(response.session_filename, 'rb+')\n portalocker.lock(response.session_file,\n portalocker.LOCK_EX)\n response.session_locked = True\n self.update(cPickle.load(response.session_file))\n response.session_file.seek(0)\n oc = response.session_filename.split('/')[-1].split('-')[0]\n if check_client and response.session_client != oc:\n raise Exception(\"cookie attack\")\n except:\n response.session_id = None\n if not response.session_id:\n uuid = web2py_uuid()\n response.session_id = '%s-%s' % (response.session_client, uuid)\n separate = separate and (lambda session_name: session_name[-2:])\n if separate:\n prefix = separate(response.session_id)\n response.session_id = '%s/%s' % (prefix, response.session_id)\n response.session_filename = \\\n os.path.join(up(request.folder), masterapp,\n 'sessions', response.session_id)\n response.session_new = True\n\n # else the session goes in db\n elif response.session_storage_type == 'db':\n if global_settings.db_sessions is not True:\n global_settings.db_sessions.add(masterapp)\n # if had a session on file alreday, close it (yes, can happen)\n if response.session_file:\n self._close(response)\n # if on GAE tickets go also in DB\n if settings.global_settings.web2py_runtime_gae:\n request.tickets_db = db\n if masterapp == request.application:\n table_migrate = migrate\n else:\n table_migrate = False\n tname = tablename + '_' + masterapp\n table = db.get(tname, None)\n Field = db.Field\n if table is None:\n db.define_table(\n tname,\n Field('locked', 'boolean', default=False),\n Field('client_ip', length=64),\n Field('created_datetime', 'datetime',\n default=request.now),\n Field('modified_datetime', 'datetime'),\n Field('unique_key', length=64),\n Field('session_data', 'blob'),\n migrate=table_migrate,\n )\n table = db[tname] # to allow for lazy table\n response.session_db_table = table\n if response.session_id:\n # Get session data out of the database\n try:\n (record_id, unique_key) = response.session_id.split(':')\n record_id = long(record_id)\n except (TypeError,ValueError):\n record_id = None\n\n # Select from database\n if record_id:\n row = table(record_id, unique_key=unique_key)\n # Make sure the session data exists in the database\n if row:\n # rows[0].update_record(locked=True)\n # Unpickle the data\n session_data = cPickle.loads(row.session_data)\n self.update(session_data)\n response.session_new = False\n else:\n record_id = None\n if record_id:\n response.session_id = '%s:%s' % (record_id, unique_key)\n response.session_db_unique_key = unique_key\n response.session_db_record_id = record_id\n else:\n response.session_id = None\n response.session_new = True\n # if there is no session id yet, we'll need to create a \n # new session\n else:\n response.session_new = True\n\n # set the cookie now if you know the session_id so user can set\n # cookie attributes in controllers/models\n # cookie will be reset later\n # yet cookie may be reset later\n # Removed comparison between old and new session ids - should send\n # the cookie all the time\n if isinstance(response.session_id,str):\n response.cookies[response.session_id_name] = response.session_id\n response.cookies[response.session_id_name]['path'] = '/'\n if cookie_expires:\n response.cookies[response.session_id_name]['expires'] = \\\n cookie_expires.strftime(FMT)\n\n session_pickled = cPickle.dumps(self)\n response.session_hash = hashlib.md5(session_pickled).hexdigest()\n\n if self.flash:\n (response.flash, self.flash) = (self.flash, None)", "metadata": "root.Session.connect", "header": "['class', 'Session', '(', 'Storage', ')', ':', '___EOS___']", "index": 719 }, { "content": " def _unlock(self, response):\n if response and response.session_file and response.session_locked:\n try:\n portalocker.unlock(response.session_file)\n response.session_locked = False\n except: # this should never happen but happens in Windows\n pass", "metadata": "root.Session._unlock", "header": "['class', 'Session', '(', 'Storage', ')', ':', '___EOS___']", "index": 1153 }, { "content": " def _close(self, response):\n if response and response.session_file:\n self._unlock(response)\n try:\n response.session_file.close()\n del response.session_file\n except:\n pass", "metadata": "root.Session._close", "header": "['class', 'Session', '(', 'Storage', ')', ':', '___EOS___']", "index": 1161 } ]
[ { "span": "except:", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 7 }, { "span": "except:", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 11 }, { "span": "except:", "start_line": 210, "start_column": 12, "end_line": 210, "end_column": 19 }, { "span": "except: ", "start_line": 227, "start_column": 12, "end_line": 227, "end_column": 19 }, { "span": "except:", "start_line": 827, "start_column": 20, "end_line": 827, "end_column": 27 }, { "span": "except: ", "start_line": 1158, "start_column": 12, "end_line": 1158, "end_column": 19 }, { "span": "except:", "start_line": 1167, "start_column": 12, "end_line": 1167, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "|", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "the", " ", "web", "2py", " ", "Web", " ", "Frame", "work", "\\", "10", ";", "|", " ", "Copy", "right", "ed", " ", "by", " ", "Mass", "imo", " ", "Di", " ", "Pie", "rro", " ", "<", "mdi", "pie", "rro", "@", "cs", ".", "dep", "aul", ".", "edu", ">", "\\", "10", ";", "|", " ", "License", ":", " ", "LGP", "Lv", "3", " ", "(", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/", "lg", "pl", ".", "html", ")", "\\", "10", ";", "\\", "10", ";", "Contain", "s", " ", "the", " ", "classe", "s", " ", "for", " ", "the", " ", "global", " ", "used", " ", "variab", "les", ":", "\\", "10", ";", "\\", "10", ";", "-", " ", "Request", "\\", "10", ";", "-", " ", "Respons", "e", "\\", "10", ";", "-", " ", "Sess", "ion", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gluon_", "._", "storage_", "import_", "Storage_", ",_", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "streamer", "_", "import_", "streamer", "_", ",_", "stream", "\\u", "file", "\\u", "or", "\\u", "304", "\\u", "or", "\\u", "206_", ",_", "DEF", "AUL", "T", "\\u", "CHUNK", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "xmlrpc", "_", "import_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "contenttype", "_", "import_", "contenttype", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "html_", "import_", "xml", "escape_", ",_", "TABLE_", ",_", "TR_", ",_", "PRE", "_", ",_", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "http_", "import_", "HTTP_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "fileu", "tils_", "import_", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "serializers_", "import_", "json_", ",_", "custom", "\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gluon_", "._", "settings_", "as_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "utils_", "import_", "web", "2py", "\\u", "uuid_", ",_", "secure", "\\u", "dumps_", ",_", "secure", "\\u", "loads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "settings_", "import_", "global", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "portal", "ock", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pickle_", "import_", "Pickl", "er_", ",_", "MARK", "_", ",_", "DICT_", ",_", "EMP", "TY", "\\u", "DICT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "types_", "import_", "Dict", "ionar", "y", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Cookie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "cache_", "import_", "Cache", "In", "Ram", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "fileu", "tils_", "import_", "copy", "stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FMT_", "=_", "'%", "a", ",", " ", "%", "d", "-%", "b", "-%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "PS", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PAS", "T_", "=_", "'", "Sat", ",", " ", "1", "-", "Jan", "-1", "971", " ", "00", ":", "00", ":", "00", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FUT", "URE_", "=_", "'", "Tu", "e", ",", " ", "1", "-", "De", "c", "-", "2999", " ", "23", ":", "5", "9", ":", "5", "9", "'_", "\\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_", "gluon_", "._", "contrib_", "._", "minif", "y_", "import_", "minif", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "minif", "y_", "=_", "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 ", " _", "have", "\\u", "minif", "y_", "=_", "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_", "simplejson_", "as_", "sj", "_", "#", "external", " ", "install", "ed", " ", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "as_", "sj", "_", "#", "standard", " ", "install", "ed", " ", "library_", "\\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_", "gluon_", "._", "contrib_", "._", "simplejson_", "as_", "sj", "_", "#", "pure", " ", "python", " ", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regex", "\\u", "session", "\\u", "id_", "=_", "re_", "._", "compile_", "(_", "'", "^", "([\\\\", "w", "\\\\-]", "+/", ")?", "[\\\\", "w", "\\\\-\\", "\\", ".]+", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Request", "'_", ",_", "'", "Respons", "e", "'_", ",_", "'", "Sess", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current_", "=_", "threading_", "._", "local_", "(_", ")_", "#", " ", "thread", "-", "local", " ", "storage", " ", "for", " ", "request", "-", "scope", " ", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "template_", "=_", "'<", "link", " ", "href", "=\"", "%", "s", "\"", " ", "rel", "=\"", "stylesheet", "\"", " ", "type", "=\"", "text", "/", "css", "\"", " ", "/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js", "\\u", "template_", "=_", "'<", "script", " ", "src", "=\"", "%", "s", "\"", " ", "type", "=\"", "text", "/", "javascript", "\">", "</", "script", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cof", "fe", "e\\u", "template_", "=_", "'<", "script", " ", "src", "=\"", "%", "s", "\"", " ", "type", "=\"", "text", "/", "cof", "fe", "e", "\">", "</", "script", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types", "cript", "\\u", "template_", "=_", "'<", "script", " ", "src", "=\"", "%", "s", "\"", " ", "type", "=\"", "text", "/", "types", "cript", "\">", "</", "script", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "less", "\\u", "template_", "=_", "'<", "link", " ", "href", "=\"", "%", "s", "\"", " ", "rel", "=\"", "stylesheet", "/", "less", "\"", " ", "type", "=\"", "text", "/", "css", "\"", " ", "/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "\\u", "inline_", "=_", "'<", "style", " ", "type", "=\"", "text", "/", "css", "\">", "\\\\", "n", "%", "s", "\\\\", "n", "</", "style", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js", "\\u", "inline_", "=_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">", "\\\\", "n", "%", "s", "\\\\", "n", "</", "script", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPORT", "ANT", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "require", "d", " ", "so", " ", "tha", "t", " ", "pickled", " ", "dict", "(", "s", ")", " ", "and", " ", "class", ".\\u", "\\u", "dict\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "sorte", "d", " ", "and", " ", "web", "2py", " ", "can", " ", "detect", " ", "with", "out", " ", "ambi", "guit", "y", " ", "whe", "n", " ", "a", " ", "session", " ", "changes_", "\\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_", "Sort", "ing", "Pickl", "er_", "._", "dispatch_", "=_", "copy_", "._", "copy_", "(_", "Pickl", "er_", "._", "dispatch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sort", "ing", "Pickl", "er_", "._", "dispatch_", "[_", "Dict", "ionar", "y", "Type_", "]_", "=_", "Sort", "ing", "Pickl", "er_", "._", "save", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Request_", "(_", "Storage_", ")_", ":_", "\\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_", "parse", "\\u", "post", "\\u", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tak", "es", " ", "the", " ", "body", " ", "of", " ", "the", " ", "request", " ", "and", " ", "unpack", "s", " ", "it", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "post", "\\u", "vars", ".", " ", "applica", "tion", "/", "json", " ", "is", " ", "als", "o", " ", "automati", "call", "y", " ", "parsed", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "self_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "vars_", "=_", "self_", "._", "\\u", "post", "\\u", "vars_", "=_", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "self_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "content", "-", "type", " ", "is", " ", "applica", "tion", "/", "json", ",", " ", "we", " ", "must", " ", "read", " ", "the", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "json_", "=_", "env_", "._", "get_", "(_", "'", "content", "\\u", "type", "'_", ",_", "''_", ")_", "[_", ":_", "16_", "]_", "==_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "\\u", "json_", ":_", "\\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 ", " _", "json", "\\u", "vars_", "=_", "sj", "_", "._", "load_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inco", "here", "nt", " ", "request", " ", "bodi", "es", " ", "can", " ", "still", " ", "be", " ", "parsed", " ", "\"", "ad", "-", "hoc", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "vars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "vars", " ", "and", " ", "get", "\\u", "vars", " ", "with", " ", "what", " ", "was", " ", "poste", "d", " ", "as", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "json", "\\u", "vars_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "vars_", "._", "update_", "(_", "json", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "POST", " ", "variab", "les", " ", "on", " ", "POST", ",", " ", "PU", "T", ",", " ", "BOT", "H", " ", "only", " ", "in", " ", "post", "\\u", "vars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "body_", "and_", "not_", "is", "\\u", "json_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "env_", "._", "request", "\\u", "method_", "in_", "(_", "'", "POST", "'_", ",_", "'", "PU", "T", "'_", ",_", "'", "DELET", "E", "'_", ",_", "'", "BOT", "H", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "string_", "=_", "env_", "._", "pop_", "(_", "'", "QUE", "RY", "\\u", "STRING", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dpo", "st_", "=_", "cgi_", "._", "Field", "Storage_", "(_", "fp_", "=_", "body_", ",_", "environ_", "=_", "env_", ",_", "keep", "\\u", "blank", "\\u", "values_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "vars_", "._", "update_", "(_", "dpo", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "query", "\\u", "string_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", "=_", "query", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "same", " ", "detect", "ion", " ", "used", " ", "by", " ", "Field", "Stor", "age", " ", "to", " ", "detect", " ", "multip", "art", " ", "POST", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "listi", "fy_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "not_", "isinstance_", "(_", "a_", ",_", "list_", ")_", "and_", "[_", "a_", "]_", ")_", "or_", "a_", "\\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 ", " _", "keys_", "=_", "sorted_", "(_", "dpo", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "not", " ", "sure", " ", "wh", "y", " ", "cgi", ".", "Field", "Stor", "age", " ", "return", "s", " ", "Non", "e", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dp", "k_", "=_", "dpo", "st_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "an", " ", "element", " ", "is", " ", "not", " ", "a", " ", "file", " ", "replace", " ", "it", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "value", " ", "else", " ", "lea", "ve", " ", "it", " ", "alo", "ne_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pvalue_", "=_", "listi", "fy_", "(_", "[_", "(_", "\\u", "dp", "k_", "if_", "\\u", "dp", "k_", "._", "filename_", "else_", "\\u", "dp", "k_", "._", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "dp", "k_", "in_", "dp", "k_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "dp", "k_", ",_", "list_", ")_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "dp", "k_", "if_", "dp", "k_", "._", "filename_", "else_", "dp", "k_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "pvalue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "post", "\\u", "vars_", "[_", "key_", "]_", "=_", "(_", "len_", "(_", "pvalue_", ")_", ">_", "1_", "and_", "pvalue_", ")_", "or_", "pvalue_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "connect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "'", "web", "2py", "\\u", "session", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "master", "app_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "separate", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "client_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cookie", "\\u", "expires_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compress", "ion", "\\u", "level_", "=_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "in", " ", "model", "s", ",", " ", "allow", "s", " ", "to", " ", "customize", " ", "Sess", "ion", " ", "handling", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "request", ":", " ", "the", " ", "request", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "response", ":", " ", "the", " ", "response", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "db", ":", " ", "to", " ", "store", "/", "retrieve", " ", "session", "s", " ", "in", " ", "db", " ", "(", "a", " ", "table", " ", "is", " ", "created", ")", "\\", "10", ";", " ", " ", " ", " ", "tablename", "(", "str", "):", " ", "table", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "master", "app", "(", "str", "):", " ", "points", " ", "to", " ", "anot", "her", "'", "s", " ", "app", " ", "session", "s", ".", " ", "Thi", "s", " ", "enable", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "\"", "SSO", "\"", " ", "environ", "ment", " ", "amo", "ng", " ", "apps", "\\", "10", ";", " ", " ", " ", " ", "migr", "ate", ":", " ", "pass", "ed", " ", "to", " ", "the", " ", "underl", "ying", " ", "db", "\\", "10", ";", " ", " ", " ", " ", "separate", ":", " ", "with", " ", "Tru", "e", ",", " ", "create", "s", " ", "a", " ", "folder", " ", "with", " ", "the", " ", "2", " ", "initials", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "session", " ", "id", ".", " ", "Can", " ", "als", "o", " ", "be", " ", "a", " ", "function", ",", " ", "e", ".", "g", ".", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "separate", "=", "lambda", "(", "session", "\\u", "name", "):", " ", "session", "\\u", "name", "[-", "2", ":]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "check", "\\u", "client", ":", " ", "if", " ", "Tru", "e", ",", " ", "session", "s", " ", "can", " ", "only", " ", "come", " ", "from", " ", "the", " ", "same", " ", "ip", "\\", "10", ";", " ", " ", " ", " ", "cookie", "\\u", "key", "(", "str", "):", " ", "secret", " ", "for", " ", "cookie", " ", "encrypt", "ion", "\\", "10", ";", " ", " ", " ", " ", "cookie", "\\u", "expir", "es", ":", " ", "sets", " ", "the", " ", "expir", "ation", " ", "of", " ", "the", " ", "cookie", "\\", "10", ";", " ", " ", " ", " ", "compress", "ion", "\\u", "level", "(", "int", "):", " ", "0", "-", "9", ",", " ", "sets", " ", "zli", "b", " ", "compress", "ion", " ", "on", " ", "the", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "the", " ", "encrypt", "ion", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "request_", "or_", "current_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response_", "or_", "current_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "app_", "=_", "master", "app_", "or_", "request_", "._", "application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookies_", "=_", "request_", "._", "cookies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "unlock_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "session", "\\u", "master", "app_", "=_", "master", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "id", "\\u", "name_", "=_", "'", "session", "\\u", "id", "\\u", "%", "s", "'_", "%_", "master", "app_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "data\\u", "name_", "=_", "'", "session", "\\u", "data\\u", "%", "s", "'_", "%_", "master", "app_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "cookie", "\\u", "expires_", "=_", "cookie", "\\u", "expires_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "client_", "=_", "str_", "(_", "request_", "._", "client_", ")_", "._", "replace_", "(_", "':'_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "cookie", "\\u", "key_", "=_", "cookie", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "cookie", "\\u", "compress", "ion", "\\u", "level_", "=_", "compress", "ion", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "there", " ", "is", " ", "a", " ", "session", "\\u", "id", " ", "in", " ", "cookies_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "session", "\\u", "id_", "=_", "cookies_", "[_", "response_", "._", "session", "\\u", "id", "\\u", "name_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "session", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "session", "\\u", "id_", "=_", "old", "\\u", "session", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "supposed", " ", "to", " ", "use", " ", "cookie", " ", "based", " ", "session", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookie", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "session", "\\u", "storage", "\\u", "type_", "=_", "'", "cookie", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "session", "\\u", "storage", "\\u", "type_", "=_", "'", "db", "'_", "\\u\\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_", "._", "session", "\\u", "storage", "\\u", "type_", "=_", "'", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wh", "y", " ", "do", " ", "we", " ", "do", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "connect", " ", "may", " ", "be", " ", "call", "ed", " ", "twi", "ce", ",", " ", "by", " ", "web", "2py", " ", "and", " ", "in", " ", "model", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "first", " ", "time", " ", "there", " ", "is", " ", "no", " ", "db", " ", "ye", "t", " ", "so", " ", "it", " ", "shou", "ld", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "global", "\\u", "settings_", "._", "db", "\\u", "sessions_", "is_", "True_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "master", "app_", "in_", "global", "\\u", "settings_", "._", "db", "\\u", "sessions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "session", "\\u", "storage", "\\u", "type_", "==_", "'", "cookie", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "there", " ", "is", " ", "session", " ", "data", " ", "in", " ", "cookies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "._", "session", "\\u", "data\\u", "name_", "in_", "cookies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session", "\\u", "cookie", "\\u", "data_", "=_", "cookies_", "[_", "response_", "._", "session", "\\u", "data\\u", "name_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session", "\\u", "cookie", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "session", "\\u", "cookie", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "secure", "\\u", "loads_", "(_", "session", "\\u", "cookie", "\\u", "data_", ",_", "cookie", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compress", "ion", "\\u", "level_", "=_", "compress", "ion", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "update_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "session", "\\u", "id_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "if", " ", "we", " ", "are", " ", "supposed", " ", "to", " ", "use", " ", "file", " ", "based", " ", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "session", "\\u", "storage", "\\u", "type_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "session", "\\u", "new_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "session", "\\u", "id", " ", "points", " ", "to", " ", "a", " ", "valid", " ", "ses", "ion", " ", "filename_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "session", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "regex", "\\u", "session", "\\u", "id_", "._", "match_", "(_", "response_", "._", "session", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "._", "session", "\\u", "id_", "=_", "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 ", " ", "_", "response_", "._", "session", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "up_", "(_", "request_", "._", "folder_", ")_", ",_", "master", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "s", "'_", ",_", "response_", "._", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "._", "session", "\\u", "file_", "=_", "open_", "(_", "response_", "._", "session", "\\u", "filename_", ",_", "'", "rb", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "ock", "er_", "._", "lock_", "(_", "response_", "._", "session", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "ock", "er_", "._", "LOCK", "\\u", "EX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "locked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "c", "Pickle_", "._", "load_", "(_", "response_", "._", "session", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oc_", "=_", "response_", "._", "session", "\\u", "filename_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'-'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "client_", "and_", "response_", "._", "session", "\\u", "client_", "!=_", "oc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Exception_", "(_", "\"", "cookie", " ", "attac", "k", "\"_", ")_", "\\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 ", " ", " _", "response_", "._", "session", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "response_", "._", "session", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uuid_", "=_", "web", "2py", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "id_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "response_", "._", "session", "\\u", "client_", ",_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "separate", "_", "=_", "separate", "_", "and_", "(_", "lambda_", "session", "\\u", "name_", ":_", "session", "\\u", "name_", "[_", "-_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "separate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "prefix_", "=_", "separate", "_", "(_", "response_", "._", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "id_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "prefix_", ",_", "response_", "._", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "session", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "up_", "(_", "request_", "._", "folder_", ")_", ",_", "master", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "s", "'_", ",_", "response_", "._", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "new_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "the", " ", "session", " ", "go", "es", " ", "in", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "session", "\\u", "storage", "\\u", "type_", "==_", "'", "db", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "global", "\\u", "settings_", "._", "db", "\\u", "sessions_", "is_", "not_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "settings_", "._", "db", "\\u", "sessions_", "._", "add_", "(_", "master", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "had", " ", "a", " ", "session", " ", "on", " ", "file", " ", "alr", "eda", "y", ",", " ", "close", " ", "it", " ", "(", "ye", "s", ",", " ", "can", " ", "happ", "en", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "session", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "on", " ", "GA", "E", " ", "tick", "ets", " ", "go", " ", "als", "o", " ", "in", " ", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings_", "._", "global", "\\u", "settings_", "._", "web", "2py", "\\u", "runt", "ime", "\\u", "gae", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "tick", "ets", "\\u", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "master", "app_", "==_", "request_", "._", "application_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "migrate_", "=_", "migrate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "migrate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tname_", "=_", "tablename_", "+_", "'\\u'_", "+_", "master", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "._", "get_", "(_", "tname_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Field_", "=_", "db_", "._", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "table_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "defin", "e\\u", "table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "lock", "ed", "'_", ",_", "'", "boolean", "'_", ",_", "default_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "client", "\\u", "ip", "'_", ",_", "length_", "=_", "64_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "created", "\\u", "datetime", "'_", ",_", "'", "datetime", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "request_", "._", "now_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "modifi", "ed", "\\u", "datetime", "'_", ",_", "'", "datetime", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "unique", "\\u", "key", "'_", ",_", "length_", "=_", "64_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "session", "\\u", "data", "'_", ",_", "'", "blob", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "=_", "table", "\\u", "migrate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "[_", "tname_", "]_", "#", " ", "to", " ", "allow", " ", "for", " ", "lazy", " ", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "session", "\\u", "db", "\\u", "table_", "=_", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "session", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "session", " ", "data", " ", "out", " ", "of", " ", "the", " ", "database_", "\\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 ", " ", "_", "(_", "record", "\\u", "id_", ",_", "unique", "\\u", "key_", ")_", "=_", "response_", "._", "session", "\\u", "id_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "id_", "=_", "long_", "(_", "record", "\\u", "id_", ")_", "\\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 ", " ", "_", "record", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "=_", "table_", "(_", "record", "\\u", "id_", ",_", "unique", "\\u", "key_", "=_", "unique", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "session", " ", "data", " ", "exist", "s", " ", "in", " ", "the", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rows", "[", "0", "].", "update", "\\u", "record", "(", "lock", "ed", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unp", "ickle", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "session", "\\u", "data_", "=_", "c", "Pickle_", "._", "loads_", "(_", "row_", "._", "session", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "session", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "new_", "=_", "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 ", " ", " _", "record", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "._", "session", "\\u", "id_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "record", "\\u", "id_", ",_", "unique", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "db", "\\u", "unique", "\\u", "key_", "=_", "unique", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "db", "\\u", "record", "\\u", "id_", "=_", "record", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "._", "session", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "new_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "no", " ", "session", " ", "id", " ", "ye", "t", ",", " ", "we", "'", "ll", " ", "need", " ", "to", " ", "create", " ", "a", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "session_", "\\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 ", " _", "response_", "._", "session", "\\u", "new_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "cookie", " ", "now", " ", "if", " ", "you", " ", "know", " ", "the", " ", "session", "\\u", "id", " ", "so", " ", "user", " ", "can", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cookie", " ", "attribute", "s", " ", "in", " ", "controlle", "rs", "/", "models_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cookie", " ", "will", " ", "be", " ", "reset", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ye", "t", " ", "cookie", " ", "may", " ", "be", " ", "reset", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Remove", "d", " ", "compa", "ris", "on", " ", "bet", "ween", " ", "old", " ", "and", " ", "new", " ", "session", " ", "ids", " ", "-", " ", "shou", "ld", " ", "send_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "cookie", " ", "all", " ", "the", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "response_", "._", "session", "\\u", "id_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "cookies_", "[_", "response_", "._", "session", "\\u", "id", "\\u", "name_", "]_", "=_", "response_", "._", "session", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "cookies_", "[_", "response_", "._", "session", "\\u", "id", "\\u", "name_", "]_", "[_", "'", "path", "'_", "]_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cookie", "\\u", "expires_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "cookies_", "[_", "response_", "._", "session", "\\u", "id", "\\u", "name_", "]_", "[_", "'", "expir", "es", "'_", "]_", "=_", "cookie", "\\u", "expires_", "._", "strftime_", "(_", "FMT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session", "\\u", "pickled", "_", "=_", "c", "Pickle_", "._", "dumps_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "hash_", "=_", "hashlib_", "._", "md5_", "(_", "session", "\\u", "pickled", "_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "flash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "response_", "._", "flash_", ",_", "self_", "._", "flash_", ")_", "=_", "(_", "self_", "._", "flash_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unlock_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "and_", "response_", "._", "session", "\\u", "file_", "and_", "response_", "._", "session", "\\u", "locked_", ":_", "\\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 ", " _", "portal", "ock", "er_", "._", "unlock_", "(_", "response_", "._", "session", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "session", "\\u", "locked_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "this", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", " ", "but", " ", "happ", "ens", " ", "in", " ", "Windows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", "(_", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "and_", "response_", "._", "session", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "unlock_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "session", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "response_", "._", "session", "\\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 ", " _", "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,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